PUT Bucket ACL

OBS allows you to control access permissions for buckets. By default, only the creator of a bucket has the READ and WRITE permissions for the bucket. The creator can also set other access permissions. For example, the creator can set a public-read access policy to grant the read permission to other users.

You can set an access control policy when creating a bucket, and modify or obtain the bucket ACL using the PUT Bucket ACL and GET Bucket ACL operations.

Request Syntax

PUT /?acl HTTP/1.1
Host: bucketname.obs.cn-north-1.myhwclouds.com
Date: date
Authorization: authorization
Content-Type: application/xml
Content-Length: length

<AccessControlPolicy>
    <Owner>
        <ID>ID</ID>
        <DisplayName>displayname</DisplayName>
    </Owner>
    <AccessControlList>
        <Grant>
            <Grantee>grantee</Grantee>
            <Permission>permission</Permission>
        </Grant>
    </AccessControlList>
</AccessControlPolicy>

Request Parameters

This request contains no parameter.

Request Headers

You can set the ACL of a bucket to a predefined ACL, also called a canned ACL. Each canned ACL has a predefined set of grantees and permissions. To grant access permissions by specifying canned ACLs, you use the following header and specify the canned ACL name as its value.

Table 1 Header for setting the bucket ACL

Header

Description

Required or Optional

x-amz-acl

Sets the ACL of the bucket using the specified canned ACL.

Type: string

Valid values: private | public-read | public-read-write | authenticated-read | bucket-owner-read | bucket-owner-full-control | log-delivery-write

Optional

Request Elements

This request uses elements to specify an ACL. Common Request Headers describes the elements.

Table 2 Additional request elements

Element

Description

Required or Optional

Owner

Indicates the bucket owner. This element consists of ID and DisplayName.

Type: XML

Optional

ID

Indicates the grantee domain ID.

Type: string

Optional

DisplayName

Indicates the grantee name.

Type: string

Optional

Grant

Indicates the grantee and his or her permissions.

Type: XML

Optional

Grantee

Records details about the grantee. For details, see Table 1.

Type: XML

Optional

Permission

Indicates the permissions to be granted. For details, see Table 2.

Type: enumeration

Optional

AccessControlList

Indicates the ACL. This element consists of Grant, Grantee, and Permission.

Type: XML

Optional

Response Syntax

HTTP/1.1 status_code
Date: date
Content-Length: length

Response Headers

This response uses common headers. For details, see Common Response Headers.

Response Elements

This response contains no element.

Error Responses

No special error responses are returned. For details about error responses, see Table 1.

Registration