Baidu AI Cloud
中国站

百度智能云

Object Storage

PutBucketReplication

Interface Description

This interface is used to create data synchronization. Each ID determines a unique replication rule. When an ID is put for the first time, it is believed to create a replication rule. When the same ID is put for the second time, it is considered as overwriting. If the original status is “Enable”, overwriting as “Disable” is not allowed. The replication is re-executed if the original status is “Enable” and put into “Enable” again. Two replication rules with identical items other than the same ID are not allowed.

Descriptions:

  • The user must be the source bucket owner with the FULL_CONTROL permission and the write permission of the destination bucket.
  • The destination bucket and source bucket must exist.
  • The destination bucket and source bucket can be the buckets in the same region or different regions.
  • The destination bucket and source bucket can be the buckets under the same account or different accounts. But, the source account needs the write permission of the destination bucket.
  • The size of the entire configuration cannot exceed 128 KB, and the length of all rules in the current bucket cannot exceed 200 KB.
  • At present, the data synchronization is impossible for the archive file because the archive file is ignored during the data synchronization.
  • The user can configure up to 10 replication rules.
  • A single rule can possess up to 20 resources.
  • ID consists of numbers, letters, “-” and “_”, and cannot exceed 20 characters.

Request

  • Request syntax

    PUT /?replication&id=sample-bucket HTTP/1.1
    Host: <BucketName>.bj.bcebos.com
    x-bce-date: date
    Content-Length: request-body length
    Content-Type: application/json; charset=utf-8
    Authorization:<AuthorizationString>
    
    {
       "status": "enabled",
       "resource": [
           "src-bucket-name/abc",
           "src-bucket-name/cd*"
       ],
       "destination": {
           "bucket": "dst-bucket-name",
           "storageClass": "COLD"
       },
       "replicateHistory": {
           "storageClass": "COLD"
       },
       "replicateDeletes": "enabled",
       "id": "sample-bucket"
    }
  • Request header field

    No special parameters.

  • Request parameters

    Parameters Required? Description
    id Yes Replication rule name. ID consists of numbers, letters, “-” and “_”, and cannot exceed 20 characters.
    status Yes Effective?
    resource Yes Replication effective prefix. The configuration form of resources is {$bucket_name/}, which must start with $bucket_name+/
    destination Yes Replicated destination configuration
    +bucket Yes Destination bucket name
    +storageClass No Storage type of target object. If the storage type is consistent with that of the source bucket, you do not need to configure this parameter. If it needs to be specified separately, the storage type can be STANDARDSTANDARD_IA or COLD. If it is a multi-AZ bucket, the value can be MAZ_STANDARD_IA or MAZ_STANDARD.
    replicateHistory No Historical file replication. If such item exists, it is considered as “Enabled”. After the historical file replication is enabled, all objects in the inventory are synchronously replicated to the destination bucket, and the resources are shared within the replication range.
    +storageClass No Storage type of target object. If the storage type is consistent with that of the source bucket, this parameter does not need to be configured. If it needs to be specified separately, the storage type can be STANDARDSTANDARD_IA or COLD. If it is a multi-AZ bucket, the value can be MAZ_STANDARD_IA or MAZ_STANDARD.
    replicateDeletes Yes Is the synchronous deletion enabled? It can be enabled or disabled.

Response

  • Response element

    No special parameters.

  • Response Header Field

    No special parameters.

Example

  • Request example

      PUT /?replication&id=sample-bucket HTTP/1.1
      Host: BucketName.bj.bcebos.com
      x-bce-date: date
      Content-Length: xxx
      Content-Type: application/json; charset=utf-8
      Authorization: AuthorizationString
    
        {
            "status": "enabled",
            "resource": [
                "src-bucket-name/abc",
                "src-bucket-name/cd*"
            ],
            "destination": {
                "bucket": "dst-bucket-name",
                "storageClass": "COLD"
            },
            "replicateHistory": {
                "storageClass": "COLD"
            },
            "replicateDeletes": "enabled",
            "id": "sample-bucket-replication-config"
        }
  • Response example

      HTTP/1.1 200 OK
      x-bce-request-id: xxxx-xxxx-xxxx
      Date: Wed, 12 May 2017 17:50:00 GMT
      Content-Length: 0
      Connection: keep-alive
      Server: BceBos
Previous
ListBucketReplication
Next
Event Notification