Merge pull request #24 from fkautz/pr_out_initial_work_for_xml_list_objects
commit
d6fd1b0a38
@ -0,0 +1,29 @@ |
||||
package minioapi |
||||
|
||||
import ( |
||||
"encoding/xml" |
||||
) |
||||
|
||||
type ListResponse struct { |
||||
XMLName xml.Name `xml:"ListBucketResult"` |
||||
Name string `xml:"Name"` |
||||
Prefix string |
||||
Marker string |
||||
MaxKeys int32 |
||||
IsTruncated bool |
||||
Contents []Content `xml:"Contents",innerxml` |
||||
} |
||||
|
||||
type Content struct { |
||||
Key string |
||||
LastModified string |
||||
ETag string |
||||
Size uint64 |
||||
StorageClass string |
||||
Owner Owner |
||||
} |
||||
|
||||
type Owner struct { |
||||
ID string |
||||
DisplayName string |
||||
} |
@ -0,0 +1,45 @@ |
||||
package minioapi |
||||
|
||||
import ( |
||||
"encoding/xml" |
||||
"fmt" |
||||
"log" |
||||
"os" |
||||
"testing" |
||||
) |
||||
|
||||
func TestMinioApi(t *testing.T) { |
||||
owner := Owner{ |
||||
ID: "MyID", |
||||
DisplayName: "MyDisplayName", |
||||
} |
||||
contents := []Content{ |
||||
Content{ |
||||
Key: "one", |
||||
LastModified: "two", |
||||
ETag: "\"ETag\"", |
||||
Size: 1, |
||||
StorageClass: "three", |
||||
Owner: owner, |
||||
}, |
||||
Content{ |
||||
Key: "four", |
||||
LastModified: "five", |
||||
ETag: "\"ETag\"", |
||||
Size: 1, |
||||
StorageClass: "six", |
||||
Owner: owner, |
||||
}, |
||||
} |
||||
data := &ListResponse{ |
||||
Name: "name", |
||||
Contents: contents, |
||||
} |
||||
|
||||
xmlEncoder := xml.NewEncoder(os.Stdout) |
||||
if err := xmlEncoder.Encode(data); err != nil { |
||||
log.Println(err) |
||||
} else { |
||||
fmt.Println("") |
||||
} |
||||
} |
Loading…
Reference in new issue