RemoveBucketWithOptions deletes the bucket name. All objects (including all object versions and delete markers) in the bucket will be deleted forcibly if bucket options set ForceDelete to 'true'.
(ctx context.Context, bucketName string, opts RemoveBucketOptions)
| 57 | // in the bucket will be deleted forcibly if bucket options set |
| 58 | // ForceDelete to 'true'. |
| 59 | func (c *Client) RemoveBucketWithOptions(ctx context.Context, bucketName string, opts RemoveBucketOptions) error { |
| 60 | // Input validation. |
| 61 | if err := s3utils.CheckValidBucketName(bucketName); err != nil { |
| 62 | return err |
| 63 | } |
| 64 | |
| 65 | // Build headers. |
| 66 | headers := make(http.Header) |
| 67 | if opts.ForceDelete { |
| 68 | headers.Set(minIOForceDelete, "true") |
| 69 | } |
| 70 | |
| 71 | // Execute DELETE on bucket. |
| 72 | resp, err := c.executeMethod(ctx, http.MethodDelete, requestMetadata{ |
| 73 | bucketName: bucketName, |
| 74 | contentSHA256Hex: emptySHA256Hex, |
| 75 | customHeader: headers, |
| 76 | }) |
| 77 | defer closeResponse(resp) |
| 78 | if err != nil { |
| 79 | return err |
| 80 | } |
| 81 | if resp != nil { |
| 82 | if resp.StatusCode != http.StatusNoContent { |
| 83 | return httpRespToErrorResponse(resp, bucketName, "") |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | // Remove the location from cache on a successful delete. |
| 88 | c.bucketLocCache.Delete(bucketName) |
| 89 | return nil |
| 90 | } |
| 91 | |
| 92 | // RemoveBucket deletes the bucket name. |
| 93 | // |
nothing calls this directly
no test coverage detected