Volcengine v0.0.27 published on Tuesday, Dec 10, 2024 by Volcengine
volcengine.ebs.Snapshots
Explore with Pulumi AI
Use this data source to query detailed information of ebs snapshots
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as volcengine from "@pulumi/volcengine";
import * as volcengine from "@volcengine/pulumi";
const fooZones = volcengine.ecs.Zones({});
const fooVolume = new volcengine.ebs.Volume("fooVolume", {
    volumeName: "acc-test-volume",
    volumeType: "ESSD_PL0",
    description: "acc-test",
    kind: "data",
    size: 500,
    zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
    volumeChargeType: "PostPaid",
    projectName: "default",
});
const fooSnapshot: volcengine.ebs.Snapshot[] = [];
for (const range = {value: 0}; range.value < 2; range.value++) {
    fooSnapshot.push(new volcengine.ebs.Snapshot(`fooSnapshot-${range.value}`, {
        volumeId: fooVolume.id,
        snapshotName: "acc-test-snapshot",
        description: "acc-test",
        retentionDays: 3,
        projectName: "default",
        tags: [{
            key: "k1",
            value: "v1",
        }],
    }));
}
const fooSnapshots = volcengine.ebs.SnapshotsOutput({
    ids: fooSnapshot.map(__item => __item.id),
});
import pulumi
import pulumi_volcengine as volcengine
foo_zones = volcengine.ecs.zones()
foo_volume = volcengine.ebs.Volume("fooVolume",
    volume_name="acc-test-volume",
    volume_type="ESSD_PL0",
    description="acc-test",
    kind="data",
    size=500,
    zone_id=foo_zones.zones[0].id,
    volume_charge_type="PostPaid",
    project_name="default")
foo_snapshot = []
for range in [{"value": i} for i in range(0, 2)]:
    foo_snapshot.append(volcengine.ebs.Snapshot(f"fooSnapshot-{range['value']}",
        volume_id=foo_volume.id,
        snapshot_name="acc-test-snapshot",
        description="acc-test",
        retention_days=3,
        project_name="default",
        tags=[volcengine.ebs.SnapshotTagArgs(
            key="k1",
            value="v1",
        )]))
foo_snapshots = volcengine.ebs.snapshots_output(ids=[__item.id for __item in foo_snapshot])
package main
import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ebs"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
fooZones, err := ecs.Zones(ctx, nil, nil);
if err != nil {
return err
}
fooVolume, err := ebs.NewVolume(ctx, "fooVolume", &ebs.VolumeArgs{
VolumeName: pulumi.String("acc-test-volume"),
VolumeType: pulumi.String("ESSD_PL0"),
Description: pulumi.String("acc-test"),
Kind: pulumi.String("data"),
Size: pulumi.Int(500),
ZoneId: pulumi.String(fooZones.Zones[0].Id),
VolumeChargeType: pulumi.String("PostPaid"),
ProjectName: pulumi.String("default"),
})
if err != nil {
return err
}
var fooSnapshot []*ebs.Snapshot
for index := 0; index < 2; index++ {
    key0 := index
    _ := index
__res, err := ebs.NewSnapshot(ctx, fmt.Sprintf("fooSnapshot-%v", key0), &ebs.SnapshotArgs{
VolumeId: fooVolume.ID(),
SnapshotName: pulumi.String("acc-test-snapshot"),
Description: pulumi.String("acc-test"),
RetentionDays: pulumi.Int(3),
ProjectName: pulumi.String("default"),
Tags: ebs.SnapshotTagArray{
&ebs.SnapshotTagArgs{
Key: pulumi.String("k1"),
Value: pulumi.String("v1"),
},
},
})
if err != nil {
return err
}
fooSnapshot = append(fooSnapshot, __res)
}
_ = ebs.SnapshotsOutput(ctx, ebs.SnapshotsOutputArgs{
Ids: %!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ #-functions-volcengine:ebs-snapshots:Snapshots.pp:28,9-26),
}, nil);
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcengine = Pulumi.Volcengine;
return await Deployment.RunAsync(() => 
{
    var fooZones = Volcengine.Ecs.Zones.Invoke();
    var fooVolume = new Volcengine.Ebs.Volume("fooVolume", new()
    {
        VolumeName = "acc-test-volume",
        VolumeType = "ESSD_PL0",
        Description = "acc-test",
        Kind = "data",
        Size = 500,
        ZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
        VolumeChargeType = "PostPaid",
        ProjectName = "default",
    });
    var fooSnapshot = new List<Volcengine.Ebs.Snapshot>();
    for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        fooSnapshot.Add(new Volcengine.Ebs.Snapshot($"fooSnapshot-{range.Value}", new()
        {
            VolumeId = fooVolume.Id,
            SnapshotName = "acc-test-snapshot",
            Description = "acc-test",
            RetentionDays = 3,
            ProjectName = "default",
            Tags = new[]
            {
                new Volcengine.Ebs.Inputs.SnapshotTagArgs
                {
                    Key = "k1",
                    Value = "v1",
                },
            },
        }));
    }
    var fooSnapshots = Volcengine.Ebs.Snapshots.Invoke(new()
    {
        Ids = fooSnapshot.Select(__item => __item.Id).ToList(),
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.volcengine.ecs.EcsFunctions;
import com.pulumi.volcengine.ecs.inputs.ZonesArgs;
import com.pulumi.volcengine.ebs.Volume;
import com.pulumi.volcengine.ebs.VolumeArgs;
import com.pulumi.volcengine.ebs.Snapshot;
import com.pulumi.volcengine.ebs.SnapshotArgs;
import com.pulumi.volcengine.ebs.inputs.SnapshotTagArgs;
import com.pulumi.volcengine.ebs.EbsFunctions;
import com.pulumi.volcengine.ebs.inputs.SnapshotsArgs;
import com.pulumi.codegen.internal.KeyedValue;
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 fooZones = EcsFunctions.Zones();
        var fooVolume = new Volume("fooVolume", VolumeArgs.builder()        
            .volumeName("acc-test-volume")
            .volumeType("ESSD_PL0")
            .description("acc-test")
            .kind("data")
            .size(500)
            .zoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
            .volumeChargeType("PostPaid")
            .projectName("default")
            .build());
        for (var i = 0; i < 2; i++) {
            new Snapshot("fooSnapshot-" + i, SnapshotArgs.builder()            
                .volumeId(fooVolume.id())
                .snapshotName("acc-test-snapshot")
                .description("acc-test")
                .retentionDays(3)
                .projectName("default")
                .tags(SnapshotTagArgs.builder()
                    .key("k1")
                    .value("v1")
                    .build())
                .build());
        
}
        final var fooSnapshots = EbsFunctions.Snapshots(SnapshotsArgs.builder()
            .ids(fooSnapshot.stream().map(element -> element.id()).collect(toList()))
            .build());
    }
}
Coming soon!
Using Snapshots
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 snapshots(args: SnapshotsArgs, opts?: InvokeOptions): Promise<SnapshotsResult>
function snapshotsOutput(args: SnapshotsOutputArgs, opts?: InvokeOptions): Output<SnapshotsResult>def snapshots(ids: Optional[Sequence[str]] = None,
              name_regex: Optional[str] = None,
              output_file: Optional[str] = None,
              project_name: Optional[str] = None,
              snapshot_statuses: Optional[Sequence[str]] = None,
              tags: Optional[Sequence[SnapshotsTag]] = None,
              zone_id: Optional[str] = None,
              opts: Optional[InvokeOptions] = None) -> SnapshotsResult
def snapshots_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
              name_regex: Optional[pulumi.Input[str]] = None,
              output_file: Optional[pulumi.Input[str]] = None,
              project_name: Optional[pulumi.Input[str]] = None,
              snapshot_statuses: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
              tags: Optional[pulumi.Input[Sequence[pulumi.Input[SnapshotsTagArgs]]]] = None,
              zone_id: Optional[pulumi.Input[str]] = None,
              opts: Optional[InvokeOptions] = None) -> Output[SnapshotsResult]func Snapshots(ctx *Context, args *SnapshotsArgs, opts ...InvokeOption) (*SnapshotsResult, error)
func SnapshotsOutput(ctx *Context, args *SnapshotsOutputArgs, opts ...InvokeOption) SnapshotsResultOutputpublic static class Snapshots 
{
    public static Task<SnapshotsResult> InvokeAsync(SnapshotsArgs args, InvokeOptions? opts = null)
    public static Output<SnapshotsResult> Invoke(SnapshotsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<SnapshotsResult> snapshots(SnapshotsArgs args, InvokeOptions options)
public static Output<SnapshotsResult> snapshots(SnapshotsArgs args, InvokeOptions options)
fn::invoke:
  function: volcengine:ebs:Snapshots
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Ids List<string>
- A list of snapshot IDs.
- NameRegex string
- A Name Regex of Resource.
- OutputFile string
- File name where to save data source results.
- ProjectName string
- The project name of snapshot.
- SnapshotStatuses List<string>
- A list of snapshot status.
- 
List<SnapshotsTag> 
- Tags.
- ZoneId string
- The zone id of snapshot.
- Ids []string
- A list of snapshot IDs.
- NameRegex string
- A Name Regex of Resource.
- OutputFile string
- File name where to save data source results.
- ProjectName string
- The project name of snapshot.
- SnapshotStatuses []string
- A list of snapshot status.
- 
[]SnapshotsTag 
- Tags.
- ZoneId string
- The zone id of snapshot.
- ids List<String>
- A list of snapshot IDs.
- nameRegex String
- A Name Regex of Resource.
- outputFile String
- File name where to save data source results.
- projectName String
- The project name of snapshot.
- snapshotStatuses List<String>
- A list of snapshot status.
- 
List<SnapshotsTag> 
- Tags.
- zoneId String
- The zone id of snapshot.
- ids string[]
- A list of snapshot IDs.
- nameRegex string
- A Name Regex of Resource.
- outputFile string
- File name where to save data source results.
- projectName string
- The project name of snapshot.
- snapshotStatuses string[]
- A list of snapshot status.
- 
SnapshotsTag[] 
- Tags.
- zoneId string
- The zone id of snapshot.
- ids Sequence[str]
- A list of snapshot IDs.
- name_regex str
- A Name Regex of Resource.
- output_file str
- File name where to save data source results.
- project_name str
- The project name of snapshot.
- snapshot_statuses Sequence[str]
- A list of snapshot status.
- 
Sequence[SnapshotsTag] 
- Tags.
- zone_id str
- The zone id of snapshot.
- ids List<String>
- A list of snapshot IDs.
- nameRegex String
- A Name Regex of Resource.
- outputFile String
- File name where to save data source results.
- projectName String
- The project name of snapshot.
- snapshotStatuses List<String>
- A list of snapshot status.
- List<Property Map>
- Tags.
- zoneId String
- The zone id of snapshot.
Snapshots Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Snapshots
List<SnapshotsSnapshot> 
- The collection of query.
- TotalCount int
- The total count of query.
- Ids List<string>
- NameRegex string
- OutputFile string
- ProjectName string
- The project name of the snapshot.
- SnapshotStatuses List<string>
- 
List<SnapshotsTag> 
- Tags.
- ZoneId string
- The zone id of the snapshot.
- Id string
- The provider-assigned unique ID for this managed resource.
- Snapshots
[]SnapshotsSnapshot 
- The collection of query.
- TotalCount int
- The total count of query.
- Ids []string
- NameRegex string
- OutputFile string
- ProjectName string
- The project name of the snapshot.
- SnapshotStatuses []string
- 
[]SnapshotsTag 
- Tags.
- ZoneId string
- The zone id of the snapshot.
- id String
- The provider-assigned unique ID for this managed resource.
- snapshots
List<SnapshotsSnapshot> 
- The collection of query.
- totalCount Integer
- The total count of query.
- ids List<String>
- nameRegex String
- outputFile String
- projectName String
- The project name of the snapshot.
- snapshotStatuses List<String>
- 
List<SnapshotsTag> 
- Tags.
- zoneId String
- The zone id of the snapshot.
- id string
- The provider-assigned unique ID for this managed resource.
- snapshots
SnapshotsSnapshot[] 
- The collection of query.
- totalCount number
- The total count of query.
- ids string[]
- nameRegex string
- outputFile string
- projectName string
- The project name of the snapshot.
- snapshotStatuses string[]
- 
SnapshotsTag[] 
- Tags.
- zoneId string
- The zone id of the snapshot.
- id str
- The provider-assigned unique ID for this managed resource.
- snapshots
Sequence[SnapshotsSnapshot] 
- The collection of query.
- total_count int
- The total count of query.
- ids Sequence[str]
- name_regex str
- output_file str
- project_name str
- The project name of the snapshot.
- snapshot_statuses Sequence[str]
- 
Sequence[SnapshotsTag] 
- Tags.
- zone_id str
- The zone id of the snapshot.
- id String
- The provider-assigned unique ID for this managed resource.
- snapshots List<Property Map>
- The collection of query.
- totalCount Number
- The total count of query.
- ids List<String>
- nameRegex String
- outputFile String
- projectName String
- The project name of the snapshot.
- snapshotStatuses List<String>
- List<Property Map>
- Tags.
- zoneId String
- The zone id of the snapshot.
Supporting Types
SnapshotsSnapshot 
- CreationTime string
- The creation time of the snapshot.
- Description string
- The description of the snapshot.
- Id string
- The id of the snapshot.
- ProjectName string
- The project name of snapshot.
- RetentionDays int
- The retention days of the snapshot.
- SnapshotId string
- The id of the snapshot.
- SnapshotName string
- The name of the snapshot.
- SnapshotType string
- The type of the snapshot.
- Status string
- The status of the snapshot.
- 
List<SnapshotsSnapshot Tag> 
- Tags.
- VolumeId string
- The volume id of the snapshot.
- VolumeKind string
- The volume kind of the snapshot.
- VolumeName string
- The volume name of the snapshot.
- VolumeSize int
- The volume size of the snapshot.
- VolumeStatus string
- The volume status of the snapshot.
- VolumeType string
- The volume type of the snapshot.
- ZoneId string
- The zone id of snapshot.
- CreationTime string
- The creation time of the snapshot.
- Description string
- The description of the snapshot.
- Id string
- The id of the snapshot.
- ProjectName string
- The project name of snapshot.
- RetentionDays int
- The retention days of the snapshot.
- SnapshotId string
- The id of the snapshot.
- SnapshotName string
- The name of the snapshot.
- SnapshotType string
- The type of the snapshot.
- Status string
- The status of the snapshot.
- 
[]SnapshotsSnapshot Tag 
- Tags.
- VolumeId string
- The volume id of the snapshot.
- VolumeKind string
- The volume kind of the snapshot.
- VolumeName string
- The volume name of the snapshot.
- VolumeSize int
- The volume size of the snapshot.
- VolumeStatus string
- The volume status of the snapshot.
- VolumeType string
- The volume type of the snapshot.
- ZoneId string
- The zone id of snapshot.
- creationTime String
- The creation time of the snapshot.
- description String
- The description of the snapshot.
- id String
- The id of the snapshot.
- projectName String
- The project name of snapshot.
- retentionDays Integer
- The retention days of the snapshot.
- snapshotId String
- The id of the snapshot.
- snapshotName String
- The name of the snapshot.
- snapshotType String
- The type of the snapshot.
- status String
- The status of the snapshot.
- 
List<SnapshotsSnapshot Tag> 
- Tags.
- volumeId String
- The volume id of the snapshot.
- volumeKind String
- The volume kind of the snapshot.
- volumeName String
- The volume name of the snapshot.
- volumeSize Integer
- The volume size of the snapshot.
- volumeStatus String
- The volume status of the snapshot.
- volumeType String
- The volume type of the snapshot.
- zoneId String
- The zone id of snapshot.
- creationTime string
- The creation time of the snapshot.
- description string
- The description of the snapshot.
- id string
- The id of the snapshot.
- projectName string
- The project name of snapshot.
- retentionDays number
- The retention days of the snapshot.
- snapshotId string
- The id of the snapshot.
- snapshotName string
- The name of the snapshot.
- snapshotType string
- The type of the snapshot.
- status string
- The status of the snapshot.
- 
SnapshotsSnapshot Tag[] 
- Tags.
- volumeId string
- The volume id of the snapshot.
- volumeKind string
- The volume kind of the snapshot.
- volumeName string
- The volume name of the snapshot.
- volumeSize number
- The volume size of the snapshot.
- volumeStatus string
- The volume status of the snapshot.
- volumeType string
- The volume type of the snapshot.
- zoneId string
- The zone id of snapshot.
- creation_time str
- The creation time of the snapshot.
- description str
- The description of the snapshot.
- id str
- The id of the snapshot.
- project_name str
- The project name of snapshot.
- retention_days int
- The retention days of the snapshot.
- snapshot_id str
- The id of the snapshot.
- snapshot_name str
- The name of the snapshot.
- snapshot_type str
- The type of the snapshot.
- status str
- The status of the snapshot.
- 
Sequence[SnapshotsSnapshot Tag] 
- Tags.
- volume_id str
- The volume id of the snapshot.
- volume_kind str
- The volume kind of the snapshot.
- volume_name str
- The volume name of the snapshot.
- volume_size int
- The volume size of the snapshot.
- volume_status str
- The volume status of the snapshot.
- volume_type str
- The volume type of the snapshot.
- zone_id str
- The zone id of snapshot.
- creationTime String
- The creation time of the snapshot.
- description String
- The description of the snapshot.
- id String
- The id of the snapshot.
- projectName String
- The project name of snapshot.
- retentionDays Number
- The retention days of the snapshot.
- snapshotId String
- The id of the snapshot.
- snapshotName String
- The name of the snapshot.
- snapshotType String
- The type of the snapshot.
- status String
- The status of the snapshot.
- List<Property Map>
- Tags.
- volumeId String
- The volume id of the snapshot.
- volumeKind String
- The volume kind of the snapshot.
- volumeName String
- The volume name of the snapshot.
- volumeSize Number
- The volume size of the snapshot.
- volumeStatus String
- The volume status of the snapshot.
- volumeType String
- The volume type of the snapshot.
- zoneId String
- The zone id of snapshot.
SnapshotsSnapshotTag  
SnapshotsTag 
Package Details
- Repository
- volcengine volcengine/pulumi-volcengine
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the volcengineTerraform Provider.