alicloud.ecs.getSnapshots
Explore with Pulumi AI
DEPRECATED: This datasource has been renamed to alicloud.ecs.getEcsSnapshots from version 1.120.0.
Use this data source to get a list of snapshot according to the specified filters in an Alibaba Cloud account.
For information about snapshot and how to use it, see Snapshot.
NOTE: Available in 1.40.0+.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const snapshots = alicloud.ecs.getSnapshots({
ids: ["s-123456890abcdef"],
nameRegex: "tf-testAcc-snapshot",
});
import pulumi
import pulumi_alicloud as alicloud
snapshots = alicloud.ecs.get_snapshots(ids=["s-123456890abcdef"],
name_regex="tf-testAcc-snapshot")
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 {
_, err := ecs.GetSnapshots(ctx, &ecs.GetSnapshotsArgs{
Ids: []string{
"s-123456890abcdef",
},
NameRegex: pulumi.StringRef("tf-testAcc-snapshot"),
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var snapshots = AliCloud.Ecs.GetSnapshots.Invoke(new()
{
Ids = new[]
{
"s-123456890abcdef",
},
NameRegex = "tf-testAcc-snapshot",
});
});
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.GetSnapshotsArgs;
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 snapshots = EcsFunctions.getSnapshots(GetSnapshotsArgs.builder()
.ids("s-123456890abcdef")
.nameRegex("tf-testAcc-snapshot")
.build());
}
}
variables:
snapshots:
fn::invoke:
Function: alicloud:ecs:getSnapshots
Arguments:
ids:
- s-123456890abcdef
nameRegex: tf-testAcc-snapshot
Argument Reference
The following arguments are supported:
instance_id
- (Optional) The specified instance ID.disk_id
- (Optional) The specified disk ID.encrypted
- (Optional) Queries the encrypted snapshots. Optional values:true
: Encrypted snapshots.false
: No encryption attribute limit. Default value:false
.ids
- (Optional) A list of snapshot IDs.name_regex
- (Optional) A regex string to filter results by snapshot name.status
- (Optional) The specified snapshot status. Default value:all
. Optional values:- progressing: The snapshots are being created.
- accomplished: The snapshots are ready to use.
- failed: The snapshot creation failed.
- all: All status.
type
- (Optional) The snapshot category. Default value:all
. Optional values:- auto: Auto snapshots.
- user: Manual snapshots.
- all: Auto and manual snapshots.
source_disk_type
- (Optional) The type of source disk:- System: The snapshots are created for system disks.
- Data: The snapshots are created for data disks.
usage
- (Optional) The usage of the snapshot:- image: The snapshots are used to create custom images.
- disk: The snapshots are used to CreateDisk.
- mage_disk: The snapshots are used to create custom images and data disks.
- none: The snapshots are not used yet.
tags
- (Optional) A map of tags assigned to snapshots.output_file
- (Optional) The name of output file that saves the filter results.
Using getSnapshots
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 getSnapshots(args: GetSnapshotsArgs, opts?: InvokeOptions): Promise<GetSnapshotsResult>
function getSnapshotsOutput(args: GetSnapshotsOutputArgs, opts?: InvokeOptions): Output<GetSnapshotsResult>
def get_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, str]] = None,
type: Optional[str] = None,
usage: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetSnapshotsResult
def get_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, pulumi.Input[str]]]] = None,
type: Optional[pulumi.Input[str]] = None,
usage: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetSnapshotsResult]
func GetSnapshots(ctx *Context, args *GetSnapshotsArgs, opts ...InvokeOption) (*GetSnapshotsResult, error)
func GetSnapshotsOutput(ctx *Context, args *GetSnapshotsOutputArgs, opts ...InvokeOption) GetSnapshotsResultOutput
> Note: This function is named GetSnapshots
in the Go SDK.
public static class GetSnapshots
{
public static Task<GetSnapshotsResult> InvokeAsync(GetSnapshotsArgs args, InvokeOptions? opts = null)
public static Output<GetSnapshotsResult> Invoke(GetSnapshotsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetSnapshotsResult> getSnapshots(GetSnapshotsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: alicloud:ecs/getSnapshots:getSnapshots
arguments:
# arguments dictionary
The following arguments are supported:
- Category string
- Dry
Run bool - Encrypted bool
- Whether the snapshot is encrypted or not.
- Ids List<string>
- A list of snapshot IDs.
- Kms
Key stringId - Name
Regex string - Output
File string - Resource
Group stringId - Snapshot
Link stringId - Snapshot
Name string - Snapshot
Type string - Source
Disk stringType - Source disk attribute. Value range:
System
,Data
. - Status string
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - Dictionary<string, string>
- A map of tags assigned to the snapshot.
- Type string
- Usage string
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
- Category string
- Dry
Run bool - Encrypted bool
- Whether the snapshot is encrypted or not.
- Ids []string
- A list of snapshot IDs.
- Kms
Key stringId - Name
Regex string - Output
File string - Resource
Group stringId - Snapshot
Link stringId - Snapshot
Name string - Snapshot
Type string - Source
Disk stringType - Source disk attribute. Value range:
System
,Data
. - Status string
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - map[string]string
- A map of tags assigned to the snapshot.
- Type string
- Usage string
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
- category String
- dry
Run Boolean - encrypted Boolean
- Whether the snapshot is encrypted or not.
- ids List<String>
- A list of snapshot IDs.
- kms
Key StringId - name
Regex String - output
File String - resource
Group StringId - snapshot
Link StringId - snapshot
Name String - snapshot
Type String - source
Disk StringType - Source disk attribute. Value range:
System
,Data
. - status String
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - Map<String,String>
- A map of tags assigned to the snapshot.
- type String
- usage String
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
- category string
- dry
Run boolean - encrypted boolean
- Whether the snapshot is encrypted or not.
- ids string[]
- A list of snapshot IDs.
- kms
Key stringId - name
Regex string - output
File string - resource
Group stringId - snapshot
Link stringId - snapshot
Name string - snapshot
Type string - source
Disk stringType - Source disk attribute. Value range:
System
,Data
. - status string
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - {[key: string]: string}
- A map of tags assigned to the snapshot.
- type string
- usage string
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
- category str
- dry_
run bool - encrypted bool
- Whether the snapshot is encrypted or not.
- ids Sequence[str]
- A list of snapshot IDs.
- kms_
key_ strid - name_
regex str - output_
file str - resource_
group_ strid - snapshot_
link_ strid - snapshot_
name str - snapshot_
type str - source_
disk_ strtype - Source disk attribute. Value range:
System
,Data
. - status str
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - Mapping[str, str]
- A map of tags assigned to the snapshot.
- type str
- usage str
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
- category String
- dry
Run Boolean - encrypted Boolean
- Whether the snapshot is encrypted or not.
- ids List<String>
- A list of snapshot IDs.
- kms
Key StringId - name
Regex String - output
File String - resource
Group StringId - snapshot
Link StringId - snapshot
Name String - snapshot
Type String - source
Disk StringType - Source disk attribute. Value range:
System
,Data
. - status String
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - Map<String>
- A map of tags assigned to the snapshot.
- type String
- usage String
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
getSnapshots Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- A list of snapshot IDs.
- Names List<string>
- A list of snapshots names.
- Snapshots
List<Pulumi.
Ali Cloud. Ecs. Outputs. Get Snapshots Snapshot> - A list of snapshots. Each element contains the following attributes:
- Category string
- Dry
Run bool - Encrypted bool
- Whether the snapshot is encrypted or not.
- Kms
Key stringId - Name
Regex string - Output
File string - Resource
Group stringId - Snapshot
Link stringId - Snapshot
Name string - Snapshot
Type string - Source
Disk stringType - Source disk attribute. Value range:
System
,Data
. - Status string
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - Dictionary<string, string>
- A map of tags assigned to the snapshot.
- Type string
- Usage string
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- A list of snapshot IDs.
- Names []string
- A list of snapshots names.
- Snapshots
[]Get
Snapshots Snapshot - A list of snapshots. Each element contains the following attributes:
- Category string
- Dry
Run bool - Encrypted bool
- Whether the snapshot is encrypted or not.
- Kms
Key stringId - Name
Regex string - Output
File string - Resource
Group stringId - Snapshot
Link stringId - Snapshot
Name string - Snapshot
Type string - Source
Disk stringType - Source disk attribute. Value range:
System
,Data
. - Status string
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - map[string]string
- A map of tags assigned to the snapshot.
- Type string
- Usage string
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of snapshot IDs.
- names List<String>
- A list of snapshots names.
- snapshots
List<Get
Snapshots Snapshot> - A list of snapshots. Each element contains the following attributes:
- category String
- dry
Run Boolean - encrypted Boolean
- Whether the snapshot is encrypted or not.
- kms
Key StringId - name
Regex String - output
File String - resource
Group StringId - snapshot
Link StringId - snapshot
Name String - snapshot
Type String - source
Disk StringType - Source disk attribute. Value range:
System
,Data
. - status String
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - Map<String,String>
- A map of tags assigned to the snapshot.
- type String
- usage String
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- A list of snapshot IDs.
- names string[]
- A list of snapshots names.
- snapshots
Get
Snapshots Snapshot[] - A list of snapshots. Each element contains the following attributes:
- category string
- dry
Run boolean - encrypted boolean
- Whether the snapshot is encrypted or not.
- kms
Key stringId - name
Regex string - output
File string - resource
Group stringId - snapshot
Link stringId - snapshot
Name string - snapshot
Type string - source
Disk stringType - Source disk attribute. Value range:
System
,Data
. - status string
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - {[key: string]: string}
- A map of tags assigned to the snapshot.
- type string
- usage string
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- A list of snapshot IDs.
- names Sequence[str]
- A list of snapshots names.
- snapshots
Sequence[Get
Snapshots Snapshot] - A list of snapshots. Each element contains the following attributes:
- category str
- dry_
run bool - encrypted bool
- Whether the snapshot is encrypted or not.
- kms_
key_ strid - name_
regex str - output_
file str - resource_
group_ strid - snapshot_
link_ strid - snapshot_
name str - snapshot_
type str - source_
disk_ strtype - Source disk attribute. Value range:
System
,Data
. - status str
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - Mapping[str, str]
- A map of tags assigned to the snapshot.
- type str
- usage str
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of snapshot IDs.
- names List<String>
- A list of snapshots names.
- snapshots List<Property Map>
- A list of snapshots. Each element contains the following attributes:
- category String
- dry
Run Boolean - encrypted Boolean
- Whether the snapshot is encrypted or not.
- kms
Key StringId - name
Regex String - output
File String - resource
Group StringId - snapshot
Link StringId - snapshot
Name String - snapshot
Type String - source
Disk StringType - Source disk attribute. Value range:
System
,Data
. - status String
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - Map<String>
- A map of tags assigned to the snapshot.
- type String
- usage String
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
Supporting Types
GetSnapshotsSnapshot
- Category string
- Creation
Time string - Creation time. Time of creation. It is represented according to ISO8601, and UTC time is used. Format: YYYY-MM-DDThh:mmZ.
- Description string
- Description of the snapshot.
- Disk
Id string - Encrypted bool
- Whether the snapshot is encrypted or not.
- Id string
- ID of the snapshot.
- Instant
Access bool - Instant
Access intRetention Days - Name string
- Name of the snapshot.
- Product
Code string - Product code on the image market place.
- Progress string
- Progress of snapshot creation, presented in percentage.
- Remain
Time int - The remaining time of a snapshot creation task, in seconds.
- Resource
Group stringId - Retention
Days int - The number of days that an automatic snapshot retains in the console for your instance.
- Snapshot
Id string - Snapshot
Name string - Snapshot
Sn string - Snapshot
Type string - Source
Disk stringId - Source disk ID, which is retained after the source disk of the snapshot is deleted.
- Source
Disk stringSize - Size of the source disk, measured in GB.
- Source
Disk stringType - Source disk attribute. Value range:
System
,Data
. - Source
Storage stringType - Status string
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - Dictionary<string, string>
- A map of tags assigned to the snapshot.
- Type string
- Usage string
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
- Category string
- Creation
Time string - Creation time. Time of creation. It is represented according to ISO8601, and UTC time is used. Format: YYYY-MM-DDThh:mmZ.
- Description string
- Description of the snapshot.
- Disk
Id string - Encrypted bool
- Whether the snapshot is encrypted or not.
- Id string
- ID of the snapshot.
- Instant
Access bool - Instant
Access intRetention Days - Name string
- Name of the snapshot.
- Product
Code string - Product code on the image market place.
- Progress string
- Progress of snapshot creation, presented in percentage.
- Remain
Time int - The remaining time of a snapshot creation task, in seconds.
- Resource
Group stringId - Retention
Days int - The number of days that an automatic snapshot retains in the console for your instance.
- Snapshot
Id string - Snapshot
Name string - Snapshot
Sn string - Snapshot
Type string - Source
Disk stringId - Source disk ID, which is retained after the source disk of the snapshot is deleted.
- Source
Disk stringSize - Size of the source disk, measured in GB.
- Source
Disk stringType - Source disk attribute. Value range:
System
,Data
. - Source
Storage stringType - Status string
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - map[string]string
- A map of tags assigned to the snapshot.
- Type string
- Usage string
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
- category String
- creation
Time String - Creation time. Time of creation. It is represented according to ISO8601, and UTC time is used. Format: YYYY-MM-DDThh:mmZ.
- description String
- Description of the snapshot.
- disk
Id String - encrypted Boolean
- Whether the snapshot is encrypted or not.
- id String
- ID of the snapshot.
- instant
Access Boolean - instant
Access IntegerRetention Days - name String
- Name of the snapshot.
- product
Code String - Product code on the image market place.
- progress String
- Progress of snapshot creation, presented in percentage.
- remain
Time Integer - The remaining time of a snapshot creation task, in seconds.
- resource
Group StringId - retention
Days Integer - The number of days that an automatic snapshot retains in the console for your instance.
- snapshot
Id String - snapshot
Name String - snapshot
Sn String - snapshot
Type String - source
Disk StringId - Source disk ID, which is retained after the source disk of the snapshot is deleted.
- source
Disk StringSize - Size of the source disk, measured in GB.
- source
Disk StringType - Source disk attribute. Value range:
System
,Data
. - source
Storage StringType - status String
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - Map<String,String>
- A map of tags assigned to the snapshot.
- type String
- usage String
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
- category string
- creation
Time string - Creation time. Time of creation. It is represented according to ISO8601, and UTC time is used. Format: YYYY-MM-DDThh:mmZ.
- description string
- Description of the snapshot.
- disk
Id string - encrypted boolean
- Whether the snapshot is encrypted or not.
- id string
- ID of the snapshot.
- instant
Access boolean - instant
Access numberRetention Days - name string
- Name of the snapshot.
- product
Code string - Product code on the image market place.
- progress string
- Progress of snapshot creation, presented in percentage.
- remain
Time number - The remaining time of a snapshot creation task, in seconds.
- resource
Group stringId - retention
Days number - The number of days that an automatic snapshot retains in the console for your instance.
- snapshot
Id string - snapshot
Name string - snapshot
Sn string - snapshot
Type string - source
Disk stringId - Source disk ID, which is retained after the source disk of the snapshot is deleted.
- source
Disk stringSize - Size of the source disk, measured in GB.
- source
Disk stringType - Source disk attribute. Value range:
System
,Data
. - source
Storage stringType - status string
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - {[key: string]: string}
- A map of tags assigned to the snapshot.
- type string
- usage string
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
- category str
- creation_
time str - Creation time. Time of creation. It is represented according to ISO8601, and UTC time is used. Format: YYYY-MM-DDThh:mmZ.
- description str
- Description of the snapshot.
- disk_
id str - encrypted bool
- Whether the snapshot is encrypted or not.
- id str
- ID of the snapshot.
- instant_
access bool - instant_
access_ intretention_ days - name str
- Name of the snapshot.
- product_
code str - Product code on the image market place.
- progress str
- Progress of snapshot creation, presented in percentage.
- remain_
time int - The remaining time of a snapshot creation task, in seconds.
- resource_
group_ strid - retention_
days int - The number of days that an automatic snapshot retains in the console for your instance.
- snapshot_
id str - snapshot_
name str - snapshot_
sn str - snapshot_
type str - source_
disk_ strid - Source disk ID, which is retained after the source disk of the snapshot is deleted.
- source_
disk_ strsize - Size of the source disk, measured in GB.
- source_
disk_ strtype - Source disk attribute. Value range:
System
,Data
. - source_
storage_ strtype - status str
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - Mapping[str, str]
- A map of tags assigned to the snapshot.
- type str
- usage str
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
- category String
- creation
Time String - Creation time. Time of creation. It is represented according to ISO8601, and UTC time is used. Format: YYYY-MM-DDThh:mmZ.
- description String
- Description of the snapshot.
- disk
Id String - encrypted Boolean
- Whether the snapshot is encrypted or not.
- id String
- ID of the snapshot.
- instant
Access Boolean - instant
Access NumberRetention Days - name String
- Name of the snapshot.
- product
Code String - Product code on the image market place.
- progress String
- Progress of snapshot creation, presented in percentage.
- remain
Time Number - The remaining time of a snapshot creation task, in seconds.
- resource
Group StringId - retention
Days Number - The number of days that an automatic snapshot retains in the console for your instance.
- snapshot
Id String - snapshot
Name String - snapshot
Sn String - snapshot
Type String - source
Disk StringId - Source disk ID, which is retained after the source disk of the snapshot is deleted.
- source
Disk StringSize - Size of the source disk, measured in GB.
- source
Disk StringType - Source disk attribute. Value range:
System
,Data
. - source
Storage StringType - status String
- The snapshot status. Value range:
progressing
,accomplished
andfailed
. - Map<String>
- A map of tags assigned to the snapshot.
- type String
- usage String
- Whether the snapshots are used to create resources or not. Value range:
image
,disk
,image_disk
andnone
.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.