Baidu AI Cloud
中国站

百度智能云

Object Storage

Set Bucket Data Synchronization

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 overwriting. If the original status is “Enable”, overwriting as “Disable” is not allowed. If the original status is “Enable” and it is put into “Enable” again, the replication is re-executed. 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 or different regions.
  • The destination bucket and source bucket can be the buckets under the same 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 cannot be carried out for the archive file, and 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.
  • The ID consists of numbers, letters, “-”, and “_”, and cannot exceed 20 characters.

Request URI

PUT /v1/{bucketName}/?replication

Parameter Name Parameter Type Required Description Example Value Parameter Position
bucketName String Yes Bucket name "bucketName_example" Path
id String Yes Replication rule name. The ID consists of numbers, letters, “-” and “_”, and cannot exceed 20 characters. "id_example" Query

Request Body Parameters

Instructions for Data Structure of Request Body Field

Parameter Name Parameter Type Required Description Example Value
status String Yes Effective? enabled
resource List Yes Replication effective prefix. The configuration form of resources is {$bucket_name/}, which must / start with $bucket_name+/.
destination Destination Yes Replicated destination configuration
replicateHistory ReplicateHistory No Historical file replication. If such an item exists, it is considered as “Enabled”. After the historical file replication is enabled, all objects in inventory are synchronously replicated to the destination bucket, and the resources are shared within the replication range.
replicateDeletes String Yes Whether or not to enable the synchronous deletion? It can be “Enabled” or “Disabled”. enabled
id String Yes Replication rule name. ID consists of numbers, letters, “-” and “_”, and cannot exceed 20 characters. sample-bucket

Introductions for Data Structure of Destination Field

Parameter Name Parameter type Required Description Example value
bucket String Yes Destination bucket name dst-bucket-name
storageClass String No Storage type of the destination object. If the storage type is consistent with the source bucket, this parameter does not need to be configured. If it needs to be specified separately, the storage type can be STANDARD,STANDARD_IA,or COLD. If it is a multi-AZ bucket, the value can be MAZ_STANDARD_IA and MAZ_STANDARD. COLD

Introductions for Data Structure of ReplicateHistory Field

Parameter Name Parameter Type Required Description Example Value
storageClass String No Storage type of the destination object. If the storage type is consistent with the source bucket, this parameter does not need to be configured. If it needs to be specified separately, the storage type can be STANDARD, STANDARD_IA, and COLD. If it is a multi-AZ bucket, the value can be MAZ_STANDARD_IA and MAZ_STANDARD. COLD

Response Body Parameters

Instructions for Data Structure of Response Body Field

Request Example

PUT /v1/bucketName_example/?replication&id=id_example
Common Request Header


{
  "resource" : [ "src-bucket-name/abc" ],
  "destination" : {
    "bucket" : "dst-bucket-name",
    "storageClass" : "COLD"
  },
  "id" : "sample-bucket",
  "replicateHistory" : {
    "storageClass" : "COLD"
  },
  "replicateDeletes" : "enabled",
  "status" : "enabled"
}

Response Example

HTTP/1.1 200 OK
<Common response header>

{ }

Error Code

Refer to the universal error code.

Previous
Overview
Next
Enumerate All Replication Synchronization Rules of Bucket