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

Method removeBucketPolicy

api-bucket-policy.go:83–105  ·  view source on GitHub ↗

Removes all policies on a bucket.

(ctx context.Context, bucketName string)

Source from the content-addressed store, hash-verified

81
82// Removes all policies on a bucket.
83func (c *Client) removeBucketPolicy(ctx context.Context, bucketName string) error {
84 // Get resources properly escaped and lined up before
85 // using them in http request.
86 urlValues := make(url.Values)
87 urlValues.Set("policy", "")
88
89 // Execute DELETE on objectName.
90 resp, err := c.executeMethod(ctx, http.MethodDelete, requestMetadata{
91 bucketName: bucketName,
92 queryValues: urlValues,
93 contentSHA256Hex: emptySHA256Hex,
94 })
95 defer closeResponse(resp)
96 if err != nil {
97 return err
98 }
99
100 if resp.StatusCode != http.StatusNoContent {
101 return httpRespToErrorResponse(resp, bucketName, "")
102 }
103
104 return nil
105}
106
107// GetBucketPolicy retrieves the access permissions policy for the bucket.
108// If no bucket policy exists, returns an empty string with no error.

Callers 1

SetBucketPolicyMethod · 0.95

Calls 4

executeMethodMethod · 0.95
httpRespToErrorResponseFunction · 0.85
closeResponseFunction · 0.70
SetMethod · 0.45

Tested by

no test coverage detected