Aliyun.Oss.Bucket.Replication (aliyun_oss v3.3.0)
Bucket operations - Replication.
Summary
Functions
DeleteBucketReplication - disables data replication for a bucket and delete the data replication rule configured for the bucket.
GetBucketReplication - gets cross-region replication (CRR) rules configured for a bucket.
GetBucketReplicationLocation - gets the region in which the destination bucket can be located.
GetBucketReplicationProgress - gets the progress of a data replication task configured for a bucket.
PutBucketReplication - configures data replication rules for a bucket.
PutBucketRTC
Functions
@spec delete(Aliyun.Oss.Config.t(), String.t(), String.t()) :: {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
DeleteBucketReplication - disables data replication for a bucket and delete the data replication rule configured for the bucket.
Examples
iex> Aliyun.Oss.Bucket.Replication.delete(config, "some-bucket", "rule1")
{:ok,
%Aliyun.Oss.Client.Response{
data: "",
headers: %{
"connection" => ["keep-alive"],
"content-length" => ["0"],
"date" => ["Tue, 08 Jul 2025 06:29:32 GMT"],
"server" => ["AliyunOSS"],
"x-oss-request-id" => ["686CBACC8054033535D2D02B"],
"x-oss-server-time" => ["95"]
}
}}
@spec get(Aliyun.Oss.Config.t(), String.t()) :: {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
GetBucketReplication - gets cross-region replication (CRR) rules configured for a bucket.
Examples
iex> Aliyun.Oss.Bucket.Replication.get(config, "some-bucket")
{:ok, %Aliyun.Oss.Client.Response{
data: %{
"ReplicationConfiguration" => %{
"Rule" => %{
"Action" => "ALL",
"Destination" => %{
"Bucket" => "replication-test",
"Location" => "oss-cn-beijing"
},
"HistoricalObjectReplication" => "disabled",
"ID" => "83925164-b43e-42c8-b755-************",
"Status" => "starting"
}
}
},
headers: %{
"connection" => ["keep-alive"],
...
}
}}
@spec get_location(Aliyun.Oss.Config.t(), String.t()) :: {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
GetBucketReplicationLocation - gets the region in which the destination bucket can be located.
Examples
iex> Aliyun.Oss.Bucket.Replication.get_location(config, "some-bucket")
{:ok, %Aliyun.Oss.Client.Response{
data: %{
"ReplicationLocation" => %{
"Location" => ["oss-ap-northeast-1", "oss-ap-south-1",
"oss-ap-southeast-1", "oss-ap-southeast-2", "oss-ap-southeast-3",
"oss-ap-southeast-5", "oss-cn-beijing", "oss-cn-chengdu",
"oss-cn-guangzhou", "oss-cn-hangzhou", "oss-cn-heyuan",
"oss-cn-hongkong", "oss-cn-huhehaote", "oss-cn-qingdao",
"oss-cn-shanghai", "oss-cn-wulanchabu", "oss-cn-zhangjiakou",
"oss-eu-central-1", "oss-eu-west-1", "oss-me-east-1", "oss-rus-west-1",
"oss-us-east-1", "oss-us-west-1"],
"LocationTransferTypeConstraint" => %{
"LocationTransferType" => [
%{
"Location" => "oss-cn-hongkong",
"TransferTypes" => %{"Type" => "oss_acc"}
},
# ...
]
}
}
},
headers: %{
"connection" => ["keep-alive"],
...
}
}}
@spec get_progress(Aliyun.Oss.Config.t(), String.t(), String.t()) :: {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
GetBucketReplicationProgress - gets the progress of a data replication task configured for a bucket.
Examples
iex> Aliyun.Oss.Bucket.Replication.get_progress(config, "some-bucket", "replication_rule_id_1")
{:ok, %Aliyun.Oss.Client.Response{
data: %{
"ReplicationProgress" => %{
"Rule" => %{
"Action" => "ALL",
"Destination" => %{
"Bucket" => "replication-test",
"Location" => "oss-cn-beijing"
},
"HistoricalObjectReplication" => "disabled",
"ID" => "83925164-b43e-42c8-b755-************",
"Progress" => %{"NewObject" => "2021-01-19T05:53:07.000Z"},
"Status" => "doing"
}
}
},
headers: %{
"connection" => ["keep-alive"],
...
}
}}
@spec put(Aliyun.Oss.Config.t(), String.t(), String.t()) :: {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
PutBucketReplication - configures data replication rules for a bucket.
Examples
iex> config_xml = ~S[
<?xml version="1.0" encoding="UTF-8"?>
<ReplicationConfiguration>
<Rule>
<Action>ALL</Action>
<Destination>
<Bucket>replication-test</Bucket>
<Location>oss-cn-beijing</Location>
<TransferType>internal</TransferType>
</Destination>
<HistoricalObjectReplication>disabled</HistoricalObjectReplication>
</Rule>
</ReplicationConfiguration>
]
iex> Aliyun.Oss.Bucket.Replication.put(config, "some-bucket", config_xml)
{:ok, %Aliyun.Oss.Client.Response{
data: "",
headers: %{
"connection" => ["keep-alive"],
"content-length" => ["0"],
"date" => ["Tue, 08 Jul 2025 06:21:42 GMT"],
"server" => ["AliyunOSS"],
"x-oss-replication-rule-id" => ["83925164-b43e-42c8-b755-************"],
"x-oss-request-id" => ["686CB8F60E28CD3*********"],
"x-oss-server-time" => ["194"]
}
}}
@spec put_rtc(Aliyun.Oss.Config.t(), String.t(), String.t(), String.t()) :: {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
PutBucketRTC
Examples
iex> Aliyun.Oss.Bucket.Replication.put_rtc(config, "some-bucket", "83925164-b43e-42c8-b755-************", "enabled")
{:ok, %Aliyun.Oss.Client.Response{
data: "",
headers: %{
"connection" => ["keep-alive"],
"content-length" => ["0"],
"date" => ["Tue, 08 Jul 2025 06:21:42 GMT"],
"server" => ["AliyunOSS"],
"x-oss-request-id" => ["686CB8F60E28CD3*********"],
"x-oss-server-time" => ["194"]
}
}}