Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi
alicloud.ecs.getEcsSnapshotGroups
Explore with Pulumi AI
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.
- Instance
Id string - The ID of the instance.
- Name
Regex string - A regex string to filter results by Snapshot Group name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Snapshot
Group stringName - The name of the snapshot-consistent group.
- Status string
- The state of snapshot-consistent group. Valid Values:
accomplished
,failed
andprogressing
. - Dictionary<string, string>
- A mapping of tags to assign to the snapshot group.
- Ids []string
- A list of Snapshot Group IDs.
- Instance
Id string - The ID of the instance.
- Name
Regex string - A regex string to filter results by Snapshot Group name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Snapshot
Group stringName - The name of the snapshot-consistent group.
- Status string
- The state of snapshot-consistent group. Valid Values:
accomplished
,failed
andprogressing
. - map[string]string
- A mapping of tags to assign to the snapshot group.
- ids List<String>
- A list of Snapshot Group IDs.
- instance
Id String - The ID of the instance.
- name
Regex String - A regex string to filter results by Snapshot Group name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - snapshot
Group StringName - The name of the snapshot-consistent group.
- status String
- The state of snapshot-consistent group. Valid Values:
accomplished
,failed
andprogressing
. - Map<String,String>
- A mapping of tags to assign to the snapshot group.
- ids string[]
- A list of Snapshot Group IDs.
- instance
Id string - The ID of the instance.
- name
Regex string - A regex string to filter results by Snapshot Group name.
- output
File string - File name where to save data source results (after running
pulumi preview
). - snapshot
Group stringName - The name of the snapshot-consistent group.
- status string
- The state of snapshot-consistent group. Valid Values:
accomplished
,failed
andprogressing
. - {[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_ strname - The name of the snapshot-consistent group.
- status str
- The state of snapshot-consistent group. Valid Values:
accomplished
,failed
andprogressing
. - Mapping[str, str]
- A mapping of tags to assign to the snapshot group.
- ids List<String>
- A list of Snapshot Group IDs.
- instance
Id String - The ID of the instance.
- name
Regex String - A regex string to filter results by Snapshot Group name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - snapshot
Group StringName - The name of the snapshot-consistent group.
- status String
- The state of snapshot-consistent group. Valid Values:
accomplished
,failed
andprogressing
. - Map<String>
- A mapping of tags to assign to the snapshot group.
getEcsSnapshotGroups Result
The following output properties are available:
- Groups
List<Pulumi.
Ali Cloud. Ecs. Outputs. Get Ecs Snapshot Groups Group> - Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Names List<string>
- Instance
Id string - Name
Regex string - Output
File string - Snapshot
Group stringName - Status string
- Dictionary<string, string>
- Groups
[]Get
Ecs Snapshot Groups Group - Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Names []string
- Instance
Id string - Name
Regex string - Output
File string - Snapshot
Group stringName - Status string
- map[string]string
- groups
List<Get
Ecs Snapshot Groups Group> - id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- instance
Id String - name
Regex String - output
File String - snapshot
Group StringName - status String
- Map<String,String>
- groups
Get
Ecs Snapshot Groups Group[] - id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- names string[]
- instance
Id string - name
Regex string - output
File string - snapshot
Group stringName - status string
- {[key: string]: string}
- groups
Sequence[Get
Ecs Snapshot Groups Group] - 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_ strname - status str
- Mapping[str, str]
- groups List<Property Map>
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- instance
Id String - name
Regex String - output
File String - snapshot
Group StringName - status String
- Map<String>
Supporting Types
GetEcsSnapshotGroupsGroup
- Description string
- The description of the snapshot-consistent group.
- Id string
- The ID of the Snapshot Group.
- Instance
Id string - The ID of the instance.
- Resource
Group stringId - The ID of the resource group to which the snapshot consistency group belongs.
- Snapshot
Group stringId - The first ID of the resource.
- Snapshot
Group stringName - The name of the snapshot-consistent group.
- Status string
- The status of the resource.
- 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.
- Instance
Id string - The ID of the instance.
- Resource
Group stringId - The ID of the resource group to which the snapshot consistency group belongs.
- Snapshot
Group stringId - The first ID of the resource.
- Snapshot
Group stringName - The name of the snapshot-consistent group.
- Status string
- The status of the resource.
- 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.
- instance
Id String - The ID of the instance.
- resource
Group StringId - The ID of the resource group to which the snapshot consistency group belongs.
- snapshot
Group StringId - The first ID of the resource.
- snapshot
Group StringName - The name of the snapshot-consistent group.
- status String
- The status of the resource.
- 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.
- instance
Id string - The ID of the instance.
- resource
Group stringId - The ID of the resource group to which the snapshot consistency group belongs.
- snapshot
Group stringId - The first ID of the resource.
- snapshot
Group stringName - The name of the snapshot-consistent group.
- status string
- The status of the resource.
- {[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_ strid - The ID of the resource group to which the snapshot consistency group belongs.
- snapshot_
group_ strid - The first ID of the resource.
- snapshot_
group_ strname - The name of the snapshot-consistent group.
- status str
- The status of the resource.
- 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.
- instance
Id String - The ID of the instance.
- resource
Group StringId - The ID of the resource group to which the snapshot consistency group belongs.
- snapshot
Group StringId - The first ID of the resource.
- snapshot
Group StringName - The name of the snapshot-consistent group.
- status String
- The status of the resource.
- 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.