1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. ebs
  5. EnterpriseSnapshotPolicyAttachment
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.ebs.EnterpriseSnapshotPolicyAttachment

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    Provides a EBS Enterprise Snapshot Policy Attachment resource. Enterprise-level snapshot policy cloud disk binding relationship.

    For information about EBS Enterprise Snapshot Policy Attachment and how to use it, see What is Enterprise Snapshot Policy Attachment.

    NOTE: Available since v1.215.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") || "terraform-example";
    const defaultJkW46o = new alicloud.ecs.EcsDisk("defaultJkW46o", {
        category: "cloud_essd",
        description: "esp-attachment-test",
        zoneId: "cn-hangzhou-i",
        performanceLevel: "PL1",
        size: 20,
        diskName: name,
    });
    const defaultPE3jjR = new alicloud.ebs.EnterpriseSnapshotPolicy("defaultPE3jjR", {
        status: "DISABLED",
        desc: "DESC",
        schedule: {
            cronExpression: "0 0 0 1 * ?",
        },
        enterpriseSnapshotPolicyName: name,
        targetType: "DISK",
        retainRule: {
            timeInterval: 120,
            timeUnit: "DAYS",
        },
    });
    const _default = new alicloud.ebs.EnterpriseSnapshotPolicyAttachment("default", {
        policyId: defaultPE3jjR.id,
        diskId: defaultJkW46o.id,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default_jk_w46o = alicloud.ecs.EcsDisk("defaultJkW46o",
        category="cloud_essd",
        description="esp-attachment-test",
        zone_id="cn-hangzhou-i",
        performance_level="PL1",
        size=20,
        disk_name=name)
    default_pe3jj_r = alicloud.ebs.EnterpriseSnapshotPolicy("defaultPE3jjR",
        status="DISABLED",
        desc="DESC",
        schedule={
            "cron_expression": "0 0 0 1 * ?",
        },
        enterprise_snapshot_policy_name=name,
        target_type="DISK",
        retain_rule={
            "time_interval": 120,
            "time_unit": "DAYS",
        })
    default = alicloud.ebs.EnterpriseSnapshotPolicyAttachment("default",
        policy_id=default_pe3jj_r.id,
        disk_id=default_jk_w46o.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ebs"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"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 := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		defaultJkW46o, err := ecs.NewEcsDisk(ctx, "defaultJkW46o", &ecs.EcsDiskArgs{
    			Category:         pulumi.String("cloud_essd"),
    			Description:      pulumi.String("esp-attachment-test"),
    			ZoneId:           pulumi.String("cn-hangzhou-i"),
    			PerformanceLevel: pulumi.String("PL1"),
    			Size:             pulumi.Int(20),
    			DiskName:         pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		defaultPE3jjR, err := ebs.NewEnterpriseSnapshotPolicy(ctx, "defaultPE3jjR", &ebs.EnterpriseSnapshotPolicyArgs{
    			Status: pulumi.String("DISABLED"),
    			Desc:   pulumi.String("DESC"),
    			Schedule: &ebs.EnterpriseSnapshotPolicyScheduleArgs{
    				CronExpression: pulumi.String("0 0 0 1 * ?"),
    			},
    			EnterpriseSnapshotPolicyName: pulumi.String(name),
    			TargetType:                   pulumi.String("DISK"),
    			RetainRule: &ebs.EnterpriseSnapshotPolicyRetainRuleArgs{
    				TimeInterval: pulumi.Int(120),
    				TimeUnit:     pulumi.String("DAYS"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ebs.NewEnterpriseSnapshotPolicyAttachment(ctx, "default", &ebs.EnterpriseSnapshotPolicyAttachmentArgs{
    			PolicyId: defaultPE3jjR.ID(),
    			DiskId:   defaultJkW46o.ID(),
    		})
    		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") ?? "terraform-example";
        var defaultJkW46o = new AliCloud.Ecs.EcsDisk("defaultJkW46o", new()
        {
            Category = "cloud_essd",
            Description = "esp-attachment-test",
            ZoneId = "cn-hangzhou-i",
            PerformanceLevel = "PL1",
            Size = 20,
            DiskName = name,
        });
    
        var defaultPE3jjR = new AliCloud.Ebs.EnterpriseSnapshotPolicy("defaultPE3jjR", new()
        {
            Status = "DISABLED",
            Desc = "DESC",
            Schedule = new AliCloud.Ebs.Inputs.EnterpriseSnapshotPolicyScheduleArgs
            {
                CronExpression = "0 0 0 1 * ?",
            },
            EnterpriseSnapshotPolicyName = name,
            TargetType = "DISK",
            RetainRule = new AliCloud.Ebs.Inputs.EnterpriseSnapshotPolicyRetainRuleArgs
            {
                TimeInterval = 120,
                TimeUnit = "DAYS",
            },
        });
    
        var @default = new AliCloud.Ebs.EnterpriseSnapshotPolicyAttachment("default", new()
        {
            PolicyId = defaultPE3jjR.Id,
            DiskId = defaultJkW46o.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.EcsDisk;
    import com.pulumi.alicloud.ecs.EcsDiskArgs;
    import com.pulumi.alicloud.ebs.EnterpriseSnapshotPolicy;
    import com.pulumi.alicloud.ebs.EnterpriseSnapshotPolicyArgs;
    import com.pulumi.alicloud.ebs.inputs.EnterpriseSnapshotPolicyScheduleArgs;
    import com.pulumi.alicloud.ebs.inputs.EnterpriseSnapshotPolicyRetainRuleArgs;
    import com.pulumi.alicloud.ebs.EnterpriseSnapshotPolicyAttachment;
    import com.pulumi.alicloud.ebs.EnterpriseSnapshotPolicyAttachmentArgs;
    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("terraform-example");
            var defaultJkW46o = new EcsDisk("defaultJkW46o", EcsDiskArgs.builder()
                .category("cloud_essd")
                .description("esp-attachment-test")
                .zoneId("cn-hangzhou-i")
                .performanceLevel("PL1")
                .size("20")
                .diskName(name)
                .build());
    
            var defaultPE3jjR = new EnterpriseSnapshotPolicy("defaultPE3jjR", EnterpriseSnapshotPolicyArgs.builder()
                .status("DISABLED")
                .desc("DESC")
                .schedule(EnterpriseSnapshotPolicyScheduleArgs.builder()
                    .cronExpression("0 0 0 1 * ?")
                    .build())
                .enterpriseSnapshotPolicyName(name)
                .targetType("DISK")
                .retainRule(EnterpriseSnapshotPolicyRetainRuleArgs.builder()
                    .timeInterval("120")
                    .timeUnit("DAYS")
                    .build())
                .build());
    
            var default_ = new EnterpriseSnapshotPolicyAttachment("default", EnterpriseSnapshotPolicyAttachmentArgs.builder()
                .policyId(defaultPE3jjR.id())
                .diskId(defaultJkW46o.id())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      defaultJkW46o:
        type: alicloud:ecs:EcsDisk
        properties:
          category: cloud_essd
          description: esp-attachment-test
          zoneId: cn-hangzhou-i
          performanceLevel: PL1
          size: '20'
          diskName: ${name}
      defaultPE3jjR:
        type: alicloud:ebs:EnterpriseSnapshotPolicy
        properties:
          status: DISABLED
          desc: DESC
          schedule:
            cronExpression: 0 0 0 1 * ?
          enterpriseSnapshotPolicyName: ${name}
          targetType: DISK
          retainRule:
            timeInterval: '120'
            timeUnit: DAYS
      default:
        type: alicloud:ebs:EnterpriseSnapshotPolicyAttachment
        properties:
          policyId: ${defaultPE3jjR.id}
          diskId: ${defaultJkW46o.id}
    

    Create EnterpriseSnapshotPolicyAttachment Resource

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

    Constructor syntax

    new EnterpriseSnapshotPolicyAttachment(name: string, args: EnterpriseSnapshotPolicyAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def EnterpriseSnapshotPolicyAttachment(resource_name: str,
                                           args: EnterpriseSnapshotPolicyAttachmentArgs,
                                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def EnterpriseSnapshotPolicyAttachment(resource_name: str,
                                           opts: Optional[ResourceOptions] = None,
                                           policy_id: Optional[str] = None,
                                           disk_id: Optional[str] = None)
    func NewEnterpriseSnapshotPolicyAttachment(ctx *Context, name string, args EnterpriseSnapshotPolicyAttachmentArgs, opts ...ResourceOption) (*EnterpriseSnapshotPolicyAttachment, error)
    public EnterpriseSnapshotPolicyAttachment(string name, EnterpriseSnapshotPolicyAttachmentArgs args, CustomResourceOptions? opts = null)
    public EnterpriseSnapshotPolicyAttachment(String name, EnterpriseSnapshotPolicyAttachmentArgs args)
    public EnterpriseSnapshotPolicyAttachment(String name, EnterpriseSnapshotPolicyAttachmentArgs args, CustomResourceOptions options)
    
    type: alicloud:ebs:EnterpriseSnapshotPolicyAttachment
    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 EnterpriseSnapshotPolicyAttachmentArgs
    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 EnterpriseSnapshotPolicyAttachmentArgs
    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 EnterpriseSnapshotPolicyAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EnterpriseSnapshotPolicyAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EnterpriseSnapshotPolicyAttachmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

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

    var enterpriseSnapshotPolicyAttachmentResource = new AliCloud.Ebs.EnterpriseSnapshotPolicyAttachment("enterpriseSnapshotPolicyAttachmentResource", new()
    {
        PolicyId = "string",
        DiskId = "string",
    });
    
    example, err := ebs.NewEnterpriseSnapshotPolicyAttachment(ctx, "enterpriseSnapshotPolicyAttachmentResource", &ebs.EnterpriseSnapshotPolicyAttachmentArgs{
    	PolicyId: pulumi.String("string"),
    	DiskId:   pulumi.String("string"),
    })
    
    var enterpriseSnapshotPolicyAttachmentResource = new EnterpriseSnapshotPolicyAttachment("enterpriseSnapshotPolicyAttachmentResource", EnterpriseSnapshotPolicyAttachmentArgs.builder()
        .policyId("string")
        .diskId("string")
        .build());
    
    enterprise_snapshot_policy_attachment_resource = alicloud.ebs.EnterpriseSnapshotPolicyAttachment("enterpriseSnapshotPolicyAttachmentResource",
        policy_id="string",
        disk_id="string")
    
    const enterpriseSnapshotPolicyAttachmentResource = new alicloud.ebs.EnterpriseSnapshotPolicyAttachment("enterpriseSnapshotPolicyAttachmentResource", {
        policyId: "string",
        diskId: "string",
    });
    
    type: alicloud:ebs:EnterpriseSnapshotPolicyAttachment
    properties:
        diskId: string
        policyId: string
    

    EnterpriseSnapshotPolicyAttachment Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The EnterpriseSnapshotPolicyAttachment resource accepts the following input properties:

    PolicyId string
    the enterprise snapshot policy id.
    DiskId string
    Cloud Disk ID.
    PolicyId string
    the enterprise snapshot policy id.
    DiskId string
    Cloud Disk ID.
    policyId String
    the enterprise snapshot policy id.
    diskId String
    Cloud Disk ID.
    policyId string
    the enterprise snapshot policy id.
    diskId string
    Cloud Disk ID.
    policy_id str
    the enterprise snapshot policy id.
    disk_id str
    Cloud Disk ID.
    policyId String
    the enterprise snapshot policy id.
    diskId String
    Cloud Disk ID.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing EnterpriseSnapshotPolicyAttachment Resource

    Get an existing EnterpriseSnapshotPolicyAttachment 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?: EnterpriseSnapshotPolicyAttachmentState, opts?: CustomResourceOptions): EnterpriseSnapshotPolicyAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            disk_id: Optional[str] = None,
            policy_id: Optional[str] = None) -> EnterpriseSnapshotPolicyAttachment
    func GetEnterpriseSnapshotPolicyAttachment(ctx *Context, name string, id IDInput, state *EnterpriseSnapshotPolicyAttachmentState, opts ...ResourceOption) (*EnterpriseSnapshotPolicyAttachment, error)
    public static EnterpriseSnapshotPolicyAttachment Get(string name, Input<string> id, EnterpriseSnapshotPolicyAttachmentState? state, CustomResourceOptions? opts = null)
    public static EnterpriseSnapshotPolicyAttachment get(String name, Output<String> id, EnterpriseSnapshotPolicyAttachmentState 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
    Cloud Disk ID.
    PolicyId string
    the enterprise snapshot policy id.
    DiskId string
    Cloud Disk ID.
    PolicyId string
    the enterprise snapshot policy id.
    diskId String
    Cloud Disk ID.
    policyId String
    the enterprise snapshot policy id.
    diskId string
    Cloud Disk ID.
    policyId string
    the enterprise snapshot policy id.
    disk_id str
    Cloud Disk ID.
    policy_id str
    the enterprise snapshot policy id.
    diskId String
    Cloud Disk ID.
    policyId String
    the enterprise snapshot policy id.

    Import

    EBS Enterprise Snapshot Policy Attachment can be imported using the id, e.g.

    $ pulumi import alicloud:ebs/enterpriseSnapshotPolicyAttachment:EnterpriseSnapshotPolicyAttachment example <policy_id>:<disk_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.66.0 published on Friday, Nov 15, 2024 by Pulumi