1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. simpleapplicationserver
  5. Snapshot
Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi

alicloud.simpleapplicationserver.Snapshot

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi

    Provides a Simple Application Server Snapshot resource.

    For information about Simple Application Server Snapshot and how to use it, see What is Snapshot.

    NOTE: Available since v1.143.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf_example";
    const default = alicloud.simpleapplicationserver.getImages({});
    const defaultGetServerPlans = alicloud.simpleapplicationserver.getServerPlans({});
    const defaultInstance = new alicloud.simpleapplicationserver.Instance("default", {
        paymentType: "Subscription",
        planId: defaultGetServerPlans.then(defaultGetServerPlans => defaultGetServerPlans.plans?.[0]?.id),
        instanceName: name,
        imageId: _default.then(_default => _default.images?.[0]?.id),
        period: 1,
        dataDiskSize: 100,
    });
    const defaultGetServerDisks = alicloud.simpleapplicationserver.getServerDisksOutput({
        instanceId: defaultInstance.id,
    });
    const defaultSnapshot = new alicloud.simpleapplicationserver.Snapshot("default", {
        diskId: defaultGetServerDisks.apply(defaultGetServerDisks => defaultGetServerDisks.ids?.[0]),
        snapshotName: name,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf_example"
    default = alicloud.simpleapplicationserver.get_images()
    default_get_server_plans = alicloud.simpleapplicationserver.get_server_plans()
    default_instance = alicloud.simpleapplicationserver.Instance("default",
        payment_type="Subscription",
        plan_id=default_get_server_plans.plans[0].id,
        instance_name=name,
        image_id=default.images[0].id,
        period=1,
        data_disk_size=100)
    default_get_server_disks = alicloud.simpleapplicationserver.get_server_disks_output(instance_id=default_instance.id)
    default_snapshot = alicloud.simpleapplicationserver.Snapshot("default",
        disk_id=default_get_server_disks.ids[0],
        snapshot_name=name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/simpleapplicationserver"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "tf_example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := simpleapplicationserver.GetImages(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		defaultGetServerPlans, err := simpleapplicationserver.GetServerPlans(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		defaultInstance, err := simpleapplicationserver.NewInstance(ctx, "default", &simpleapplicationserver.InstanceArgs{
    			PaymentType:  pulumi.String("Subscription"),
    			PlanId:       pulumi.String(defaultGetServerPlans.Plans[0].Id),
    			InstanceName: pulumi.String(name),
    			ImageId:      pulumi.String(_default.Images[0].Id),
    			Period:       pulumi.Int(1),
    			DataDiskSize: pulumi.Int(100),
    		})
    		if err != nil {
    			return err
    		}
    		defaultGetServerDisks := simpleapplicationserver.GetServerDisksOutput(ctx, simpleapplicationserver.GetServerDisksOutputArgs{
    			InstanceId: defaultInstance.ID(),
    		}, nil)
    		_, err = simpleapplicationserver.NewSnapshot(ctx, "default", &simpleapplicationserver.SnapshotArgs{
    			DiskId: defaultGetServerDisks.ApplyT(func(defaultGetServerDisks simpleapplicationserver.GetServerDisksResult) (*string, error) {
    				return &defaultGetServerDisks.Ids[0], nil
    			}).(pulumi.StringPtrOutput),
    			SnapshotName: pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf_example";
        var @default = AliCloud.SimpleApplicationServer.GetImages.Invoke();
    
        var defaultGetServerPlans = AliCloud.SimpleApplicationServer.GetServerPlans.Invoke();
    
        var defaultInstance = new AliCloud.SimpleApplicationServer.Instance("default", new()
        {
            PaymentType = "Subscription",
            PlanId = defaultGetServerPlans.Apply(getServerPlansResult => getServerPlansResult.Plans[0]?.Id),
            InstanceName = name,
            ImageId = @default.Apply(@default => @default.Apply(getImagesResult => getImagesResult.Images[0]?.Id)),
            Period = 1,
            DataDiskSize = 100,
        });
    
        var defaultGetServerDisks = AliCloud.SimpleApplicationServer.GetServerDisks.Invoke(new()
        {
            InstanceId = defaultInstance.Id,
        });
    
        var defaultSnapshot = new AliCloud.SimpleApplicationServer.Snapshot("default", new()
        {
            DiskId = defaultGetServerDisks.Apply(getServerDisksResult => getServerDisksResult.Ids[0]),
            SnapshotName = name,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.simpleapplicationserver.SimpleapplicationserverFunctions;
    import com.pulumi.alicloud.simpleapplicationserver.inputs.GetImagesArgs;
    import com.pulumi.alicloud.simpleapplicationserver.inputs.GetServerPlansArgs;
    import com.pulumi.alicloud.simpleapplicationserver.Instance;
    import com.pulumi.alicloud.simpleapplicationserver.InstanceArgs;
    import com.pulumi.alicloud.simpleapplicationserver.inputs.GetServerDisksArgs;
    import com.pulumi.alicloud.simpleapplicationserver.Snapshot;
    import com.pulumi.alicloud.simpleapplicationserver.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 default = SimpleapplicationserverFunctions.getImages();
    
            final var defaultGetServerPlans = SimpleapplicationserverFunctions.getServerPlans();
    
            var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()        
                .paymentType("Subscription")
                .planId(defaultGetServerPlans.applyValue(getServerPlansResult -> getServerPlansResult.plans()[0].id()))
                .instanceName(name)
                .imageId(default_.images()[0].id())
                .period(1)
                .dataDiskSize(100)
                .build());
    
            final var defaultGetServerDisks = SimpleapplicationserverFunctions.getServerDisks(GetServerDisksArgs.builder()
                .instanceId(defaultInstance.id())
                .build());
    
            var defaultSnapshot = new Snapshot("defaultSnapshot", SnapshotArgs.builder()        
                .diskId(defaultGetServerDisks.applyValue(getServerDisksResult -> getServerDisksResult).applyValue(defaultGetServerDisks -> defaultGetServerDisks.applyValue(getServerDisksResult -> getServerDisksResult.ids()[0])))
                .snapshotName(name)
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf_example
    resources:
      defaultInstance:
        type: alicloud:simpleapplicationserver:Instance
        name: default
        properties:
          paymentType: Subscription
          planId: ${defaultGetServerPlans.plans[0].id}
          instanceName: ${name}
          imageId: ${default.images[0].id}
          period: 1
          dataDiskSize: 100
      defaultSnapshot:
        type: alicloud:simpleapplicationserver:Snapshot
        name: default
        properties:
          diskId: ${defaultGetServerDisks.ids[0]}
          snapshotName: ${name}
    variables:
      default:
        fn::invoke:
          Function: alicloud:simpleapplicationserver:getImages
          Arguments: {}
      defaultGetServerPlans:
        fn::invoke:
          Function: alicloud:simpleapplicationserver:getServerPlans
          Arguments: {}
      defaultGetServerDisks:
        fn::invoke:
          Function: alicloud:simpleapplicationserver:getServerDisks
          Arguments:
            instanceId: ${defaultInstance.id}
    

    Create Snapshot Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Snapshot(name: string, args: SnapshotArgs, opts?: CustomResourceOptions);
    @overload
    def Snapshot(resource_name: str,
                 args: SnapshotArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def Snapshot(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 disk_id: Optional[str] = None,
                 snapshot_name: Optional[str] = None)
    func NewSnapshot(ctx *Context, name string, args SnapshotArgs, opts ...ResourceOption) (*Snapshot, error)
    public Snapshot(string name, SnapshotArgs args, CustomResourceOptions? opts = null)
    public Snapshot(String name, SnapshotArgs args)
    public Snapshot(String name, SnapshotArgs args, CustomResourceOptions options)
    
    type: alicloud:simpleapplicationserver:Snapshot
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args SnapshotArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args SnapshotArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args SnapshotArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SnapshotArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SnapshotArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var examplesnapshotResourceResourceFromSimpleapplicationserversnapshot = new AliCloud.SimpleApplicationServer.Snapshot("examplesnapshotResourceResourceFromSimpleapplicationserversnapshot", new()
    {
        DiskId = "string",
        SnapshotName = "string",
    });
    
    example, err := simpleapplicationserver.NewSnapshot(ctx, "examplesnapshotResourceResourceFromSimpleapplicationserversnapshot", &simpleapplicationserver.SnapshotArgs{
    	DiskId:       pulumi.String("string"),
    	SnapshotName: pulumi.String("string"),
    })
    
    var examplesnapshotResourceResourceFromSimpleapplicationserversnapshot = new Snapshot("examplesnapshotResourceResourceFromSimpleapplicationserversnapshot", SnapshotArgs.builder()        
        .diskId("string")
        .snapshotName("string")
        .build());
    
    examplesnapshot_resource_resource_from_simpleapplicationserversnapshot = alicloud.simpleapplicationserver.Snapshot("examplesnapshotResourceResourceFromSimpleapplicationserversnapshot",
        disk_id="string",
        snapshot_name="string")
    
    const examplesnapshotResourceResourceFromSimpleapplicationserversnapshot = new alicloud.simpleapplicationserver.Snapshot("examplesnapshotResourceResourceFromSimpleapplicationserversnapshot", {
        diskId: "string",
        snapshotName: "string",
    });
    
    type: alicloud:simpleapplicationserver:Snapshot
    properties:
        diskId: string
        snapshotName: string
    

    Snapshot Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Snapshot resource accepts the following input properties:

    DiskId string
    The ID of the disk.
    SnapshotName string
    The name of the snapshot. The name must be 2 to 50 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.),and hyphens (-).
    DiskId string
    The ID of the disk.
    SnapshotName string
    The name of the snapshot. The name must be 2 to 50 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.),and hyphens (-).
    diskId String
    The ID of the disk.
    snapshotName String
    The name of the snapshot. The name must be 2 to 50 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.),and hyphens (-).
    diskId string
    The ID of the disk.
    snapshotName string
    The name of the snapshot. The name must be 2 to 50 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.),and hyphens (-).
    disk_id str
    The ID of the disk.
    snapshot_name str
    The name of the snapshot. The name must be 2 to 50 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.),and hyphens (-).
    diskId String
    The ID of the disk.
    snapshotName String
    The name of the snapshot. The name must be 2 to 50 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.),and hyphens (-).

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Snapshot resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the snapshot. Valid values: Progressing, Accomplished and Failed.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the snapshot. Valid values: Progressing, Accomplished and Failed.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the snapshot. Valid values: Progressing, Accomplished and Failed.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The status of the snapshot. Valid values: Progressing, Accomplished and Failed.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The status of the snapshot. Valid values: Progressing, Accomplished and Failed.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the snapshot. Valid values: Progressing, Accomplished and Failed.

    Look up Existing Snapshot Resource

    Get an existing Snapshot resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: SnapshotState, opts?: CustomResourceOptions): Snapshot
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            disk_id: Optional[str] = None,
            snapshot_name: Optional[str] = None,
            status: Optional[str] = None) -> Snapshot
    func GetSnapshot(ctx *Context, name string, id IDInput, state *SnapshotState, opts ...ResourceOption) (*Snapshot, error)
    public static Snapshot Get(string name, Input<string> id, SnapshotState? state, CustomResourceOptions? opts = null)
    public static Snapshot get(String name, Output<String> id, SnapshotState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    DiskId string
    The ID of the disk.
    SnapshotName string
    The name of the snapshot. The name must be 2 to 50 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.),and hyphens (-).
    Status string
    The status of the snapshot. Valid values: Progressing, Accomplished and Failed.
    DiskId string
    The ID of the disk.
    SnapshotName string
    The name of the snapshot. The name must be 2 to 50 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.),and hyphens (-).
    Status string
    The status of the snapshot. Valid values: Progressing, Accomplished and Failed.
    diskId String
    The ID of the disk.
    snapshotName String
    The name of the snapshot. The name must be 2 to 50 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.),and hyphens (-).
    status String
    The status of the snapshot. Valid values: Progressing, Accomplished and Failed.
    diskId string
    The ID of the disk.
    snapshotName string
    The name of the snapshot. The name must be 2 to 50 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.),and hyphens (-).
    status string
    The status of the snapshot. Valid values: Progressing, Accomplished and Failed.
    disk_id str
    The ID of the disk.
    snapshot_name str
    The name of the snapshot. The name must be 2 to 50 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.),and hyphens (-).
    status str
    The status of the snapshot. Valid values: Progressing, Accomplished and Failed.
    diskId String
    The ID of the disk.
    snapshotName String
    The name of the snapshot. The name must be 2 to 50 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.),and hyphens (-).
    status String
    The status of the snapshot. Valid values: Progressing, Accomplished and Failed.

    Import

    Simple Application Server Snapshot can be imported using the id, e.g.

    $ pulumi import alicloud:simpleapplicationserver/snapshot:Snapshot example <id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi