alicloud logo
Alibaba Cloud v3.37.0, May 15 23

alicloud.ecs.getEcsSnapshots

Explore with Pulumi AI

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

NOTE: Available in v1.120.0+.

Example Usage

Basic Usage

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.Apply(getEcsSnapshotsResult => getEcsSnapshotsResult.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()));
    }
}
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)
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);
variables:
  example:
    fn::invoke:
      Function: alicloud:ecs:getEcsSnapshots
      Arguments:
        ids:
          - s-bp1fvuxxxxxxxx
        nameRegex: tf-test
outputs:
  firstEcsSnapshotId: ${example.snapshots[0].id}

Using getEcsSnapshots

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 getEcsSnapshots(args: GetEcsSnapshotsArgs, opts?: InvokeOptions): Promise<GetEcsSnapshotsResult>
function getEcsSnapshotsOutput(args: GetEcsSnapshotsOutputArgs, opts?: InvokeOptions): Output<GetEcsSnapshotsResult>
def get_ecs_snapshots(category: Optional[str] = None,
                      dry_run: Optional[bool] = None,
                      encrypted: Optional[bool] = None,
                      ids: Optional[Sequence[str]] = None,
                      kms_key_id: Optional[str] = None,
                      name_regex: Optional[str] = None,
                      output_file: Optional[str] = None,
                      resource_group_id: Optional[str] = None,
                      snapshot_link_id: Optional[str] = None,
                      snapshot_name: Optional[str] = None,
                      snapshot_type: Optional[str] = None,
                      source_disk_type: Optional[str] = None,
                      status: Optional[str] = None,
                      tags: Optional[Mapping[str, Any]] = None,
                      type: Optional[str] = None,
                      usage: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetEcsSnapshotsResult
def get_ecs_snapshots_output(category: Optional[pulumi.Input[str]] = None,
                      dry_run: Optional[pulumi.Input[bool]] = None,
                      encrypted: Optional[pulumi.Input[bool]] = None,
                      ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                      kms_key_id: Optional[pulumi.Input[str]] = None,
                      name_regex: Optional[pulumi.Input[str]] = None,
                      output_file: Optional[pulumi.Input[str]] = None,
                      resource_group_id: Optional[pulumi.Input[str]] = None,
                      snapshot_link_id: Optional[pulumi.Input[str]] = None,
                      snapshot_name: Optional[pulumi.Input[str]] = None,
                      snapshot_type: Optional[pulumi.Input[str]] = None,
                      source_disk_type: Optional[pulumi.Input[str]] = None,
                      status: Optional[pulumi.Input[str]] = None,
                      tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
                      type: Optional[pulumi.Input[str]] = None,
                      usage: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetEcsSnapshotsResult]
func GetEcsSnapshots(ctx *Context, args *GetEcsSnapshotsArgs, opts ...InvokeOption) (*GetEcsSnapshotsResult, error)
func GetEcsSnapshotsOutput(ctx *Context, args *GetEcsSnapshotsOutputArgs, opts ...InvokeOption) GetEcsSnapshotsResultOutput

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

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

The following arguments are supported:

Category string

The category of the snapshot.

DryRun bool

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

Encrypted bool

Whether the snapshot is encrypted.

Ids List<string>

A list of Snapshot IDs.

KmsKeyId string

The kms key id.

NameRegex string

A regex string to filter results by Snapshot name.

OutputFile string

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

ResourceGroupId string

The resource group id.

SnapshotLinkId string

The snapshot link id.

SnapshotName string

Snapshot Display Name.

SnapshotType string

Snapshot creation type.

SourceDiskType string

Source disk attributes.

Status string

The status of the snapshot.

Tags Dictionary<string, object>

The tags.

Type string
Usage string

A resource type that has a reference relationship.

Category string

The category of the snapshot.

DryRun bool

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

Encrypted bool

Whether the snapshot is encrypted.

Ids []string

A list of Snapshot IDs.

KmsKeyId string

The kms key id.

NameRegex string

A regex string to filter results by Snapshot name.

OutputFile string

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

ResourceGroupId string

The resource group id.

SnapshotLinkId string

The snapshot link id.

SnapshotName string

Snapshot Display Name.

SnapshotType string

Snapshot creation type.

SourceDiskType string

Source disk attributes.

Status string

The status of the snapshot.

Tags map[string]interface{}

The tags.

Type string
Usage string

A resource type that has a reference relationship.

category String

The category of the snapshot.

dryRun Boolean

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

encrypted Boolean

Whether the snapshot is encrypted.

ids List<String>

A list of Snapshot IDs.

kmsKeyId String

The kms key id.

nameRegex String

A regex string to filter results by Snapshot name.

outputFile String

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

resourceGroupId String

The resource group id.

snapshotLinkId String

The snapshot link id.

snapshotName String

Snapshot Display Name.

snapshotType String

Snapshot creation type.

sourceDiskType String

Source disk attributes.

status String

The status of the snapshot.

tags Map<String,Object>

The tags.

type String
usage String

A resource type that has a reference relationship.

category string

The category of the snapshot.

dryRun boolean

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

encrypted boolean

Whether the snapshot is encrypted.

ids string[]

A list of Snapshot IDs.

kmsKeyId string

The kms key id.

nameRegex string

A regex string to filter results by Snapshot name.

outputFile string

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

resourceGroupId string

The resource group id.

snapshotLinkId string

The snapshot link id.

snapshotName string

Snapshot Display Name.

snapshotType string

Snapshot creation type.

sourceDiskType string

Source disk attributes.

status string

The status of the snapshot.

tags {[key: string]: any}

The tags.

type string
usage string

A resource type that has a reference relationship.

category str

The category of the snapshot.

dry_run bool

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

encrypted bool

Whether the snapshot is encrypted.

ids Sequence[str]

A list of Snapshot IDs.

kms_key_id str

The kms key id.

name_regex str

A regex string to filter results by Snapshot name.

output_file str

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

resource_group_id str

The resource group id.

snapshot_link_id str

The snapshot link id.

snapshot_name str

Snapshot Display Name.

snapshot_type str

Snapshot creation type.

source_disk_type str

Source disk attributes.

status str

The status of the snapshot.

tags Mapping[str, Any]

The tags.

type str
usage str

A resource type that has a reference relationship.

category String

The category of the snapshot.

dryRun Boolean

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

encrypted Boolean

Whether the snapshot is encrypted.

ids List<String>

A list of Snapshot IDs.

kmsKeyId String

The kms key id.

nameRegex String

A regex string to filter results by Snapshot name.

outputFile String

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

resourceGroupId String

The resource group id.

snapshotLinkId String

The snapshot link id.

snapshotName String

Snapshot Display Name.

snapshotType String

Snapshot creation type.

sourceDiskType String

Source disk attributes.

status String

The status of the snapshot.

tags Map<Any>

The tags.

type String
usage String

A resource type that has a reference relationship.

getEcsSnapshots Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>
Names List<string>
Snapshots List<Pulumi.AliCloud.Ecs.Outputs.GetEcsSnapshotsSnapshot>
Category string
DryRun bool
Encrypted bool
KmsKeyId string
NameRegex string
OutputFile string
ResourceGroupId string
SnapshotLinkId string
SnapshotName string
SnapshotType string
SourceDiskType string
Status string
Tags Dictionary<string, object>
Type string
Usage string
Id string

The provider-assigned unique ID for this managed resource.

Ids []string
Names []string
Snapshots []GetEcsSnapshotsSnapshot
Category string
DryRun bool
Encrypted bool
KmsKeyId string
NameRegex string
OutputFile string
ResourceGroupId string
SnapshotLinkId string
SnapshotName string
SnapshotType string
SourceDiskType string
Status string
Tags map[string]interface{}
Type string
Usage string
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
names List<String>
snapshots List<GetEcsSnapshotsSnapshot>
category String
dryRun Boolean
encrypted Boolean
kmsKeyId String
nameRegex String
outputFile String
resourceGroupId String
snapshotLinkId String
snapshotName String
snapshotType String
sourceDiskType String
status String
tags Map<String,Object>
type String
usage String
id string

The provider-assigned unique ID for this managed resource.

ids string[]
names string[]
snapshots GetEcsSnapshotsSnapshot[]
category string
dryRun boolean
encrypted boolean
kmsKeyId string
nameRegex string
outputFile string
resourceGroupId string
snapshotLinkId string
snapshotName string
snapshotType string
sourceDiskType string
status string
tags {[key: string]: any}
type string
usage string
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]
names Sequence[str]
snapshots Sequence[GetEcsSnapshotsSnapshot]
category str
dry_run bool
encrypted bool
kms_key_id str
name_regex str
output_file str
resource_group_id str
snapshot_link_id str
snapshot_name str
snapshot_type str
source_disk_type str
status str
tags Mapping[str, Any]
type str
usage str
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
names List<String>
snapshots List<Property Map>
category String
dryRun Boolean
encrypted Boolean
kmsKeyId String
nameRegex String
outputFile String
resourceGroupId String
snapshotLinkId String
snapshotName String
snapshotType String
sourceDiskType String
status String
tags Map<Any>
type String
usage String

Supporting Types

GetEcsSnapshotsSnapshot

Category string

The category of the snapshot.

CreationTime string
Description string

The description of the snapshot.

DiskId string

The source disk id.

Encrypted bool

Whether the snapshot is encrypted.

Id string

The ID of the Snapshot.

InstantAccess bool

Whether snapshot speed availability is enabled.

InstantAccessRetentionDays int

Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.

Name string
ProductCode string

The product number inherited from the mirror market.

Progress string

Snapshot creation progress, in percentage.

RemainTime int

Remaining completion time for the snapshot being created.

ResourceGroupId string

The resource group id.

RetentionDays int

Automatic snapshot retention days.

SnapshotId string

The snapshot id.

SnapshotName string

Snapshot Display Name.

SnapshotSn string

The serial number of the snapshot.

SnapshotType string

Snapshot creation type.

SourceDiskId string
SourceDiskSize string

Source disk capacity.

SourceDiskType string

Source disk attributes.

SourceStorageType string

Original disk type.

Status string

The status of the snapshot.

Tags Dictionary<string, object>

The tags.

Type string
Usage string

A resource type that has a reference relationship.

Category string

The category of the snapshot.

CreationTime string
Description string

The description of the snapshot.

DiskId string

The source disk id.

Encrypted bool

Whether the snapshot is encrypted.

Id string

The ID of the Snapshot.

InstantAccess bool

Whether snapshot speed availability is enabled.

InstantAccessRetentionDays int

Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.

Name string
ProductCode string

The product number inherited from the mirror market.

Progress string

Snapshot creation progress, in percentage.

RemainTime int

Remaining completion time for the snapshot being created.

ResourceGroupId string

The resource group id.

RetentionDays int

Automatic snapshot retention days.

SnapshotId string

The snapshot id.

SnapshotName string

Snapshot Display Name.

SnapshotSn string

The serial number of the snapshot.

SnapshotType string

Snapshot creation type.

SourceDiskId string
SourceDiskSize string

Source disk capacity.

SourceDiskType string

Source disk attributes.

SourceStorageType string

Original disk type.

Status string

The status of the snapshot.

Tags map[string]interface{}

The tags.

Type string
Usage string

A resource type that has a reference relationship.

category String

The category of the snapshot.

creationTime String
description String

The description of the snapshot.

diskId String

The source disk id.

encrypted Boolean

Whether the snapshot is encrypted.

id String

The ID of the Snapshot.

instantAccess Boolean

Whether snapshot speed availability is enabled.

instantAccessRetentionDays Integer

Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.

name String
productCode String

The product number inherited from the mirror market.

progress String

Snapshot creation progress, in percentage.

remainTime Integer

Remaining completion time for the snapshot being created.

resourceGroupId String

The resource group id.

retentionDays Integer

Automatic snapshot retention days.

snapshotId String

The snapshot id.

snapshotName String

Snapshot Display Name.

snapshotSn String

The serial number of the snapshot.

snapshotType String

Snapshot creation type.

sourceDiskId String
sourceDiskSize String

Source disk capacity.

sourceDiskType String

Source disk attributes.

sourceStorageType String

Original disk type.

status String

The status of the snapshot.

tags Map<String,Object>

The tags.

type String
usage String

A resource type that has a reference relationship.

category string

The category of the snapshot.

creationTime string
description string

The description of the snapshot.

diskId string

The source disk id.

encrypted boolean

Whether the snapshot is encrypted.

id string

The ID of the Snapshot.

instantAccess boolean

Whether snapshot speed availability is enabled.

instantAccessRetentionDays number

Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.

name string
productCode string

The product number inherited from the mirror market.

progress string

Snapshot creation progress, in percentage.

remainTime number

Remaining completion time for the snapshot being created.

resourceGroupId string

The resource group id.

retentionDays number

Automatic snapshot retention days.

snapshotId string

The snapshot id.

snapshotName string

Snapshot Display Name.

snapshotSn string

The serial number of the snapshot.

snapshotType string

Snapshot creation type.

sourceDiskId string
sourceDiskSize string

Source disk capacity.

sourceDiskType string

Source disk attributes.

sourceStorageType string

Original disk type.

status string

The status of the snapshot.

tags {[key: string]: any}

The tags.

type string
usage string

A resource type that has a reference relationship.

category str

The category of the snapshot.

creation_time str
description str

The description of the snapshot.

disk_id str

The source disk id.

encrypted bool

Whether the snapshot is encrypted.

id str

The ID of the Snapshot.

instant_access bool

Whether snapshot speed availability is enabled.

instant_access_retention_days int

Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.

name str
product_code str

The product number inherited from the mirror market.

progress str

Snapshot creation progress, in percentage.

remain_time int

Remaining completion time for the snapshot being created.

resource_group_id str

The resource group id.

retention_days int

Automatic snapshot retention days.

snapshot_id str

The snapshot id.

snapshot_name str

Snapshot Display Name.

snapshot_sn str

The serial number of the snapshot.

snapshot_type str

Snapshot creation type.

source_disk_id str
source_disk_size str

Source disk capacity.

source_disk_type str

Source disk attributes.

source_storage_type str

Original disk type.

status str

The status of the snapshot.

tags Mapping[str, Any]

The tags.

type str
usage str

A resource type that has a reference relationship.

category String

The category of the snapshot.

creationTime String
description String

The description of the snapshot.

diskId String

The source disk id.

encrypted Boolean

Whether the snapshot is encrypted.

id String

The ID of the Snapshot.

instantAccess Boolean

Whether snapshot speed availability is enabled.

instantAccessRetentionDays Number

Specifies the retention period of the instant access feature. After the retention period ends, the snapshot is automatically released.

name String
productCode String

The product number inherited from the mirror market.

progress String

Snapshot creation progress, in percentage.

remainTime Number

Remaining completion time for the snapshot being created.

resourceGroupId String

The resource group id.

retentionDays Number

Automatic snapshot retention days.

snapshotId String

The snapshot id.

snapshotName String

Snapshot Display Name.

snapshotSn String

The serial number of the snapshot.

snapshotType String

Snapshot creation type.

sourceDiskId String
sourceDiskSize String

Source disk capacity.

sourceDiskType String

Source disk attributes.

sourceStorageType String

Original disk type.

status String

The status of the snapshot.

tags Map<Any>

The tags.

type String
usage String

A resource type that has a reference relationship.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.