feat: Add ListBucketsWithMetadata extension API (#13219)

This commit is contained in:
Harshavardhana
2021-09-16 09:52:41 -07:00
committed by GitHub
parent 78dc08bdc2
commit 45bcf73185
5 changed files with 105 additions and 7 deletions

View File

@@ -240,6 +240,16 @@ type CommonPrefix struct {
type Bucket struct {
Name string
CreationDate string // time string of format "2006-01-02T15:04:05.000Z"
// Usage size of the bucket not reflective of
// actual usage atomically, but an ever increasing
// value.
Usage *BucketUsageInfo `xml:"Usage,omitempty"`
// Provides information about various bucket features
// enabled such as versioning, object locking, tagging
// quota, replication config etc.
Details *BucketDetailsInfo `xml:"Details,omitempty"`
}
// ObjectVersion container for object version metadata
@@ -263,7 +273,7 @@ func (o ObjectVersion) MarshalXML(e *xml.Encoder, start xml.StartElement) error
return e.EncodeElement(objectVersionWrapper(o), start)
}
// StringMap is a map[string]string.
// StringMap is a map[string]string
type StringMap map[string]string
// MarshalXML - StringMap marshals into XML.
@@ -424,10 +434,12 @@ func generateListBucketsResponse(buckets []BucketInfo) ListBucketsResponse {
}
for _, bucket := range buckets {
var listbucket = Bucket{}
listbucket.Name = bucket.Name
listbucket.CreationDate = bucket.Created.UTC().Format(iso8601TimeFormat)
listbuckets = append(listbuckets, listbucket)
listbuckets = append(listbuckets, Bucket{
Name: bucket.Name,
CreationDate: bucket.Created.UTC().Format(iso8601TimeFormat),
Usage: bucket.Usage,
Details: bucket.Details,
})
}
data.Owner = owner