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

com.pulumi.alicloud.databasefilesystem.Snapshot 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.databasefilesystem;

import com.pulumi.alicloud.Utilities;
import com.pulumi.alicloud.databasefilesystem.SnapshotArgs;
import com.pulumi.alicloud.databasefilesystem.inputs.SnapshotState;
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.Optional;
import javax.annotation.Nullable;

/**
 * Provides a DBFS Snapshot resource.
 * 
 * For information about DBFS Snapshot and how to use it.
 * 
 * > **NOTE:** Available since v1.156.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.ecs.EcsFunctions;
 * import com.pulumi.alicloud.ecs.inputs.GetInstanceTypesArgs;
 * import com.pulumi.alicloud.ecs.inputs.GetImagesArgs;
 * import com.pulumi.alicloud.vpc.VpcFunctions;
 * import com.pulumi.alicloud.vpc.inputs.GetNetworksArgs;
 * import com.pulumi.alicloud.vpc.inputs.GetSwitchesArgs;
 * 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.databasefilesystem.Instance;
 * import com.pulumi.alicloud.databasefilesystem.InstanceArgs;
 * import com.pulumi.alicloud.databasefilesystem.InstanceAttachment;
 * import com.pulumi.alicloud.databasefilesystem.InstanceAttachmentArgs;
 * import com.pulumi.alicloud.databasefilesystem.Snapshot;
 * import com.pulumi.alicloud.databasefilesystem.SnapshotArgs;
 * 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 config = ctx.config();
 *         final var name = config.get("name").orElse("tf-example");
 *         final var zoneId = "cn-hangzhou-i";
 * 
 *         final var example = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
 *             .availabilityZone(zoneId)
 *             .instanceTypeFamily("ecs.g7se")
 *             .build());
 * 
 *         final var exampleGetImages = EcsFunctions.getImages(GetImagesArgs.builder()
 *             .instanceType(example.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes())[example.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()).length() - 1].id())
 *             .nameRegex("^aliyun_2_1903_x64_20G_alibase_20240628.vhd")
 *             .owners("system")
 *             .build());
 * 
 *         final var default = VpcFunctions.getNetworks(GetNetworksArgs.builder()
 *             .nameRegex("^default-NODELETING$")
 *             .build());
 * 
 *         final var defaultGetSwitches = VpcFunctions.getSwitches(GetSwitchesArgs.builder()
 *             .vpcId(default_.ids()[0])
 *             .zoneId(zoneId)
 *             .build());
 * 
 *         var exampleSecurityGroup = new SecurityGroup("exampleSecurityGroup", SecurityGroupArgs.builder()
 *             .name(name)
 *             .vpcId(default_.ids()[0])
 *             .build());
 * 
 *         var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
 *             .availabilityZone(zoneId)
 *             .instanceName(name)
 *             .imageId(exampleGetImages.applyValue(getImagesResult -> getImagesResult.images()[0].id()))
 *             .instanceType(example.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes())[example.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()).length() - 1].id())
 *             .securityGroups(exampleSecurityGroup.id())
 *             .vswitchId(defaultGetSwitches.applyValue(getSwitchesResult -> getSwitchesResult.ids()[0]))
 *             .systemDiskCategory("cloud_essd")
 *             .build());
 * 
 *         var defaultInstance2 = new Instance("defaultInstance2", InstanceArgs.builder()
 *             .category("enterprise")
 *             .zoneId(defaultInstance.availabilityZone())
 *             .performanceLevel("PL1")
 *             .fsName(name)
 *             .size(100)
 *             .build());
 * 
 *         var defaultInstanceAttachment = new InstanceAttachment("defaultInstanceAttachment", InstanceAttachmentArgs.builder()
 *             .ecsId(defaultInstance.id())
 *             .instanceId(defaultInstance2.id())
 *             .build());
 * 
 *         var exampleSnapshot = new Snapshot("exampleSnapshot", SnapshotArgs.builder()
 *             .instanceId(defaultInstanceAttachment.instanceId())
 *             .snapshotName(name)
 *             .description(name)
 *             .retentionDays(30)
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * DBFS Snapshot can be imported using the id, e.g. * * ```sh * $ pulumi import alicloud:databasefilesystem/snapshot:Snapshot example <id> * ``` * */ @ResourceType(type="alicloud:databasefilesystem/snapshot:Snapshot") public class Snapshot extends com.pulumi.resources.CustomResource { /** * Description of the snapshot. The description must be `2` to `256` characters in length. It must start with a letter, and cannot start with `http://` or `https://`. * */ @Export(name="description", refs={String.class}, tree="[0]") private Output description; /** * @return Description of the snapshot. The description must be `2` to `256` characters in length. It must start with a letter, and cannot start with `http://` or `https://`. * */ public Output> description() { return Codegen.optional(this.description); } /** * Whether to force deletion of snapshots. * */ @Export(name="force", refs={Boolean.class}, tree="[0]") private Output force; /** * @return Whether to force deletion of snapshots. * */ public Output> force() { return Codegen.optional(this.force); } /** * The ID of the database file system. * */ @Export(name="instanceId", refs={String.class}, tree="[0]") private Output instanceId; /** * @return The ID of the database file system. * */ public Output instanceId() { return this.instanceId; } /** * The retention time of the snapshot. Unit: days. Snapshots are automatically released after the retention time expires. Valid values: `1` to `65536`. * */ @Export(name="retentionDays", refs={Integer.class}, tree="[0]") private Output retentionDays; /** * @return The retention time of the snapshot. Unit: days. Snapshots are automatically released after the retention time expires. Valid values: `1` to `65536`. * */ public Output> retentionDays() { return Codegen.optional(this.retentionDays); } /** * The display name of the snapshot. The length is `2` to `128` characters. It must start with a large or small letter or Chinese, and cannot start with `http://` and `https://`. It can contain numbers, colons (:), underscores (_), or hyphens (-). To prevent name conflicts with automatic snapshots, you cannot start with `auto`. * */ @Export(name="snapshotName", refs={String.class}, tree="[0]") private Output snapshotName; /** * @return The display name of the snapshot. The length is `2` to `128` characters. It must start with a large or small letter or Chinese, and cannot start with `http://` and `https://`. It can contain numbers, colons (:), underscores (_), or hyphens (-). To prevent name conflicts with automatic snapshots, you cannot start with `auto`. * */ public Output> snapshotName() { return Codegen.optional(this.snapshotName); } /** * The status of the Snapshot. * */ @Export(name="status", refs={String.class}, tree="[0]") private Output status; /** * @return The status of the Snapshot. * */ public Output status() { return this.status; } /** * * @param name The _unique_ name of the resulting resource. */ public Snapshot(java.lang.String name) { this(name, SnapshotArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public Snapshot(java.lang.String name, SnapshotArgs 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 Snapshot(java.lang.String name, SnapshotArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:databasefilesystem/snapshot:Snapshot", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private Snapshot(java.lang.String name, Output id, @Nullable SnapshotState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:databasefilesystem/snapshot:Snapshot", name, state, makeResourceOptions(options, id), false); } private static SnapshotArgs makeArgs(SnapshotArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? SnapshotArgs.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 Snapshot get(java.lang.String name, Output id, @Nullable SnapshotState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new Snapshot(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy