• Object Storage Service

  1. Help Center
  2. Object Storage Service
  3. Developer Guide (Android SDK)
  4. Bucket Management
  5. Deleting a Bucket

Deleting a Bucket

You can call ObsClient.deleteBucket to delete a bucket. Sample code is as follows:

String endPoint = "yourdomainname";
String ak = "*** Provide your Access Key ***";
String sk = "*** Provide your Secret Key ***";
// Create an instance of ObsClient.
ObsClient obsClient = new ObsClient(ak, sk, endPoint);

// Delete a bucket.

// Close obsClient.
  • Only empty buckets (without objects and part fragments) can be deleted.
  • Bucket deletion is a non-idempotence operation and an error will be reported if the to-be-deleted bucket does not exist.