MCPcopy
hub / github.com/minio/minio-go / ListBuckets

Method ListBuckets

api-list.go:41–59  ·  view source on GitHub ↗

ListBuckets 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.ListBuckets(context.Background()) { fmt.Println(message) }

(ctx context.Context)

Source from the content-addressed store, hash-verified

39// fmt.Println(message)
40// }
41func (c *Client) ListBuckets(ctx context.Context) ([]BucketInfo, error) {
42 // Execute GET on service.
43 resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{contentSHA256Hex: emptySHA256Hex})
44 defer closeResponse(resp)
45 if err != nil {
46 return nil, err
47 }
48 if resp != nil {
49 if resp.StatusCode != http.StatusOK {
50 return nil, httpRespToErrorResponse(resp, "", "")
51 }
52 }
53 listAllMyBucketsResult := listAllMyBucketsResult{}
54 err = xmlDecoder(resp.Body, &listAllMyBucketsResult)
55 if err != nil {
56 return nil, err
57 }
58 return listAllMyBucketsResult.Buckets.Bucket, nil
59}
60
61// ListDirectoryBuckets list all buckets owned by this authenticated user.
62//

Callers 3

testFunctionalFunction · 0.95
testFunctionalV2Function · 0.95
mainFunction · 0.80

Calls 4

executeMethodMethod · 0.95
httpRespToErrorResponseFunction · 0.85
closeResponseFunction · 0.70
xmlDecoderFunction · 0.70

Tested by

no test coverage detected