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

Method GetBucketInventoryConfiguration

api-inventory-ext.go:136–159  ·  view source on GitHub ↗

GetBucketInventoryConfiguration retrieves the inventory configuration for a bucket. This is a MinIO-specific API and is not compatible with AWS S3. Parameters: - ctx: Context for request cancellation and timeout - bucket: Name of the bucket - id: Unique identifier for the inventory configuration R

(ctx context.Context, bucket, id string)

Source from the content-addressed store, hash-verified

134//
135// Returns the inventory configuration or an error if the operation fails or if the configuration doesn't exist.
136func (c *Client) GetBucketInventoryConfiguration(ctx context.Context, bucket, id string) (*InventoryConfiguration, error) {
137 if err := s3utils.CheckValidBucketName(bucket); err != nil {
138 return nil, err
139 }
140 if id == "" {
141 return nil, errInvalidArgument("inventory ID cannot be empty")
142 }
143 reqMeta := makeInventoryReqMetadata(bucket, "id", id)
144 resp, err := c.executeMethod(ctx, http.MethodGet, reqMeta)
145 defer closeResponse(resp)
146 if err != nil {
147 return nil, err
148 }
149 if resp.StatusCode != http.StatusOK {
150 return nil, httpRespToErrorResponse(resp, bucket, "")
151 }
152 decoder := json.NewDecoder(resp.Body)
153 var ic InventoryConfiguration
154 err = decoder.Decode(&ic)
155 if err != nil {
156 return nil, err
157 }
158 return &ic, nil
159}
160
161// DeleteBucketInventoryConfiguration deletes an inventory configuration from a bucket.
162// This is a MinIO-specific API and is not compatible with AWS S3.

Callers

nothing calls this directly

Calls 6

executeMethodMethod · 0.95
CheckValidBucketNameFunction · 0.92
errInvalidArgumentFunction · 0.85
makeInventoryReqMetadataFunction · 0.85
httpRespToErrorResponseFunction · 0.85
closeResponseFunction · 0.70

Tested by

no test coverage detected