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

Method RemoveBucket

api-remove.go:96–120  ·  view source on GitHub ↗

RemoveBucket deletes the bucket name. All objects (including all object versions and delete markers). in the bucket must be deleted before successfully attempting this request.

(ctx context.Context, bucketName string)

Source from the content-addressed store, hash-verified

94// All objects (including all object versions and delete markers).
95// in the bucket must be deleted before successfully attempting this request.
96func (c *Client) RemoveBucket(ctx context.Context, bucketName string) error {
97 // Input validation.
98 if err := s3utils.CheckValidBucketName(bucketName); err != nil {
99 return err
100 }
101 // Execute DELETE on bucket.
102 resp, err := c.executeMethod(ctx, http.MethodDelete, requestMetadata{
103 bucketName: bucketName,
104 contentSHA256Hex: emptySHA256Hex,
105 })
106 defer closeResponse(resp)
107 if err != nil {
108 return err
109 }
110 if resp != nil {
111 if resp.StatusCode != http.StatusNoContent {
112 return httpRespToErrorResponse(resp, bucketName, "")
113 }
114 }
115
116 // Remove the location from cache on a successful delete.
117 c.bucketLocCache.Delete(bucketName)
118
119 return nil
120}
121
122// AdvancedRemoveOptions intended for internal use by replication
123type AdvancedRemoveOptions struct {

Callers 13

testFunctionalFunction · 0.95
TestGetObjectCoreFunction · 0.80
TestGetBucketPolicyFunction · 0.80
TestCoreCopyObjectFunction · 0.80
TestCoreCopyObjectPartFunction · 0.80
TestCorePutObjectFunction · 0.80
TestCoreMultipartUploadFunction · 0.80
cleanupBucketFunction · 0.80
cleanupVersionedBucketFunction · 0.80

Calls 5

executeMethodMethod · 0.95
CheckValidBucketNameFunction · 0.92
httpRespToErrorResponseFunction · 0.85
DeleteMethod · 0.80
closeResponseFunction · 0.70

Tested by 8

TestGetObjectCoreFunction · 0.64
TestGetBucketPolicyFunction · 0.64
TestCoreCopyObjectFunction · 0.64
TestCoreCopyObjectPartFunction · 0.64
TestCorePutObjectFunction · 0.64
TestCoreMultipartUploadFunction · 0.64