Removes all policies on a bucket.
(ctx context.Context, bucketName string)
| 81 | |
| 82 | // Removes all policies on a bucket. |
| 83 | func (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. |
no test coverage detected