getSnapshots

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

NOTE: Available in v1.156.0+.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.databasefilesystem.getSnapshots({
ids: ["example_id"],
});
export const dbfsSnapshotId1 = ids.then(ids => ids.snapshots?.[0]?.id);
const nameRegex = alicloud.databasefilesystem.getSnapshots({
nameRegex: "^my-Snapshot",
});
export const dbfsSnapshotId2 = nameRegex.then(nameRegex => nameRegex.snapshots?.[0]?.id);
const status = alicloud.databasefilesystem.getSnapshots({
status: "accomplished",
});
export const dbfsSnapshotId3 = status.then(status => status.snapshots?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.databasefilesystem.get_snapshots(ids=["example_id"])
pulumi.export("dbfsSnapshotId1", ids.snapshots[0].id)
name_regex = alicloud.databasefilesystem.get_snapshots(name_regex="^my-Snapshot")
pulumi.export("dbfsSnapshotId2", name_regex.snapshots[0].id)
status = alicloud.databasefilesystem.get_snapshots(status="accomplished")
pulumi.export("dbfsSnapshotId3", status.snapshots[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.DatabaseFilesystem.GetSnapshots.Invoke(new()
{
Ids = new[]
{
"example_id",
},
});
var nameRegex = AliCloud.DatabaseFilesystem.GetSnapshots.Invoke(new()
{
NameRegex = "^my-Snapshot",
});
var status = AliCloud.DatabaseFilesystem.GetSnapshots.Invoke(new()
{
Status = "accomplished",
});
return new Dictionary<string, object?>
{
["dbfsSnapshotId1"] = ids&#46;Apply(getSnapshotsResult => getSnapshotsResult&#46;Snapshots[0]?.Id),
["dbfsSnapshotId2"] = nameRegex&#46;Apply(getSnapshotsResult => getSnapshotsResult&#46;Snapshots[0]?.Id),
["dbfsSnapshotId3"] = status&#46;Apply(getSnapshotsResult => getSnapshotsResult&#46;Snapshots[0]?.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/databasefilesystem"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ids, err := databasefilesystem.GetSnapshots(ctx, &databasefilesystem.GetSnapshotsArgs{
Ids: []string{
"example_id",
},
}, nil)
if err != nil {
return err
}
ctx.Export("dbfsSnapshotId1", ids.Snapshots[0].Id)
nameRegex, err := databasefilesystem.GetSnapshots(ctx, &databasefilesystem.GetSnapshotsArgs{
NameRegex: pulumi.StringRef("^my-Snapshot"),
}, nil)
if err != nil {
return err
}
ctx.Export("dbfsSnapshotId2", nameRegex.Snapshots[0].Id)
status, err := databasefilesystem.GetSnapshots(ctx, &databasefilesystem.GetSnapshotsArgs{
Status: pulumi.StringRef("accomplished"),
}, nil)
if err != nil {
return err
}
ctx.Export("dbfsSnapshotId3", status.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.databasefilesystem.DatabasefilesystemFunctions;
import com.pulumi.alicloud.databasefilesystem.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 ids = DatabasefilesystemFunctions.getSnapshots(GetSnapshotsArgs.builder()
.ids("example_id")
.build());
ctx.export("dbfsSnapshotId1", ids.snapshots()[0].id());
final var nameRegex = DatabasefilesystemFunctions.getSnapshots(GetSnapshotsArgs.builder()
.nameRegex("^my-Snapshot")
.build());
ctx.export("dbfsSnapshotId2", nameRegex.snapshots()[0].id());
final var status = DatabasefilesystemFunctions.getSnapshots(GetSnapshotsArgs.builder()
.status("accomplished")
.build());
ctx.export("dbfsSnapshotId3", status.snapshots()[0].id());
}
}
variables:
ids:
fn::invoke:
function: alicloud:databasefilesystem:getSnapshots
arguments:
ids:
- example_id
nameRegex:
fn::invoke:
function: alicloud:databasefilesystem:getSnapshots
arguments:
nameRegex: ^my-Snapshot
status:
fn::invoke:
function: alicloud:databasefilesystem:getSnapshots
arguments:
status: accomplished
outputs:
dbfsSnapshotId1: ${ids.snapshots[0].id}
dbfsSnapshotId2: ${nameRegex.snapshots[0].id}
dbfsSnapshotId3: ${status.snapshots[0].id}

Return

A collection of values returned by getSnapshots.

Parameters

argument

A collection of arguments for invoking getSnapshots.


suspend fun getSnapshots(ids: List<String>? = null, nameRegex: String? = null, outputFile: String? = null, status: String? = null): GetSnapshotsResult

Return

A collection of values returned by getSnapshots.

Parameters

ids

A list of Snapshot IDs.

nameRegex

A regex string to filter results by Snapshot name.

outputFile

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

status

The status of the snapshot. Valid values: accomplished, failed, progressing.

See also


Return

A collection of values returned by getSnapshots.

Parameters

argument

Builder for com.pulumi.alicloud.databasefilesystem.kotlin.inputs.GetSnapshotsPlainArgs.

See also