A bucket is a container for objects stored in OSS. Every object is contained in a bucket. This topic describes how to delete a bucket.

Note
  • Before you delete a bucket, you must delete all objects in the bucket, LiveChannel objects, and fragments generated by multipart uploads. For more information about deleting a LiveChannel object, see LiveChannel.
  • To delete parts generated in incomplete multipart uploads, call list_upload to list all the parts, and then call abort_upload to delete the parts.

The following code provides an example on how to call Client#delete_bucket to delete a specified bucket:

require 'aliyun/oss'

client = Aliyun::OSS::Client.new(
  endpoint: 'endpoint',
  access_key_id: 'AccessKeyId', access_key_secret: 'AccessKeySecret')

client.delete_bucket('my-bucket')
		

For more information about how to delete a bucket, seeDeleteBucket.