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

Method PutBucketInventoryConfiguration

api-inventory-ext.go:101–125  ·  view source on GitHub ↗

PutBucketInventoryConfiguration creates or updates an 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 configur

(ctx context.Context, bucket string, id string, yamlDef string, _ ...InventoryPutConfigOption)

Source from the content-addressed store, hash-verified

99//
100// Returns an error if the operation fails, or if bucket name, id, or yamlDef is empty.
101func (c *Client) PutBucketInventoryConfiguration(ctx context.Context, bucket string, id string, yamlDef string, _ ...InventoryPutConfigOption) error {
102 if err := s3utils.CheckValidBucketName(bucket); err != nil {
103 return err
104 }
105 if id == "" {
106 return errInvalidArgument("inventory ID cannot be empty")
107 }
108 if yamlDef == "" {
109 return errInvalidArgument("YAML definition cannot be empty")
110 }
111 reqMeta := makeInventoryReqMetadata(bucket, "id", id)
112 reqMeta.contentBody = strings.NewReader(yamlDef)
113 reqMeta.contentLength = int64(len(yamlDef))
114 reqMeta.contentMD5Base64 = sumMD5Base64([]byte(yamlDef))
115
116 resp, err := c.executeMethod(ctx, http.MethodPut, reqMeta)
117 defer closeResponse(resp)
118 if err != nil {
119 return err
120 }
121 if resp.StatusCode != http.StatusOK {
122 return httpRespToErrorResponse(resp, bucket, "")
123 }
124 return nil
125}
126
127// GetBucketInventoryConfiguration retrieves the inventory configuration for a bucket.
128// This is a MinIO-specific API and is not compatible with AWS S3.

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected