GET Bucket replication

Last updated: 2019-09-25 18:48:18

PDF

Description

The GET Bucket replication API is used to query the cross-region replication configuration in a bucket. When initiating this request, you need to get the request signature to show that the request has been authorized.

Request

Sample Request

GET /?replication HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Authorization: Auth String

Authorization: Auth String (see Request Signature for more information).

Request Headers

Common Headers

The implementation of this request uses a common request header. For more information on common request headers, see Common Request Headers.

Special Headers

This request does not use any special request header.

Request Body

The request body of this request is empty.

Response

Response Headers

Common Response Headers

This response contains a common response header. For more information on common response headers, see Common Response Headers.

Special Response Headers

Parameter Type Description
x-cos-replication-rule-creation-time UTC timestamp Creation time of the cross-region replication rule

Response Body

The return of this response body is application/xml data. Below is an example containing all the node data:

<ReplicationConfiguration>
    <Role>qcs::cam::uin/[UIN]:uin/[Subaccount]</Role>
    <Rule>
        <Status></Status>
        <ID></ID>
        <Prefix></Prefix>
        <Destination>
            <Bucket>qcs::cos:[Region]::[BucketName-APPID]</Bucket>
        </Destination>
    </Rule>
</ReplicationConfiguration>

The content is described in details below:

Node Name (Keyword) Parent Node Description Type Required
ReplicationConfiguration None Describes all cross-region replication configuration information Container Yes
Role ReplicationConfiguration Initiator ID:
qcs::cam::uin/&lt;OwnerUin>:uin/&lt;SubUin>
String Yes
Rule ReplicationConfiguration Specific configuration information of up to 1,000 rules. Container Yes
ID ReplicationConfiguration.Rule Name used to identify a specific rule String No
Status ReplicationConfiguration.Rule Indicates whether a rule is in effect; enumerators: Enabled, Disabled String Yes
Prefix ReplicationConfiguration.Rule Prefix matching policy. Policies cannot overlap; otherwise, an error will be returned. The prefix matching root directory is empty String Yes
Destination ReplicationConfiguration.Rule Destination bucket information Container Yes
Bucket ReplicationConfiguration.Rule.Destination Resource ID:
qcs::cos:[region]::[bucketname-Appid]
String Yes
StorageClass ReplicationConfiguration.Rule.Destination Storage class; enumerators: Standard, Standard_IA. It follows the storage class of the source bucket by default. String No

Error Codes

Some common special errors that may occur with this request are listed below. For common error codes, see Error Codes.

Error Code Description Status Code
ReplicationConfigurationNotFoundError No cross-region replication rule found. 404 Not Found

Samples

Request

The following request sample gets the cross-region replication configuration from the bucket originbucket-1250000000.

GET /?replication HTTP/1.1
Date: Fri, 14 Apr 2019 07:17:19 GMT
Authorization: q-sign-algorithm=sha1&q-ak=AKIDZfbOAo7cllgPvF9cXFrJD0a1ICvR98JM&q-sign-time=1503895278;1503895638&q-key-time=1503895278;1503895638&q-header-list=host&q-url-param-list=replication&q-signature=f77900be432072b16afd8222b4b349aabd837cb9
Host: originbucket-1250000000.cos.ap-guangzhou.myqcloud.com
Content-Length: 0

Response

After the request above is made, COS returns the following response, indicating that the current cross-region replication configuration for the bucket is enabled. In the rule, the objects to be replicated are the ones prefixed with testPrefix in the bucket originbucket-1250000000, and the storage class of the object copies is by default the same as that of the objects in the source bucket.

Content-Type: application/xml
Content-Length: 309
Connection: keep-alive
Date: Fri, 14 Apr 2019 07:17:19 GMT
Server: tencent-cos
x-cos-replication-rule-creation-time: Fri, 14 Apr 2019 07:06:19 GMT
x-cos-request-id: NWQwMzQ5ZmZfMjBiNDU4NjRfNjAwOV84MzA2MjE=
<ReplicationConfiguration>
    <Role>qcs::cam::uin/100000000001:uin/100000000001</Role>
    <Rule>
        <Status>Enabled</Status>
        <ID>RuleId_01</ID>
        <Prefix>testPrefix</Prefix>
        <Destination>
            <Bucket>qcs::cos:ap-guangzhou::destinationbucket-1250000000</Bucket>
        </Destination>
    </Rule>
</ReplicationConfiguration>