Listing Buckets
If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference
You can call ObsClient.listBuckets to list buckets. Sample code is as follows:
String endPoint = "https://your-endpoint";
String ak = "*** Provide your Access Key ***";
String sk = "*** Provide your Secret Key ***";
// Create an instance of ObsClient.
ObsClient obsClient = new ObsClient(ak, sk, endPoint);
// List bukets.
ListBucketsRequest request = new ListBucketsRequest();
request.setQueryLocation(true)
List<ObsBucket> buckets = obsClient.listBuckets(request);
for(ObsBucket bucket : buckets){
Log.i("ListBuckets", "BucketName" + bucket.getBucketName());
Log.i("ListBuckets", "CreationDate" + bucket.getCreationDate());
Log.i("ListBuckets", "Location:" + bucket.getLocation());
}
- Obtained bucket names are listed in the lexicographical order.
- Set ListBucketsRequest.setQueryLocation to query the bucket location when listing buckets.
Last Article: Creating a Bucket
Next Article: Deleting a Bucket
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.