com.pulumi.alicloud.hbr.OtsBackupPlan Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alicloud Show documentation
Show all versions of alicloud Show documentation
A Pulumi package for creating and managing AliCloud resources.
// *** 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.hbr;
import com.pulumi.alicloud.Utilities;
import com.pulumi.alicloud.hbr.OtsBackupPlanArgs;
import com.pulumi.alicloud.hbr.inputs.OtsBackupPlanState;
import com.pulumi.alicloud.hbr.outputs.OtsBackupPlanOtsDetail;
import com.pulumi.alicloud.hbr.outputs.OtsBackupPlanRule;
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.Boolean;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Provides a HBR Ots Backup Plan resource.
*
* For information about HBR Ots Backup Plan and how to use it, see [What is Ots Backup Plan](https://www.alibabacloud.com/help/en/hybrid-backup-recovery/latest/overview).
*
* > **NOTE:** Available in v1.163.0+.
*
* ## Example Usage
*
* Basic Usage
*
* <!--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.hbr.Vault;
* import com.pulumi.alicloud.hbr.VaultArgs;
* import com.pulumi.alicloud.ots.Instance;
* import com.pulumi.alicloud.ots.InstanceArgs;
* import com.pulumi.alicloud.ots.Table;
* import com.pulumi.alicloud.ots.TableArgs;
* import com.pulumi.alicloud.ots.inputs.TablePrimaryKeyArgs;
* import com.pulumi.alicloud.ram.Role;
* import com.pulumi.alicloud.ram.RoleArgs;
* import com.pulumi.alicloud.AlicloudFunctions;
* import com.pulumi.alicloud.hbr.OtsBackupPlan;
* import com.pulumi.alicloud.hbr.OtsBackupPlanArgs;
* import com.pulumi.alicloud.hbr.inputs.OtsBackupPlanOtsDetailArgs;
* import com.pulumi.alicloud.hbr.inputs.OtsBackupPlanRuleArgs;
* 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 defaultInteger = new Integer("defaultInteger", IntegerArgs.builder()
* .max(99999)
* .min(10000)
* .build());
*
* var defaultVault = new Vault("defaultVault", VaultArgs.builder()
* .vaultName(String.format("terraform-example-%s", defaultInteger.result()))
* .vaultType("OTS_BACKUP")
* .build());
*
* var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
* .name(String.format("Example-%s", defaultInteger.result()))
* .description("terraform-example")
* .accessedBy("Any")
* .tags(Map.ofEntries(
* Map.entry("Created", "TF"),
* Map.entry("For", "example")
* ))
* .build());
*
* var defaultTable = new Table("defaultTable", TableArgs.builder()
* .instanceName(defaultInstance.name())
* .tableName("terraform_example")
* .primaryKeys(TablePrimaryKeyArgs.builder()
* .name("pk1")
* .type("Integer")
* .build())
* .timeToLive(-1)
* .maxVersion(1)
* .deviationCellVersionInSec(1)
* .build());
*
* var defaultRole = new Role("defaultRole", RoleArgs.builder()
* .name("hbrexamplerole")
* .document("""
* {
* "Statement": [
* {
* "Action": "sts:AssumeRole",
* "Effect": "Allow",
* "Principal": {
* "Service": [
* "crossbackup.hbr.aliyuncs.com"
* ]
* }
* }
* ],
* "Version": "1"
* }
* """)
* .force(true)
* .build());
*
* final var default = AlicloudFunctions.getAccount();
*
* var example = new OtsBackupPlan("example", OtsBackupPlanArgs.builder()
* .otsBackupPlanName(String.format("terraform-example-%s", defaultInteger.result()))
* .vaultId(defaultVault.id())
* .backupType("COMPLETE")
* .retention("1")
* .instanceName(defaultInstance.name())
* .crossAccountType("SELF_ACCOUNT")
* .crossAccountUserId(default_.id())
* .crossAccountRoleName(defaultRole.id())
* .otsDetails(OtsBackupPlanOtsDetailArgs.builder()
* .tableNames(defaultTable.tableName())
* .build())
* .rules(OtsBackupPlanRuleArgs.builder()
* .schedule("I|1602673264|PT2H")
* .retention("1")
* .disabled("false")
* .ruleName("terraform-example")
* .backupType("COMPLETE")
* .build())
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* HBR Ots Backup Plan can be imported using the id, e.g.
*
* ```sh
* $ pulumi import alicloud:hbr/otsBackupPlan:OtsBackupPlan example <id>
* ```
*
*/
@ResourceType(type="alicloud:hbr/otsBackupPlan:OtsBackupPlan")
public class OtsBackupPlan extends com.pulumi.resources.CustomResource {
/**
* Backup type. Valid values: `COMPLETE`.
*
*/
@Export(name="backupType", refs={String.class}, tree="[0]")
private Output backupType;
/**
* @return Backup type. Valid values: `COMPLETE`.
*
*/
public Output backupType() {
return this.backupType;
}
/**
* The role name created in the original account RAM backup by the cross account managed by the current account.
*
*/
@Export(name="crossAccountRoleName", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> crossAccountRoleName;
/**
* @return The role name created in the original account RAM backup by the cross account managed by the current account.
*
*/
public Output> crossAccountRoleName() {
return Codegen.optional(this.crossAccountRoleName);
}
/**
* The type of the cross account backup. Valid values: `SELF_ACCOUNT`, `CROSS_ACCOUNT`.
*
*/
@Export(name="crossAccountType", refs={String.class}, tree="[0]")
private Output crossAccountType;
/**
* @return The type of the cross account backup. Valid values: `SELF_ACCOUNT`, `CROSS_ACCOUNT`.
*
*/
public Output crossAccountType() {
return this.crossAccountType;
}
/**
* The original account ID of the cross account backup managed by the current account.
*
*/
@Export(name="crossAccountUserId", refs={Integer.class}, tree="[0]")
private Output* @Nullable */ Integer> crossAccountUserId;
/**
* @return The original account ID of the cross account backup managed by the current account.
*
*/
public Output> crossAccountUserId() {
return Codegen.optional(this.crossAccountUserId);
}
/**
* Whether to disable the backup task. Valid values: `true`, `false`. Default values: `false`.
*
*/
@Export(name="disabled", refs={Boolean.class}, tree="[0]")
private Output disabled;
/**
* @return Whether to disable the backup task. Valid values: `true`, `false`. Default values: `false`.
*
*/
public Output disabled() {
return this.disabled;
}
/**
* The name of the Table store instance. **Note:** Required while source_type equals `OTS_TABLE`.
*
*/
@Export(name="instanceName", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> instanceName;
/**
* @return The name of the Table store instance. **Note:** Required while source_type equals `OTS_TABLE`.
*
*/
public Output> instanceName() {
return Codegen.optional(this.instanceName);
}
/**
* The name of the backup plan. 1~64 characters, the backup plan name of each data source type in a single warehouse required to be unique.
*
*/
@Export(name="otsBackupPlanName", refs={String.class}, tree="[0]")
private Output otsBackupPlanName;
/**
* @return The name of the backup plan. 1~64 characters, the backup plan name of each data source type in a single warehouse required to be unique.
*
*/
public Output otsBackupPlanName() {
return this.otsBackupPlanName;
}
/**
* The details about the Table store instance. See the following `Block ots_detail`. **Note:** Required while source_type equals `OTS_TABLE`.
*
*/
@Export(name="otsDetails", refs={List.class,OtsBackupPlanOtsDetail.class}, tree="[0,1]")
private Output* @Nullable */ List> otsDetails;
/**
* @return The details about the Table store instance. See the following `Block ots_detail`. **Note:** Required while source_type equals `OTS_TABLE`.
*
*/
public Output>> otsDetails() {
return Codegen.optional(this.otsDetails);
}
/**
* Backup retention days, the minimum is 1.
*
*/
@Export(name="retention", refs={String.class}, tree="[0]")
private Output retention;
/**
* @return Backup retention days, the minimum is 1.
*
*/
public Output retention() {
return this.retention;
}
/**
* The backup plan rule. See the following `Block rules`. **Note:** Required while source_type equals `OTS_TABLE`.
*
*/
@Export(name="rules", refs={List.class,OtsBackupPlanRule.class}, tree="[0,1]")
private Output* @Nullable */ List> rules;
/**
* @return The backup plan rule. See the following `Block rules`. **Note:** Required while source_type equals `OTS_TABLE`.
*
*/
public Output>> rules() {
return Codegen.optional(this.rules);
}
/**
* Backup strategy. Optional format: `I|{startTime}|{interval}`. It means to execute a backup task every `{interval}` starting from `{startTime}`. The backup task for the elapsed time will not be compensated. If the last backup task has not completed yet, the next backup task will not be triggered.
* - `startTime` Backup start time, UNIX time seconds.
*
* @deprecated
* Field 'schedule' has been deprecated from version 1.163.0. Use 'rules' instead.
*
*/
@Deprecated /* Field 'schedule' has been deprecated from version 1.163.0. Use 'rules' instead. */
@Export(name="schedule", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> schedule;
/**
* @return Backup strategy. Optional format: `I|{startTime}|{interval}`. It means to execute a backup task every `{interval}` starting from `{startTime}`. The backup task for the elapsed time will not be compensated. If the last backup task has not completed yet, the next backup task will not be triggered.
* - `startTime` Backup start time, UNIX time seconds.
*
*/
public Output> schedule() {
return Codegen.optional(this.schedule);
}
/**
* The ID of backup vault.
*
*/
@Export(name="vaultId", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> vaultId;
/**
* @return The ID of backup vault.
*
*/
public Output> vaultId() {
return Codegen.optional(this.vaultId);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public OtsBackupPlan(java.lang.String name) {
this(name, OtsBackupPlanArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public OtsBackupPlan(java.lang.String name, OtsBackupPlanArgs 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 OtsBackupPlan(java.lang.String name, OtsBackupPlanArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:hbr/otsBackupPlan:OtsBackupPlan", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private OtsBackupPlan(java.lang.String name, Output id, @Nullable OtsBackupPlanState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:hbr/otsBackupPlan:OtsBackupPlan", name, state, makeResourceOptions(options, id), false);
}
private static OtsBackupPlanArgs makeArgs(OtsBackupPlanArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? OtsBackupPlanArgs.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 OtsBackupPlan get(java.lang.String name, Output id, @Nullable OtsBackupPlanState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new OtsBackupPlan(name, id, state, options);
}
}