删除桶

您可以使用 delete_bucket 接口删除桶,注意,在删除桶前,必须先确保桶为空,否则会导致错误。以下代码展示如何删除一个桶:

def delete_bucket(client, bucket_name)
  client.delete_bucket({ bucket: bucket_name })
  puts 'Bucket deleted.'
rescue StandardError => e
  puts "Error when deleting bucket: #{e.message}"
end