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)
| 99 | // |
| 100 | // Returns an error if the operation fails, or if bucket name, id, or yamlDef is empty. |
| 101 | func (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. |
nothing calls this directly
no test coverage detected