getEcsSnapshots

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

NOTE: Available in v1.120.0+.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const example = alicloud.ecs.getEcsSnapshots({
ids: ["s-bp1fvuxxxxxxxx"],
nameRegex: "tf-test",
});
export const firstEcsSnapshotId = example.then(example => example.snapshots?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
example = alicloud.ecs.get_ecs_snapshots(ids=["s-bp1fvuxxxxxxxx"],
name_regex="tf-test")
pulumi.export("firstEcsSnapshotId", example.snapshots[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var example = AliCloud.Ecs.GetEcsSnapshots.Invoke(new()
{
Ids = new[]
{
"s-bp1fvuxxxxxxxx",
},
NameRegex = "tf-test",
});
return new Dictionary<string, object?>
{
["firstEcsSnapshotId"] = example&#46;Apply(getEcsSnapshotsResult => getEcsSnapshotsResult&#46;Snapshots[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 {
example, err := ecs.GetEcsSnapshots(ctx, &ecs.GetEcsSnapshotsArgs{
Ids: []string{
"s-bp1fvuxxxxxxxx",
},
NameRegex: pulumi.StringRef("tf-test"),
}, nil)
if err != nil {
return err
}
ctx.Export("firstEcsSnapshotId", example.Snapshots[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.GetEcsSnapshotsArgs;
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 example = EcsFunctions.getEcsSnapshots(GetEcsSnapshotsArgs.builder()
.ids("s-bp1fvuxxxxxxxx")
.nameRegex("tf-test")
.build());
ctx.export("firstEcsSnapshotId", example.applyValue(getEcsSnapshotsResult -> getEcsSnapshotsResult.snapshots()[0].id()));
}
}
variables:
example:
fn::invoke:
function: alicloud:ecs:getEcsSnapshots
arguments:
ids:
- s-bp1fvuxxxxxxxx
nameRegex: tf-test
outputs:
firstEcsSnapshotId: ${example.snapshots[0].id}

Return

A collection of values returned by getEcsSnapshots.

Parameters

argument

A collection of arguments for invoking getEcsSnapshots.


suspend fun getEcsSnapshots(category: String? = null, dryRun: Boolean? = null, encrypted: Boolean? = null, ids: List<String>? = null, kmsKeyId: String? = null, nameRegex: String? = null, outputFile: String? = null, resourceGroupId: String? = null, snapshotLinkId: String? = null, snapshotName: String? = null, snapshotType: String? = null, sourceDiskType: String? = null, status: String? = null, tags: Map<String, String>? = null, type: String? = null, usage: String? = null): GetEcsSnapshotsResult

Return

A collection of values returned by getEcsSnapshots.

Parameters

category

The category of the snapshot. Valid Values: flash and standard.

dryRun

Specifies whether to check the validity of the request without actually making the request.

encrypted

Specifies whether the snapshot is encrypted.

ids

A list of Snapshot IDs.

kmsKeyId

The kms key id.

nameRegex

A regex string to filter results by Snapshot name.

outputFile

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

resourceGroupId

The resource group id.

snapshotLinkId

The snapshot link id.

snapshotName

The name of the snapshot.

snapshotType

The type of the snapshot. Valid Values: auto, user and all. Default to: all.

sourceDiskType

The type of the disk for which the snapshot was created. Valid Values: System, Data.

status

The status of the snapshot. Valid Values: accomplished, failed, progressing and all.

tags

A mapping of tags to assign to the snapshot.

type
usage

A resource type that has a reference relationship. Valid Values: image, disk, image_disk and none.

See also


Return

A collection of values returned by getEcsSnapshots.

Parameters

argument

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

See also