GenerateInventoryConfigYAML generates a YAML template for an inventory configuration. 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
(ctx context.Context, bucket, id string)
| 59 | // |
| 60 | // Returns a YAML template string that can be customized and used with PutBucketInventoryConfiguration. |
| 61 | func (c *Client) GenerateInventoryConfigYAML(ctx context.Context, bucket, id string) (string, error) { |
| 62 | if err := s3utils.CheckValidBucketName(bucket); err != nil { |
| 63 | return "", err |
| 64 | } |
| 65 | if id == "" { |
| 66 | return "", errInvalidArgument("inventory ID cannot be empty") |
| 67 | } |
| 68 | reqMeta := makeInventoryReqMetadata(bucket, "generate", "", "id", id) |
| 69 | resp, err := c.executeMethod(ctx, http.MethodGet, reqMeta) |
| 70 | defer closeResponse(resp) |
| 71 | if err != nil { |
| 72 | return "", err |
| 73 | } |
| 74 | if resp.StatusCode != http.StatusOK { |
| 75 | return "", httpRespToErrorResponse(resp, bucket, "") |
| 76 | } |
| 77 | buf := new(strings.Builder) |
| 78 | _, err = io.Copy(buf, resp.Body) |
| 79 | return buf.String(), err |
| 80 | } |
| 81 | |
| 82 | // inventoryPutConfigOpts is a placeholder for future options that may be added. |
| 83 | type inventoryPutConfigOpts struct{} |
nothing calls this directly
no test coverage detected