Alibaba Cloud

v3.28.0 published on Tuesday, Aug 16, 2022 by Pulumi

getEcsSnapshotGroups

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

NOTE: Available in v1.160.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var ids = Output.Create(AliCloud.Ecs.GetEcsSnapshotGroups.InvokeAsync(new AliCloud.Ecs.GetEcsSnapshotGroupsArgs
        {
            Ids = 
            {
                "example-id",
            },
        }));
        this.EcsSnapshotGroupId1 = ids.Apply(ids => ids.Groups?[0]?.Id);
        var nameRegex = Output.Create(AliCloud.Ecs.GetEcsSnapshotGroups.InvokeAsync(new AliCloud.Ecs.GetEcsSnapshotGroupsArgs
        {
            NameRegex = "^my-SnapshotGroup",
        }));
        this.EcsSnapshotGroupId2 = nameRegex.Apply(nameRegex => nameRegex.Groups?[0]?.Id);
        var status = Output.Create(AliCloud.Ecs.GetEcsSnapshotGroups.InvokeAsync(new AliCloud.Ecs.GetEcsSnapshotGroupsArgs
        {
            Status = "accomplished",
        }));
        this.EcsSnapshotGroupId3 = status.Apply(status => status.Groups?[0]?.Id);
        var instanceId = Output.Create(AliCloud.Ecs.GetEcsSnapshotGroups.InvokeAsync(new AliCloud.Ecs.GetEcsSnapshotGroupsArgs
        {
            InstanceId = "example-instance_id",
        }));
        this.EcsSnapshotGroupId4 = instanceId.Apply(instanceId => instanceId.Groups?[0]?.Id);
    }

    [Output("ecsSnapshotGroupId1")]
    public Output<string> EcsSnapshotGroupId1 { get; set; }
    [Output("ecsSnapshotGroupId2")]
    public Output<string> EcsSnapshotGroupId2 { get; set; }
    [Output("ecsSnapshotGroupId3")]
    public Output<string> EcsSnapshotGroupId3 { get; set; }
    [Output("ecsSnapshotGroupId4")]
    public Output<string> EcsSnapshotGroupId4 { get; set; }
}
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
	})
}
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()));
    }
}
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)
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);
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, Any]] = 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, Any]]] = 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
SnapshotGroupName string

The name of the snapshot-consistent group.

Status string

The status of the resource.

Tags Dictionary<string, object>

List of label key-value pairs.

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
SnapshotGroupName string

The name of the snapshot-consistent group.

Status string

The status of the resource.

Tags map[string]interface{}

List of label key-value pairs.

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
snapshotGroupName String

The name of the snapshot-consistent group.

status String

The status of the resource.

tags Map<String,Object>

List of label key-value pairs.

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
snapshotGroupName string

The name of the snapshot-consistent group.

status string

The status of the resource.

tags {[key: string]: any}

List of label key-value pairs.

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
snapshot_group_name str

The name of the snapshot-consistent group.

status str

The status of the resource.

tags Mapping[str, Any]

List of label key-value pairs.

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
snapshotGroupName String

The name of the snapshot-consistent group.

status String

The status of the resource.

tags Map<Any>

List of label key-value pairs.

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, object>
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]interface{}
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,Object>
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]: any}
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, Any]
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<Any>

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, object>

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]interface{}

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,Object>

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]: any}

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, Any]

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<Any>

List of label key-value pairs.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.