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.
 - Name
Regex string - A Name Regex of Resource.
 - Output
File string - File name where to save data source results.
 - Project
Name string - The project name of snapshot.
 - Snapshot
Statuses List<string> - A list of snapshot status.
 - 
List<Snapshots
Tag>  - Tags.
 - Zone
Id string - The zone id of snapshot.
 
- Ids []string
 - A list of snapshot IDs.
 - Name
Regex string - A Name Regex of Resource.
 - Output
File string - File name where to save data source results.
 - Project
Name string - The project name of snapshot.
 - Snapshot
Statuses []string - A list of snapshot status.
 - 
[]Snapshots
Tag  - Tags.
 - Zone
Id string - The zone id of snapshot.
 
- ids List<String>
 - A list of snapshot IDs.
 - name
Regex String - A Name Regex of Resource.
 - output
File String - File name where to save data source results.
 - project
Name String - The project name of snapshot.
 - snapshot
Statuses List<String> - A list of snapshot status.
 - 
List<Snapshots
Tag>  - Tags.
 - zone
Id String - The zone id of snapshot.
 
- ids string[]
 - A list of snapshot IDs.
 - name
Regex string - A Name Regex of Resource.
 - output
File string - File name where to save data source results.
 - project
Name string - The project name of snapshot.
 - snapshot
Statuses string[] - A list of snapshot status.
 - 
Snapshots
Tag[]  - Tags.
 - zone
Id 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[Snapshots
Tag]  - Tags.
 - zone_
id str - The zone id of snapshot.
 
- ids List<String>
 - A list of snapshot IDs.
 - name
Regex String - A Name Regex of Resource.
 - output
File String - File name where to save data source results.
 - project
Name String - The project name of snapshot.
 - snapshot
Statuses List<String> - A list of snapshot status.
 - List<Property Map>
 - Tags.
 - zone
Id 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<Snapshots
Snapshot>  - The collection of query.
 - Total
Count int - The total count of query.
 - Ids List<string>
 - Name
Regex string - Output
File string - Project
Name string - The project name of the snapshot.
 - Snapshot
Statuses List<string> - 
List<Snapshots
Tag>  - Tags.
 - Zone
Id string - The zone id of the snapshot.
 
- Id string
 - The provider-assigned unique ID for this managed resource.
 - Snapshots
[]Snapshots
Snapshot  - The collection of query.
 - Total
Count int - The total count of query.
 - Ids []string
 - Name
Regex string - Output
File string - Project
Name string - The project name of the snapshot.
 - Snapshot
Statuses []string - 
[]Snapshots
Tag  - Tags.
 - Zone
Id string - The zone id of the snapshot.
 
- id String
 - The provider-assigned unique ID for this managed resource.
 - snapshots
List<Snapshots
Snapshot>  - The collection of query.
 - total
Count Integer - The total count of query.
 - ids List<String>
 - name
Regex String - output
File String - project
Name String - The project name of the snapshot.
 - snapshot
Statuses List<String> - 
List<Snapshots
Tag>  - Tags.
 - zone
Id String - The zone id of the snapshot.
 
- id string
 - The provider-assigned unique ID for this managed resource.
 - snapshots
Snapshots
Snapshot[]  - The collection of query.
 - total
Count number - The total count of query.
 - ids string[]
 - name
Regex string - output
File string - project
Name string - The project name of the snapshot.
 - snapshot
Statuses string[] - 
Snapshots
Tag[]  - Tags.
 - zone
Id string - The zone id of the snapshot.
 
- id str
 - The provider-assigned unique ID for this managed resource.
 - snapshots
Sequence[Snapshots
Snapshot]  - 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[Snapshots
Tag]  - 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.
 - total
Count Number - The total count of query.
 - ids List<String>
 - name
Regex String - output
File String - project
Name String - The project name of the snapshot.
 - snapshot
Statuses List<String> - List<Property Map>
 - Tags.
 - zone
Id String - The zone id of the snapshot.
 
Supporting Types
SnapshotsSnapshot 
- Creation
Time string - The creation time of the snapshot.
 - Description string
 - The description of the snapshot.
 - Id string
 - The id of the snapshot.
 - Project
Name string - The project name of snapshot.
 - Retention
Days int - The retention days of the snapshot.
 - Snapshot
Id string - The id of the snapshot.
 - Snapshot
Name string - The name of the snapshot.
 - Snapshot
Type string - The type of the snapshot.
 - Status string
 - The status of the snapshot.
 - 
List<Snapshots
Snapshot Tag>  - Tags.
 - Volume
Id string - The volume id of the snapshot.
 - Volume
Kind string - The volume kind of the snapshot.
 - Volume
Name string - The volume name of the snapshot.
 - Volume
Size int - The volume size of the snapshot.
 - Volume
Status string - The volume status of the snapshot.
 - Volume
Type string - The volume type of the snapshot.
 - Zone
Id string - The zone id of snapshot.
 
- Creation
Time string - The creation time of the snapshot.
 - Description string
 - The description of the snapshot.
 - Id string
 - The id of the snapshot.
 - Project
Name string - The project name of snapshot.
 - Retention
Days int - The retention days of the snapshot.
 - Snapshot
Id string - The id of the snapshot.
 - Snapshot
Name string - The name of the snapshot.
 - Snapshot
Type string - The type of the snapshot.
 - Status string
 - The status of the snapshot.
 - 
[]Snapshots
Snapshot Tag  - Tags.
 - Volume
Id string - The volume id of the snapshot.
 - Volume
Kind string - The volume kind of the snapshot.
 - Volume
Name string - The volume name of the snapshot.
 - Volume
Size int - The volume size of the snapshot.
 - Volume
Status string - The volume status of the snapshot.
 - Volume
Type string - The volume type of the snapshot.
 - Zone
Id string - The zone id of snapshot.
 
- creation
Time String - The creation time of the snapshot.
 - description String
 - The description of the snapshot.
 - id String
 - The id of the snapshot.
 - project
Name String - The project name of snapshot.
 - retention
Days Integer - The retention days of the snapshot.
 - snapshot
Id String - The id of the snapshot.
 - snapshot
Name String - The name of the snapshot.
 - snapshot
Type String - The type of the snapshot.
 - status String
 - The status of the snapshot.
 - 
List<Snapshots
Snapshot Tag>  - Tags.
 - volume
Id String - The volume id of the snapshot.
 - volume
Kind String - The volume kind of the snapshot.
 - volume
Name String - The volume name of the snapshot.
 - volume
Size Integer - The volume size of the snapshot.
 - volume
Status String - The volume status of the snapshot.
 - volume
Type String - The volume type of the snapshot.
 - zone
Id String - The zone id of snapshot.
 
- creation
Time string - The creation time of the snapshot.
 - description string
 - The description of the snapshot.
 - id string
 - The id of the snapshot.
 - project
Name string - The project name of snapshot.
 - retention
Days number - The retention days of the snapshot.
 - snapshot
Id string - The id of the snapshot.
 - snapshot
Name string - The name of the snapshot.
 - snapshot
Type string - The type of the snapshot.
 - status string
 - The status of the snapshot.
 - 
Snapshots
Snapshot Tag[]  - Tags.
 - volume
Id string - The volume id of the snapshot.
 - volume
Kind string - The volume kind of the snapshot.
 - volume
Name string - The volume name of the snapshot.
 - volume
Size number - The volume size of the snapshot.
 - volume
Status string - The volume status of the snapshot.
 - volume
Type string - The volume type of the snapshot.
 - zone
Id 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[Snapshots
Snapshot 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.
 
- creation
Time String - The creation time of the snapshot.
 - description String
 - The description of the snapshot.
 - id String
 - The id of the snapshot.
 - project
Name String - The project name of snapshot.
 - retention
Days Number - The retention days of the snapshot.
 - snapshot
Id String - The id of the snapshot.
 - snapshot
Name String - The name of the snapshot.
 - snapshot
Type String - The type of the snapshot.
 - status String
 - The status of the snapshot.
 - List<Property Map>
 - Tags.
 - volume
Id String - The volume id of the snapshot.
 - volume
Kind String - The volume kind of the snapshot.
 - volume
Name String - The volume name of the snapshot.
 - volume
Size Number - The volume size of the snapshot.
 - volume
Status String - The volume status of the snapshot.
 - volume
Type String - The volume type of the snapshot.
 - zone
Id 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.