All Products
Search
Document Center

Object Storage Service:Get the ACL of a bucket (iOS SDK)

Last Updated:Nov 29, 2025

A bucket is a container used to store objects in Object Storage Service (OSS). All objects in OSS are stored in buckets. This topic describes how to query the access control list (ACL) of a bucket.

Usage notes

  • Before you run the sample code in this topic, you must create an OSSClient instance using methods such as using a custom domain name or Security Token Service (STS). For more information, see Initialization.

    Note

    When you initialize an OSSClient instance, specify an endpoint that maps to the region of the bucket.

Bucket ACLs

The access control list (ACL) for a bucket has three types:

ACL

Description

Value

Private

Only the bucket owner and authorized users have read and write permissions on objects in the bucket. Other users cannot access objects in the bucket.

private

Public-read

Only the bucket owner and authorized users have read and write permissions on objects in the bucket. Other users have only read permissions on objects in the bucket. Exercise caution when you set the bucket ACL to this value.

public-read

Public-read-write

All users have read and write permissions on objects in the bucket. Exercise caution when you set the bucket ACL to this value.

public-read-write

Examples

The following sample code provides an example on how to query the ACL of a bucket named examplebucket:

OSSGetBucketACLRequest *request = [OSSGetBucketACLRequest new];
// Specify the name of the bucket. Example: examplebucket. 
request.bucketName = @"examplebucket";
// Query the ACL of the bucket. 
OSSTask * getBucketACLTask = [client getBucketACL:request];
[getBucketACLTask continueWithBlock:^id(OSSTask *task) {
    if (!task.error) {
        OSSGetBucketACLResult *result = task.result;
        NSLog(@"ACL: %@", result.aclGranted);
    } else {
        NSLog(@"get bucket ACL failed, error: %@", task.error);
    }
    return nil;
}];
// Implement synchronous blocking to wait for the task to complete. 
// [getBucketACLTask waitUntilFinished];

References

  • For the complete sample code that is used to query the ACL of a bucket, visit GitHub.

  • For more information about the API operation that you can call to query the ACL of a bucket, see GetBucketAcl.

  • For more information about how to initialize an OSSClient instance, see Initialization.