BucketReplicationArgs

data class BucketReplicationArgs(val action: Output<String>? = null, val bucket: Output<String>? = null, val destination: Output<BucketReplicationDestinationArgs>? = null, val encryptionConfiguration: Output<BucketReplicationEncryptionConfigurationArgs>? = null, val historicalObjectReplication: Output<String>? = null, val prefixSet: Output<BucketReplicationPrefixSetArgs>? = null, val progress: Output<BucketReplicationProgressArgs>? = null, val sourceSelectionCriteria: Output<BucketReplicationSourceSelectionCriteriaArgs>? = null, val syncRole: Output<String>? = null) : ConvertibleToJava<BucketReplicationArgs>

Provides an independent replication configuration resource for OSS bucket. For information about OSS replication and how to use it, see What is cross-region replication and What is same-region replication.

NOTE: Available in v1.161.0+.

Example Usage

Set bucket replication configuration

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.RandomInteger;
import com.pulumi.random.RandomIntegerArgs;
import com.pulumi.alicloud.oss.Bucket;
import com.pulumi.alicloud.oss.BucketArgs;
import com.pulumi.alicloud.ram.Role;
import com.pulumi.alicloud.ram.RoleArgs;
import com.pulumi.alicloud.ram.Policy;
import com.pulumi.alicloud.ram.PolicyArgs;
import com.pulumi.alicloud.ram.RolePolicyAttachment;
import com.pulumi.alicloud.ram.RolePolicyAttachmentArgs;
import com.pulumi.alicloud.kms.Key;
import com.pulumi.alicloud.kms.KeyArgs;
import com.pulumi.alicloud.oss.BucketReplication;
import com.pulumi.alicloud.oss.BucketReplicationArgs;
import com.pulumi.alicloud.oss.inputs.BucketReplicationPrefixSetArgs;
import com.pulumi.alicloud.oss.inputs.BucketReplicationDestinationArgs;
import com.pulumi.alicloud.oss.inputs.BucketReplicationEncryptionConfigurationArgs;
import com.pulumi.alicloud.oss.inputs.BucketReplicationSourceSelectionCriteriaArgs;
import com.pulumi.alicloud.oss.inputs.BucketReplicationSourceSelectionCriteriaSseKmsEncryptedObjectsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var default_ = new RandomInteger("default", RandomIntegerArgs.builder()
.max(99999)
.min(10000)
.build());
var bucketSrc = new Bucket("bucketSrc", BucketArgs.builder()
.bucket(default_.result().applyValue(result -> String.format("example-src-%s", result)))
.build());
var bucketDest = new Bucket("bucketDest", BucketArgs.builder()
.bucket(default_.result().applyValue(result -> String.format("example-dest-%s", result)))
.build());
var role = new Role("role", RoleArgs.builder()
.document("""
{
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"oss.aliyuncs.com"
]
}
}
],
"Version": "1"
}
""")
.description("this is a test")
.force(true)
.build());
var policy = new Policy("policy", PolicyArgs.builder()
.policyName(default_.result().applyValue(result -> String.format("example-policy-%s", result)))
.policyDocument("""
{
"Statement": [
{
"Action": [
"*"
],
"Effect": "Allow",
"Resource": [
"*"
]
}
],
"Version": "1"
}
""")
.description("this is a policy test")
.force(true)
.build());
var attach = new RolePolicyAttachment("attach", RolePolicyAttachmentArgs.builder()
.policyName(policy.name())
.policyType(policy.type())
.roleName(role.name())
.build());
var key = new Key("key", KeyArgs.builder()
.description("Hello KMS")
.pendingWindowInDays("7")
.status("Enabled")
.build());
var cross_region_replication = new BucketReplication("cross-region-replication", BucketReplicationArgs.builder()
.bucket(bucketSrc.id())
.action("PUT,DELETE")
.historicalObjectReplication("enabled")
.prefixSet(BucketReplicationPrefixSetArgs.builder()
.prefixes(
"prefix1/",
"prefix2/")
.build())
.destination(BucketReplicationDestinationArgs.builder()
.bucket(bucketDest.id())
.location(bucketDest.location())
.build())
.syncRole(role.name())
.encryptionConfiguration(BucketReplicationEncryptionConfigurationArgs.builder()
.replicaKmsKeyId(key.id())
.build())
.sourceSelectionCriteria(BucketReplicationSourceSelectionCriteriaArgs.builder()
.sseKmsEncryptedObjects(BucketReplicationSourceSelectionCriteriaSseKmsEncryptedObjectsArgs.builder()
.status("Enabled")
.build())
.build())
.build());
}
}

Import

Timeouts The timeouts block allows you to specify timeouts for certain actions* delete - (Defaults to 30 mins) Used when delete a data replication rule (until the data replication task is cleared).

Constructors

Link copied to clipboard
fun BucketReplicationArgs(action: Output<String>? = null, bucket: Output<String>? = null, destination: Output<BucketReplicationDestinationArgs>? = null, encryptionConfiguration: Output<BucketReplicationEncryptionConfigurationArgs>? = null, historicalObjectReplication: Output<String>? = null, prefixSet: Output<BucketReplicationPrefixSetArgs>? = null, progress: Output<BucketReplicationProgressArgs>? = null, sourceSelectionCriteria: Output<BucketReplicationSourceSelectionCriteriaArgs>? = null, syncRole: Output<String>? = null)

Functions

Link copied to clipboard
open override fun toJava(): BucketReplicationArgs

Properties

Link copied to clipboard
val action: Output<String>? = null

The operations that can be synchronized to the destination bucket. You can set action to one or more of the following operation types. Valid values: ALL(contains PUT, DELETE, and ABORT), PUT, DELETE and ABORT. Defaults to ALL.

Link copied to clipboard
val bucket: Output<String>? = null

The name of the bucket.

Link copied to clipboard

Specifies the destination for the rule(See the following block destination).

Link copied to clipboard

Specifies the encryption configuration for the objects replicated to the destination bucket(See the following block encryption_configuration).

Link copied to clipboard
val historicalObjectReplication: Output<String>? = null

Specifies whether to replicate historical data from the source bucket to the destination bucket before data replication is enabled. Can be enabled or disabled. Defaults to enabled.

Link copied to clipboard

The prefixes used to specify the object to replicate. Only objects that match the prefix are replicated to the destination bucket(See the following block prefix_set).

Link copied to clipboard

Retrieves the progress of the data replication task. This status is returned only when the data replication task is in the doing state.

Link copied to clipboard

Specifies other conditions used to filter the source objects to replicate(See the following block source_selection_criteria).

Link copied to clipboard
val syncRole: Output<String>? = null

Specifies the role that you authorize OSS to use to replicate data. If SSE-KMS is specified to encrypt the objects replicated to the destination bucket, it must be specified.