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

alicloud.ecs.getEcsSnapshotGroups

Explore with Pulumi AI

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

    This data source provides the Ecs Snapshot Groups of the current Alibaba Cloud user.

    NOTE: Available in v1.160.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const ids = alicloud.ecs.getEcsSnapshotGroups({
        ids: ["example-id"],
    });
    export const ecsSnapshotGroupId1 = ids.then(ids => ids.groups?.[0]?.id);
    const nameRegex = alicloud.ecs.getEcsSnapshotGroups({
        nameRegex: "^my-SnapshotGroup",
    });
    export const ecsSnapshotGroupId2 = nameRegex.then(nameRegex => nameRegex.groups?.[0]?.id);
    const status = alicloud.ecs.getEcsSnapshotGroups({
        status: "accomplished",
    });
    export const ecsSnapshotGroupId3 = status.then(status => status.groups?.[0]?.id);
    const instanceId = alicloud.ecs.getEcsSnapshotGroups({
        instanceId: "example-instance_id",
    });
    export const ecsSnapshotGroupId4 = instanceId.then(instanceId => instanceId.groups?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    ids = alicloud.ecs.get_ecs_snapshot_groups(ids=["example-id"])
    pulumi.export("ecsSnapshotGroupId1", ids.groups[0].id)
    name_regex = alicloud.ecs.get_ecs_snapshot_groups(name_regex="^my-SnapshotGroup")
    pulumi.export("ecsSnapshotGroupId2", name_regex.groups[0].id)
    status = alicloud.ecs.get_ecs_snapshot_groups(status="accomplished")
    pulumi.export("ecsSnapshotGroupId3", status.groups[0].id)
    instance_id = alicloud.ecs.get_ecs_snapshot_groups(instance_id="example-instance_id")
    pulumi.export("ecsSnapshotGroupId4", instance_id.groups[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		ids, err := ecs.GetEcsSnapshotGroups(ctx, &ecs.GetEcsSnapshotGroupsArgs{
    			Ids: []string{
    				"example-id",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("ecsSnapshotGroupId1", ids.Groups[0].Id)
    		nameRegex, err := ecs.GetEcsSnapshotGroups(ctx, &ecs.GetEcsSnapshotGroupsArgs{
    			NameRegex: pulumi.StringRef("^my-SnapshotGroup"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("ecsSnapshotGroupId2", nameRegex.Groups[0].Id)
    		status, err := ecs.GetEcsSnapshotGroups(ctx, &ecs.GetEcsSnapshotGroupsArgs{
    			Status: pulumi.StringRef("accomplished"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("ecsSnapshotGroupId3", status.Groups[0].Id)
    		instanceId, err := ecs.GetEcsSnapshotGroups(ctx, &ecs.GetEcsSnapshotGroupsArgs{
    			InstanceId: pulumi.StringRef("example-instance_id"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("ecsSnapshotGroupId4", instanceId.Groups[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var ids = AliCloud.Ecs.GetEcsSnapshotGroups.Invoke(new()
        {
            Ids = new[]
            {
                "example-id",
            },
        });
    
        var nameRegex = AliCloud.Ecs.GetEcsSnapshotGroups.Invoke(new()
        {
            NameRegex = "^my-SnapshotGroup",
        });
    
        var status = AliCloud.Ecs.GetEcsSnapshotGroups.Invoke(new()
        {
            Status = "accomplished",
        });
    
        var instanceId = AliCloud.Ecs.GetEcsSnapshotGroups.Invoke(new()
        {
            InstanceId = "example-instance_id",
        });
    
        return new Dictionary<string, object?>
        {
            ["ecsSnapshotGroupId1"] = ids.Apply(getEcsSnapshotGroupsResult => getEcsSnapshotGroupsResult.Groups[0]?.Id),
            ["ecsSnapshotGroupId2"] = nameRegex.Apply(getEcsSnapshotGroupsResult => getEcsSnapshotGroupsResult.Groups[0]?.Id),
            ["ecsSnapshotGroupId3"] = status.Apply(getEcsSnapshotGroupsResult => getEcsSnapshotGroupsResult.Groups[0]?.Id),
            ["ecsSnapshotGroupId4"] = instanceId.Apply(getEcsSnapshotGroupsResult => getEcsSnapshotGroupsResult.Groups[0]?.Id),
        };
    });
    
    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.GetEcsSnapshotGroupsArgs;
    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 ids = EcsFunctions.getEcsSnapshotGroups(GetEcsSnapshotGroupsArgs.builder()
                .ids("example-id")
                .build());
    
            ctx.export("ecsSnapshotGroupId1", ids.applyValue(getEcsSnapshotGroupsResult -> getEcsSnapshotGroupsResult.groups()[0].id()));
            final var nameRegex = EcsFunctions.getEcsSnapshotGroups(GetEcsSnapshotGroupsArgs.builder()
                .nameRegex("^my-SnapshotGroup")
                .build());
    
            ctx.export("ecsSnapshotGroupId2", nameRegex.applyValue(getEcsSnapshotGroupsResult -> getEcsSnapshotGroupsResult.groups()[0].id()));
            final var status = EcsFunctions.getEcsSnapshotGroups(GetEcsSnapshotGroupsArgs.builder()
                .status("accomplished")
                .build());
    
            ctx.export("ecsSnapshotGroupId3", status.applyValue(getEcsSnapshotGroupsResult -> getEcsSnapshotGroupsResult.groups()[0].id()));
            final var instanceId = EcsFunctions.getEcsSnapshotGroups(GetEcsSnapshotGroupsArgs.builder()
                .instanceId("example-instance_id")
                .build());
    
            ctx.export("ecsSnapshotGroupId4", instanceId.applyValue(getEcsSnapshotGroupsResult -> getEcsSnapshotGroupsResult.groups()[0].id()));
        }
    }
    
    variables:
      ids:
        fn::invoke:
          Function: alicloud:ecs:getEcsSnapshotGroups
          Arguments:
            ids:
              - example-id
      nameRegex:
        fn::invoke:
          Function: alicloud:ecs:getEcsSnapshotGroups
          Arguments:
            nameRegex: ^my-SnapshotGroup
      status:
        fn::invoke:
          Function: alicloud:ecs:getEcsSnapshotGroups
          Arguments:
            status: accomplished
      instanceId:
        fn::invoke:
          Function: alicloud:ecs:getEcsSnapshotGroups
          Arguments:
            instanceId: example-instance_id
    outputs:
      ecsSnapshotGroupId1: ${ids.groups[0].id}
      ecsSnapshotGroupId2: ${nameRegex.groups[0].id}
      ecsSnapshotGroupId3: ${status.groups[0].id}
      ecsSnapshotGroupId4: ${instanceId.groups[0].id}
    

    Using getEcsSnapshotGroups

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getEcsSnapshotGroups(args: GetEcsSnapshotGroupsArgs, opts?: InvokeOptions): Promise<GetEcsSnapshotGroupsResult>
    function getEcsSnapshotGroupsOutput(args: GetEcsSnapshotGroupsOutputArgs, opts?: InvokeOptions): Output<GetEcsSnapshotGroupsResult>
    def get_ecs_snapshot_groups(ids: Optional[Sequence[str]] = None,
                                instance_id: Optional[str] = None,
                                name_regex: Optional[str] = None,
                                output_file: Optional[str] = None,
                                snapshot_group_name: Optional[str] = None,
                                status: Optional[str] = None,
                                tags: Optional[Mapping[str, str]] = None,
                                opts: Optional[InvokeOptions] = None) -> GetEcsSnapshotGroupsResult
    def get_ecs_snapshot_groups_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                                instance_id: Optional[pulumi.Input[str]] = None,
                                name_regex: Optional[pulumi.Input[str]] = None,
                                output_file: Optional[pulumi.Input[str]] = None,
                                snapshot_group_name: Optional[pulumi.Input[str]] = None,
                                status: Optional[pulumi.Input[str]] = None,
                                tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetEcsSnapshotGroupsResult]
    func GetEcsSnapshotGroups(ctx *Context, args *GetEcsSnapshotGroupsArgs, opts ...InvokeOption) (*GetEcsSnapshotGroupsResult, error)
    func GetEcsSnapshotGroupsOutput(ctx *Context, args *GetEcsSnapshotGroupsOutputArgs, opts ...InvokeOption) GetEcsSnapshotGroupsResultOutput

    > Note: This function is named GetEcsSnapshotGroups in the Go SDK.

    public static class GetEcsSnapshotGroups 
    {
        public static Task<GetEcsSnapshotGroupsResult> InvokeAsync(GetEcsSnapshotGroupsArgs args, InvokeOptions? opts = null)
        public static Output<GetEcsSnapshotGroupsResult> Invoke(GetEcsSnapshotGroupsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetEcsSnapshotGroupsResult> getEcsSnapshotGroups(GetEcsSnapshotGroupsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:ecs/getEcsSnapshotGroups:getEcsSnapshotGroups
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Ids List<string>
    A list of Snapshot Group IDs.
    InstanceId string
    The ID of the instance.
    NameRegex string
    A regex string to filter results by Snapshot Group name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    SnapshotGroupName string
    The name of the snapshot-consistent group.
    Status string
    The state of snapshot-consistent group. Valid Values: accomplished, failed and progressing.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the snapshot group.
    Ids []string
    A list of Snapshot Group IDs.
    InstanceId string
    The ID of the instance.
    NameRegex string
    A regex string to filter results by Snapshot Group name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    SnapshotGroupName string
    The name of the snapshot-consistent group.
    Status string
    The state of snapshot-consistent group. Valid Values: accomplished, failed and progressing.
    Tags map[string]string
    A mapping of tags to assign to the snapshot group.
    ids List<String>
    A list of Snapshot Group IDs.
    instanceId String
    The ID of the instance.
    nameRegex String
    A regex string to filter results by Snapshot Group name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    snapshotGroupName String
    The name of the snapshot-consistent group.
    status String
    The state of snapshot-consistent group. Valid Values: accomplished, failed and progressing.
    tags Map<String,String>
    A mapping of tags to assign to the snapshot group.
    ids string[]
    A list of Snapshot Group IDs.
    instanceId string
    The ID of the instance.
    nameRegex string
    A regex string to filter results by Snapshot Group name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    snapshotGroupName string
    The name of the snapshot-consistent group.
    status string
    The state of snapshot-consistent group. Valid Values: accomplished, failed and progressing.
    tags {[key: string]: string}
    A mapping of tags to assign to the snapshot group.
    ids Sequence[str]
    A list of Snapshot Group IDs.
    instance_id str
    The ID of the instance.
    name_regex str
    A regex string to filter results by Snapshot Group name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    snapshot_group_name str
    The name of the snapshot-consistent group.
    status str
    The state of snapshot-consistent group. Valid Values: accomplished, failed and progressing.
    tags Mapping[str, str]
    A mapping of tags to assign to the snapshot group.
    ids List<String>
    A list of Snapshot Group IDs.
    instanceId String
    The ID of the instance.
    nameRegex String
    A regex string to filter results by Snapshot Group name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    snapshotGroupName String
    The name of the snapshot-consistent group.
    status String
    The state of snapshot-consistent group. Valid Values: accomplished, failed and progressing.
    tags Map<String>
    A mapping of tags to assign to the snapshot group.

    getEcsSnapshotGroups Result

    The following output properties are available:

    Groups List<Pulumi.AliCloud.Ecs.Outputs.GetEcsSnapshotGroupsGroup>
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Names List<string>
    InstanceId string
    NameRegex string
    OutputFile string
    SnapshotGroupName string
    Status string
    Tags Dictionary<string, string>
    Groups []GetEcsSnapshotGroupsGroup
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    InstanceId string
    NameRegex string
    OutputFile string
    SnapshotGroupName string
    Status string
    Tags map[string]string
    groups List<GetEcsSnapshotGroupsGroup>
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    instanceId String
    nameRegex String
    outputFile String
    snapshotGroupName String
    status String
    tags Map<String,String>
    groups GetEcsSnapshotGroupsGroup[]
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    instanceId string
    nameRegex string
    outputFile string
    snapshotGroupName string
    status string
    tags {[key: string]: string}
    groups Sequence[GetEcsSnapshotGroupsGroup]
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    names Sequence[str]
    instance_id str
    name_regex str
    output_file str
    snapshot_group_name str
    status str
    tags Mapping[str, str]
    groups List<Property Map>
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    instanceId String
    nameRegex String
    outputFile String
    snapshotGroupName String
    status String
    tags Map<String>

    Supporting Types

    GetEcsSnapshotGroupsGroup

    Description string
    The description of the snapshot-consistent group.
    Id string
    The ID of the Snapshot Group.
    InstanceId string
    The ID of the instance.
    ResourceGroupId string
    The ID of the resource group to which the snapshot consistency group belongs.
    SnapshotGroupId string
    The first ID of the resource.
    SnapshotGroupName string
    The name of the snapshot-consistent group.
    Status string
    The status of the resource.
    Tags Dictionary<string, string>
    List of label key-value pairs.
    Description string
    The description of the snapshot-consistent group.
    Id string
    The ID of the Snapshot Group.
    InstanceId string
    The ID of the instance.
    ResourceGroupId string
    The ID of the resource group to which the snapshot consistency group belongs.
    SnapshotGroupId string
    The first ID of the resource.
    SnapshotGroupName string
    The name of the snapshot-consistent group.
    Status string
    The status of the resource.
    Tags map[string]string
    List of label key-value pairs.
    description String
    The description of the snapshot-consistent group.
    id String
    The ID of the Snapshot Group.
    instanceId String
    The ID of the instance.
    resourceGroupId String
    The ID of the resource group to which the snapshot consistency group belongs.
    snapshotGroupId String
    The first ID of the resource.
    snapshotGroupName String
    The name of the snapshot-consistent group.
    status String
    The status of the resource.
    tags Map<String,String>
    List of label key-value pairs.
    description string
    The description of the snapshot-consistent group.
    id string
    The ID of the Snapshot Group.
    instanceId string
    The ID of the instance.
    resourceGroupId string
    The ID of the resource group to which the snapshot consistency group belongs.
    snapshotGroupId string
    The first ID of the resource.
    snapshotGroupName string
    The name of the snapshot-consistent group.
    status string
    The status of the resource.
    tags {[key: string]: string}
    List of label key-value pairs.
    description str
    The description of the snapshot-consistent group.
    id str
    The ID of the Snapshot Group.
    instance_id str
    The ID of the instance.
    resource_group_id str
    The ID of the resource group to which the snapshot consistency group belongs.
    snapshot_group_id str
    The first ID of the resource.
    snapshot_group_name str
    The name of the snapshot-consistent group.
    status str
    The status of the resource.
    tags Mapping[str, str]
    List of label key-value pairs.
    description String
    The description of the snapshot-consistent group.
    id String
    The ID of the Snapshot Group.
    instanceId String
    The ID of the instance.
    resourceGroupId String
    The ID of the resource group to which the snapshot consistency group belongs.
    snapshotGroupId String
    The first ID of the resource.
    snapshotGroupName String
    The name of the snapshot-consistent group.
    status String
    The status of the resource.
    tags Map<String>
    List of label key-value pairs.

    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