• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. Developer Guide (Android SDK)
  4. Bucket Management
  5. Obtaining Bucket Metadata

Obtaining Bucket Metadata

You can call ObsClient.getBucketMetadata to obtain the metadata of 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);

BucketMetadataInfoRequest request = new BucketMetadataInfoRequest("bucketname");
request.setOrigin("http://www.a.com");
//Obtain bucket metadata.
BucketMetadataInfoResult result = obsClient.getBucketMetadata(request);
Log.i("GetBucketMetadata", "\t:" + result.getDefaultStorageClass());
Log.i("GetBucketMetadata", "\t:" + result.getAllowOrigin());
Log.i("GetBucketMetadata", "\t:" + result.getMaxAge());
Log.i("GetBucketMetadata", "\t:" + result.getAllowHeaders());
Log.i("GetBucketMetadata", "\t:" + result.getAllowMethods());
Log.i("GetBucketMetadata", "\t:" + result.getExposeHeaders());

// Close obsClient.
obsClient.close();
NOTE:

For details about values of methods, such as BucketMetadataInfoResult.getAllowMethods, see the CORS configurations of the bucket.