Skip to content

Commit

Permalink
Revert "feat: ListBucketsWithMetadata() API (minio#1547)"
Browse files Browse the repository at this point in the history
This reverts commit 40b3e9d.
  • Loading branch information
harshavardhana committed Sep 17, 2021
1 parent 8daff5c commit ff143fd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 70 deletions.
31 changes: 0 additions & 31 deletions api-datatypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,45 +22,14 @@ import (
"io"
"net/http"
"time"

"github.com/minio/minio-go/v7/pkg/tags"
)

// BucketUsageInfo captures bucket usage metrics
type BucketUsageInfo struct {
Size uint64
ObjectsCount uint64
ObjectsHistogram StringMap
}

// BucketQuotaConfig captures any bucket quota settings
type BucketQuotaConfig struct {
Quota uint64
Type string
}

// BucketDetailsInfo cpatures bucket specific features
type BucketDetailsInfo struct {
Versioning bool
VersioningSuspended bool
Locking bool
Replication bool
Tagging *tags.Tags
Quota *BucketQuotaConfig
}

// BucketInfo container for bucket metadata.
type BucketInfo struct {
// The name of the bucket.
Name string `json:"name"`
// Date the bucket was created.
CreationDate time.Time `json:"creationDate"`

// Bucket usage info and object histogram
Usage *BucketUsageInfo `json:"usage"`

// Bucket details info
Details *BucketDetailsInfo `json:"details"`
}

// StringMap represents map with custom UnmarshalXML
Expand Down
40 changes: 1 addition & 39 deletions api-list.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,6 @@ import (
"github.com/minio/minio-go/v7/pkg/s3utils"
)

// ListBucketsWithMetadata list all buckets owned by this authenticated user.
//
// This call requires explicit authentication, no anonymous requests are
// allowed for listing buckets.
//
// api := client.New(....)
// for message := range api.ListBucketsWithMetadata(context.Background()) {
// fmt.Println(message)
// }
//
func (c Client) ListBucketsWithMetadata(ctx context.Context) ([]BucketInfo, error) {
urlValues := make(url.Values)
urlValues.Set("metadata", "true")

// Execute GET on service with metadata
resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{
queryValues: urlValues,
contentSHA256Hex: emptySHA256Hex,
})
defer closeResponse(resp)
if err != nil {
return nil, err
}
if resp != nil {
if resp.StatusCode != http.StatusOK {
return nil, httpRespToErrorResponse(resp, "", "")
}
}
listAllMyBucketsResult := listAllMyBucketsResult{}
err = xmlDecoder(resp.Body, &listAllMyBucketsResult)
if err != nil {
return nil, err
}
return listAllMyBucketsResult.Buckets.Bucket, nil
}

// ListBuckets list all buckets owned by this authenticated user.
//
// This call requires explicit authentication, no anonymous requests are
Expand All @@ -74,9 +38,7 @@ func (c Client) ListBucketsWithMetadata(ctx context.Context) ([]BucketInfo, erro
//
func (c Client) ListBuckets(ctx context.Context) ([]BucketInfo, error) {
// Execute GET on service.
resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{
contentSHA256Hex: emptySHA256Hex,
})
resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{contentSHA256Hex: emptySHA256Hex})
defer closeResponse(resp)
if err != nil {
return nil, err
Expand Down

0 comments on commit ff143fd

Please sign in to comment.