getEcsSnapshotGroups

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)
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&#46;Apply(getEcsSnapshotGroupsResult => getEcsSnapshotGroupsResult&#46;Groups[0]?.Id),
["ecsSnapshotGroupId2"] = nameRegex&#46;Apply(getEcsSnapshotGroupsResult => getEcsSnapshotGroupsResult&#46;Groups[0]?.Id),
["ecsSnapshotGroupId3"] = status&#46;Apply(getEcsSnapshotGroupsResult => getEcsSnapshotGroupsResult&#46;Groups[0]?.Id),
["ecsSnapshotGroupId4"] = instanceId&#46;Apply(getEcsSnapshotGroupsResult => getEcsSnapshotGroupsResult&#46;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
})
}
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.groups()[0].id());
final var nameRegex = EcsFunctions.getEcsSnapshotGroups(GetEcsSnapshotGroupsArgs.builder()
.nameRegex("^my-SnapshotGroup")
.build());
ctx.export("ecsSnapshotGroupId2", nameRegex.groups()[0].id());
final var status = EcsFunctions.getEcsSnapshotGroups(GetEcsSnapshotGroupsArgs.builder()
.status("accomplished")
.build());
ctx.export("ecsSnapshotGroupId3", status.groups()[0].id());
final var instanceId = EcsFunctions.getEcsSnapshotGroups(GetEcsSnapshotGroupsArgs.builder()
.instanceId("example-instance_id")
.build());
ctx.export("ecsSnapshotGroupId4", 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}

Return

A collection of values returned by getEcsSnapshotGroups.

Parameters

argument

A collection of arguments for invoking getEcsSnapshotGroups.


suspend fun getEcsSnapshotGroups(ids: List<String>? = null, instanceId: String? = null, nameRegex: String? = null, outputFile: String? = null, snapshotGroupName: String? = null, status: String? = null, tags: Map<String, String>? = null): GetEcsSnapshotGroupsResult

Return

A collection of values returned by getEcsSnapshotGroups.

Parameters

ids

A list of Snapshot Group IDs.

instanceId

The ID of the instance.

nameRegex

A regex string to filter results by Snapshot Group name.

outputFile

File name where to save data source results (after running pulumi preview).

snapshotGroupName

The name of the snapshot-consistent group.

status

The state of snapshot-consistent group. Valid Values: accomplished, failed and progressing.

tags

A mapping of tags to assign to the snapshot group.

See also


Return

A collection of values returned by getEcsSnapshotGroups.

Parameters

argument

Builder for com.pulumi.alicloud.ecs.kotlin.inputs.GetEcsSnapshotGroupsPlainArgs.

See also