com.pulumi.alicloud.hbr.ServerBackupPlan 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.ServerBackupPlanArgs;
import com.pulumi.alicloud.hbr.inputs.ServerBackupPlanState;
import com.pulumi.alicloud.hbr.outputs.ServerBackupPlanDetail;
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 Hybrid Backup Recovery (HBR) Server Backup Plan resource.
*
* For information about Hybrid Backup Recovery (HBR) Server Backup Plan and how to use it, see [What is Server Backup Plan](https://www.alibabacloud.com/help/doc-detail/211140.htm).
*
* > **NOTE:** Available in v1.142.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.alicloud.AlicloudFunctions;
* import com.pulumi.alicloud.inputs.GetZonesArgs;
* import com.pulumi.alicloud.ecs.EcsFunctions;
* import com.pulumi.alicloud.ecs.inputs.GetInstanceTypesArgs;
* import com.pulumi.alicloud.ecs.inputs.GetImagesArgs;
* import com.pulumi.alicloud.vpc.Network;
* import com.pulumi.alicloud.vpc.NetworkArgs;
* import com.pulumi.alicloud.vpc.Switch;
* import com.pulumi.alicloud.vpc.SwitchArgs;
* import com.pulumi.alicloud.ecs.SecurityGroup;
* import com.pulumi.alicloud.ecs.SecurityGroupArgs;
* import com.pulumi.alicloud.ecs.Instance;
* import com.pulumi.alicloud.ecs.InstanceArgs;
* import com.pulumi.alicloud.hbr.ServerBackupPlan;
* import com.pulumi.alicloud.hbr.ServerBackupPlanArgs;
* import com.pulumi.alicloud.hbr.inputs.ServerBackupPlanDetailArgs;
* 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) {
* final var example = AlicloudFunctions.getZones(GetZonesArgs.builder()
* .availableResourceCreation("Instance")
* .build());
*
* final var exampleGetInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
* .availabilityZone(example.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
* .cpuCoreCount(1)
* .memorySize(2)
* .build());
*
* final var exampleGetImages = EcsFunctions.getImages(GetImagesArgs.builder()
* .nameRegex("^ubuntu_18.*64")
* .owners("system")
* .build());
*
* var exampleNetwork = new Network("exampleNetwork", NetworkArgs.builder()
* .vpcName("terraform-example")
* .cidrBlock("172.17.3.0/24")
* .build());
*
* var exampleSwitch = new Switch("exampleSwitch", SwitchArgs.builder()
* .vswitchName("terraform-example")
* .cidrBlock("172.17.3.0/24")
* .vpcId(exampleNetwork.id())
* .zoneId(example.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
* .build());
*
* var exampleSecurityGroup = new SecurityGroup("exampleSecurityGroup", SecurityGroupArgs.builder()
* .name("terraform-example")
* .vpcId(exampleNetwork.id())
* .build());
*
* var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()
* .imageId(exampleGetImages.applyValue(getImagesResult -> getImagesResult.images()[0].id()))
* .instanceType(exampleGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()[0].id()))
* .availabilityZone(example.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
* .securityGroups(exampleSecurityGroup.id())
* .instanceName("terraform-example")
* .internetChargeType("PayByBandwidth")
* .vswitchId(exampleSwitch.id())
* .build());
*
* var exampleServerBackupPlan = new ServerBackupPlan("exampleServerBackupPlan", ServerBackupPlanArgs.builder()
* .ecsServerBackupPlanName("terraform-example")
* .instanceId(exampleInstance.id())
* .schedule("I|1602673264|PT2H")
* .retention(1)
* .details(ServerBackupPlanDetailArgs.builder()
* .appConsistent(true)
* .snapshotGroup(true)
* .build())
* .disabled(false)
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Hybrid Backup Recovery (HBR) Server Backup Plan can be imported using the id, e.g.
*
* ```sh
* $ pulumi import alicloud:hbr/serverBackupPlan:ServerBackupPlan example <id>
* ```
*
*/
@ResourceType(type="alicloud:hbr/serverBackupPlan:ServerBackupPlan")
public class ServerBackupPlan extends com.pulumi.resources.CustomResource {
/**
* 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 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 crossAccountUserId;
/**
* @return The original account ID of the cross account backup managed by the current account.
*
*/
public Output> crossAccountUserId() {
return Codegen.optional(this.crossAccountUserId);
}
/**
* ECS server backup plan details.
*
*/
@Export(name="details", refs={List.class,ServerBackupPlanDetail.class}, tree="[0,1]")
private Output> details;
/**
* @return ECS server backup plan details.
*
*/
public Output> details() {
return this.details;
}
/**
* Whether to disable the backup task. Valid values: `true`, `false`.
*
*/
@Export(name="disabled", refs={Boolean.class}, tree="[0]")
private Output disabled;
/**
* @return Whether to disable the backup task. Valid values: `true`, `false`.
*
*/
public Output disabled() {
return this.disabled;
}
/**
* 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="ecsServerBackupPlanName", refs={String.class}, tree="[0]")
private Output ecsServerBackupPlanName;
/**
* @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 ecsServerBackupPlanName() {
return this.ecsServerBackupPlanName;
}
/**
* The ID of ECS instance.
*
*/
@Export(name="instanceId", refs={String.class}, tree="[0]")
private Output instanceId;
/**
* @return The ID of ECS instance.
*
*/
public Output instanceId() {
return this.instanceId;
}
/**
* Backup retention days, the minimum is 1.
*
*/
@Export(name="retention", refs={Integer.class}, tree="[0]")
private Output retention;
/**
* @return Backup retention days, the minimum is 1.
*
*/
public Output retention() {
return this.retention;
}
/**
* Backup strategy. Optional format: `I|{startTime}|{interval}`
* * `startTime` Backup start time, UNIX time, in seconds.
*
*/
@Export(name="schedule", refs={String.class}, tree="[0]")
private Output schedule;
/**
* @return Backup strategy. Optional format: `I|{startTime}|{interval}`
* * `startTime` Backup start time, UNIX time, in seconds.
*
*/
public Output schedule() {
return this.schedule;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public ServerBackupPlan(java.lang.String name) {
this(name, ServerBackupPlanArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public ServerBackupPlan(java.lang.String name, ServerBackupPlanArgs 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 ServerBackupPlan(java.lang.String name, ServerBackupPlanArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:hbr/serverBackupPlan:ServerBackupPlan", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private ServerBackupPlan(java.lang.String name, Output id, @Nullable ServerBackupPlanState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:hbr/serverBackupPlan:ServerBackupPlan", name, state, makeResourceOptions(options, id), false);
}
private static ServerBackupPlanArgs makeArgs(ServerBackupPlanArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? ServerBackupPlanArgs.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 ServerBackupPlan get(java.lang.String name, Output id, @Nullable ServerBackupPlanState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new ServerBackupPlan(name, id, state, options);
}
}