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

Method GenerateInventoryConfigYAML

api-inventory-ext.go:61–80  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

59//
60// Returns a YAML template string that can be customized and used with PutBucketInventoryConfiguration.
61func (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.
83type inventoryPutConfigOpts struct{}

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected