All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.alicloud.oss.BucketReplication Maven / Gradle / Ivy

There is a newer version: 3.63.0-alpha.1727424957
Show newest version
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.alicloud.oss;

import com.pulumi.alicloud.Utilities;
import com.pulumi.alicloud.oss.BucketReplicationArgs;
import com.pulumi.alicloud.oss.inputs.BucketReplicationState;
import com.pulumi.alicloud.oss.outputs.BucketReplicationDestination;
import com.pulumi.alicloud.oss.outputs.BucketReplicationEncryptionConfiguration;
import com.pulumi.alicloud.oss.outputs.BucketReplicationPrefixSet;
import com.pulumi.alicloud.oss.outputs.BucketReplicationProgress;
import com.pulumi.alicloud.oss.outputs.BucketReplicationSourceSelectionCriteria;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * 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](https://www.alibabacloud.com/help/doc-detail/31864.html) and [What is same-region replication](https://www.alibabacloud.com/help/doc-detail/254865.html).
 * 
 * > **NOTE:** Available since v1.161.0.
 * 
 * ## Example Usage
 * 
 * Set bucket replication configuration
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.random.integer;
 * import com.pulumi.random.IntegerArgs;
 * 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 Integer("default", IntegerArgs.builder()
 *             .max(99999)
 *             .min(10000)
 *             .build());
 * 
 *         var bucketSrc = new Bucket("bucketSrc", BucketArgs.builder()
 *             .bucket(String.format("example-src-%s", default_.result()))
 *             .build());
 * 
 *         var bucketDest = new Bucket("bucketDest", BucketArgs.builder()
 *             .bucket(String.format("example-dest-%s", default_.result()))
 *             .build());
 * 
 *         var role = new Role("role", RoleArgs.builder()
 *             .name(String.format("example-role-%s", default_.result()))
 *             .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(String.format("example-policy-%s", default_.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.policyName())
 *             .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());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## 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). * */ @ResourceType(type="alicloud:oss/bucketReplication:BucketReplication") public class BucketReplication extends com.pulumi.resources.CustomResource { /** * 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`. * */ @Export(name="action", refs={String.class}, tree="[0]") private Output action; /** * @return 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`. * */ public Output> action() { return Codegen.optional(this.action); } /** * The name of the bucket. * */ @Export(name="bucket", refs={String.class}, tree="[0]") private Output bucket; /** * @return The name of the bucket. * */ public Output bucket() { return this.bucket; } /** * Specifies the destination for the rule. See `destination` below. * */ @Export(name="destination", refs={BucketReplicationDestination.class}, tree="[0]") private Output destination; /** * @return Specifies the destination for the rule. See `destination` below. * */ public Output destination() { return this.destination; } /** * Specifies the encryption configuration for the objects replicated to the destination bucket. See `encryption_configuration` below. * */ @Export(name="encryptionConfiguration", refs={BucketReplicationEncryptionConfiguration.class}, tree="[0]") private Output encryptionConfiguration; /** * @return Specifies the encryption configuration for the objects replicated to the destination bucket. See `encryption_configuration` below. * */ public Output> encryptionConfiguration() { return Codegen.optional(this.encryptionConfiguration); } /** * 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`. * */ @Export(name="historicalObjectReplication", refs={String.class}, tree="[0]") private Output historicalObjectReplication; /** * @return 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`. * */ public Output> historicalObjectReplication() { return Codegen.optional(this.historicalObjectReplication); } /** * The prefixes used to specify the object to replicate. Only objects that match the prefix are replicated to the destination bucket. See `prefix_set` below. * */ @Export(name="prefixSet", refs={BucketReplicationPrefixSet.class}, tree="[0]") private Output prefixSet; /** * @return The prefixes used to specify the object to replicate. Only objects that match the prefix are replicated to the destination bucket. See `prefix_set` below. * */ public Output> prefixSet() { return Codegen.optional(this.prefixSet); } /** * Specifies the progress for querying the progress of a data replication task of a bucket. * */ @Export(name="progress", refs={BucketReplicationProgress.class}, tree="[0]") private Output progress; /** * @return Specifies the progress for querying the progress of a data replication task of a bucket. * */ public Output progress() { return this.progress; } /** * The ID of the data replication rule. * */ @Export(name="ruleId", refs={String.class}, tree="[0]") private Output ruleId; /** * @return The ID of the data replication rule. * */ public Output ruleId() { return this.ruleId; } /** * Specifies other conditions used to filter the source objects to replicate. See `source_selection_criteria` below. * */ @Export(name="sourceSelectionCriteria", refs={BucketReplicationSourceSelectionCriteria.class}, tree="[0]") private Output sourceSelectionCriteria; /** * @return Specifies other conditions used to filter the source objects to replicate. See `source_selection_criteria` below. * */ public Output> sourceSelectionCriteria() { return Codegen.optional(this.sourceSelectionCriteria); } /** * The status of the data replication task. Can be starting, doing and closing. * */ @Export(name="status", refs={String.class}, tree="[0]") private Output status; /** * @return The status of the data replication task. Can be starting, doing and closing. * */ public Output status() { return this.status; } /** * 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. * */ @Export(name="syncRole", refs={String.class}, tree="[0]") private Output syncRole; /** * @return 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. * */ public Output> syncRole() { return Codegen.optional(this.syncRole); } /** * * @param name The _unique_ name of the resulting resource. */ public BucketReplication(java.lang.String name) { this(name, BucketReplicationArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public BucketReplication(java.lang.String name, BucketReplicationArgs args) { this(name, args, null); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. * @param options A bag of options that control this resource's behavior. */ public BucketReplication(java.lang.String name, BucketReplicationArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:oss/bucketReplication:BucketReplication", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private BucketReplication(java.lang.String name, Output id, @Nullable BucketReplicationState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:oss/bucketReplication:BucketReplication", name, state, makeResourceOptions(options, id), false); } private static BucketReplicationArgs makeArgs(BucketReplicationArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? BucketReplicationArgs.Empty : args; } private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() .version(Utilities.getVersion()) .build(); return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); } /** * Get an existing Host resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state * @param options Optional settings to control the behavior of the CustomResource. */ public static BucketReplication get(java.lang.String name, Output id, @Nullable BucketReplicationState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new BucketReplication(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy