1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. databasefilesystem
  5. getSnapshots
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.databasefilesystem.getSnapshots

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

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);
Copy
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)
Copy
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
	})
}
Copy
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.Apply(getSnapshotsResult => getSnapshotsResult.Snapshots[0]?.Id),
        ["dbfsSnapshotId2"] = nameRegex.Apply(getSnapshotsResult => getSnapshotsResult.Snapshots[0]?.Id),
        ["dbfsSnapshotId3"] = status.Apply(getSnapshotsResult => getSnapshotsResult.Snapshots[0]?.Id),
    };
});
Copy
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.applyValue(getSnapshotsResult -> getSnapshotsResult.snapshots()[0].id()));
        final var nameRegex = DatabasefilesystemFunctions.getSnapshots(GetSnapshotsArgs.builder()
            .nameRegex("^my-Snapshot")
            .build());

        ctx.export("dbfsSnapshotId2", nameRegex.applyValue(getSnapshotsResult -> getSnapshotsResult.snapshots()[0].id()));
        final var status = DatabasefilesystemFunctions.getSnapshots(GetSnapshotsArgs.builder()
            .status("accomplished")
            .build());

        ctx.export("dbfsSnapshotId3", status.applyValue(getSnapshotsResult -> getSnapshotsResult.snapshots()[0].id()));
    }
}
Copy
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}
Copy

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>
Copy
def get_snapshots(ids: Optional[Sequence[str]] = None,
                  name_regex: Optional[str] = None,
                  output_file: Optional[str] = None,
                  status: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetSnapshotsResult
def get_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,
                  status: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetSnapshotsResult]
Copy
func GetSnapshots(ctx *Context, args *GetSnapshotsArgs, opts ...InvokeOption) (*GetSnapshotsResult, error)
func GetSnapshotsOutput(ctx *Context, args *GetSnapshotsOutputArgs, opts ...InvokeOption) GetSnapshotsResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetSnapshotsResult> getSnapshots(GetSnapshotsArgs args, InvokeOptions options)
public static Output<GetSnapshotsResult> getSnapshots(GetSnapshotsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:databasefilesystem/getSnapshots:getSnapshots
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Ids Changes to this property will trigger replacement. List<string>
A list of Snapshot IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Snapshot name.
OutputFile string
File name where to save data source results (after running pulumi preview).
Status Changes to this property will trigger replacement. string
The status of the snapshot. Valid values: accomplished, failed, progressing.
Ids Changes to this property will trigger replacement. []string
A list of Snapshot IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Snapshot name.
OutputFile string
File name where to save data source results (after running pulumi preview).
Status Changes to this property will trigger replacement. string
The status of the snapshot. Valid values: accomplished, failed, progressing.
ids Changes to this property will trigger replacement. List<String>
A list of Snapshot IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Snapshot name.
outputFile String
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. String
The status of the snapshot. Valid values: accomplished, failed, progressing.
ids Changes to this property will trigger replacement. string[]
A list of Snapshot IDs.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Snapshot name.
outputFile string
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. string
The status of the snapshot. Valid values: accomplished, failed, progressing.
ids Changes to this property will trigger replacement. Sequence[str]
A list of Snapshot IDs.
name_regex Changes to this property will trigger replacement. 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).
status Changes to this property will trigger replacement. str
The status of the snapshot. Valid values: accomplished, failed, progressing.
ids Changes to this property will trigger replacement. List<String>
A list of Snapshot IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Snapshot name.
outputFile String
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. String
The status of the snapshot. Valid values: accomplished, failed, progressing.

getSnapshots 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.DatabaseFilesystem.Outputs.GetSnapshotsSnapshot>
NameRegex string
OutputFile string
Status string
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
Names []string
Snapshots []GetSnapshotsSnapshot
NameRegex string
OutputFile string
Status string
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
snapshots List<GetSnapshotsSnapshot>
nameRegex String
outputFile String
status String
id string
The provider-assigned unique ID for this managed resource.
ids string[]
names string[]
snapshots GetSnapshotsSnapshot[]
nameRegex string
outputFile string
status string
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
names Sequence[str]
snapshots Sequence[GetSnapshotsSnapshot]
name_regex str
output_file str
status str
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
snapshots List<Property Map>
nameRegex String
outputFile String
status String

Supporting Types

GetSnapshotsSnapshot

Category This property is required. string
The type of the Snapshot.
CreateTime This property is required. string
The creation time of the snapshot.
Description This property is required. string
The description of the snapshot.
Id This property is required. string
The ID of the Snapshot.
InstanceId This property is required. string
The ID of the database file system.
LastModifiedTime This property is required. string
The last modification time of the snapshot.
Progress This property is required. string
The progress of the snapshot.
RemainTime This property is required. int
The remaining completion time of the snapshot being created, in seconds.
RetentionDays This property is required. int
The retention days of the snapshot.
SnapshotId This property is required. string
The ID of the snapshot.
SnapshotName This property is required. string
The name of the snapshot.
SnapshotType This property is required. string
The creation of the snapshot.
SourceFsSize This property is required. int
Source database file system capacity.
Status This property is required. string
The status of the snapshot. Possible values: progressing, accomplished, failed.
Category This property is required. string
The type of the Snapshot.
CreateTime This property is required. string
The creation time of the snapshot.
Description This property is required. string
The description of the snapshot.
Id This property is required. string
The ID of the Snapshot.
InstanceId This property is required. string
The ID of the database file system.
LastModifiedTime This property is required. string
The last modification time of the snapshot.
Progress This property is required. string
The progress of the snapshot.
RemainTime This property is required. int
The remaining completion time of the snapshot being created, in seconds.
RetentionDays This property is required. int
The retention days of the snapshot.
SnapshotId This property is required. string
The ID of the snapshot.
SnapshotName This property is required. string
The name of the snapshot.
SnapshotType This property is required. string
The creation of the snapshot.
SourceFsSize This property is required. int
Source database file system capacity.
Status This property is required. string
The status of the snapshot. Possible values: progressing, accomplished, failed.
category This property is required. String
The type of the Snapshot.
createTime This property is required. String
The creation time of the snapshot.
description This property is required. String
The description of the snapshot.
id This property is required. String
The ID of the Snapshot.
instanceId This property is required. String
The ID of the database file system.
lastModifiedTime This property is required. String
The last modification time of the snapshot.
progress This property is required. String
The progress of the snapshot.
remainTime This property is required. Integer
The remaining completion time of the snapshot being created, in seconds.
retentionDays This property is required. Integer
The retention days of the snapshot.
snapshotId This property is required. String
The ID of the snapshot.
snapshotName This property is required. String
The name of the snapshot.
snapshotType This property is required. String
The creation of the snapshot.
sourceFsSize This property is required. Integer
Source database file system capacity.
status This property is required. String
The status of the snapshot. Possible values: progressing, accomplished, failed.
category This property is required. string
The type of the Snapshot.
createTime This property is required. string
The creation time of the snapshot.
description This property is required. string
The description of the snapshot.
id This property is required. string
The ID of the Snapshot.
instanceId This property is required. string
The ID of the database file system.
lastModifiedTime This property is required. string
The last modification time of the snapshot.
progress This property is required. string
The progress of the snapshot.
remainTime This property is required. number
The remaining completion time of the snapshot being created, in seconds.
retentionDays This property is required. number
The retention days of the snapshot.
snapshotId This property is required. string
The ID of the snapshot.
snapshotName This property is required. string
The name of the snapshot.
snapshotType This property is required. string
The creation of the snapshot.
sourceFsSize This property is required. number
Source database file system capacity.
status This property is required. string
The status of the snapshot. Possible values: progressing, accomplished, failed.
category This property is required. str
The type of the Snapshot.
create_time This property is required. str
The creation time of the snapshot.
description This property is required. str
The description of the snapshot.
id This property is required. str
The ID of the Snapshot.
instance_id This property is required. str
The ID of the database file system.
last_modified_time This property is required. str
The last modification time of the snapshot.
progress This property is required. str
The progress of the snapshot.
remain_time This property is required. int
The remaining completion time of the snapshot being created, in seconds.
retention_days This property is required. int
The retention days of the snapshot.
snapshot_id This property is required. str
The ID of the snapshot.
snapshot_name This property is required. str
The name of the snapshot.
snapshot_type This property is required. str
The creation of the snapshot.
source_fs_size This property is required. int
Source database file system capacity.
status This property is required. str
The status of the snapshot. Possible values: progressing, accomplished, failed.
category This property is required. String
The type of the Snapshot.
createTime This property is required. String
The creation time of the snapshot.
description This property is required. String
The description of the snapshot.
id This property is required. String
The ID of the Snapshot.
instanceId This property is required. String
The ID of the database file system.
lastModifiedTime This property is required. String
The last modification time of the snapshot.
progress This property is required. String
The progress of the snapshot.
remainTime This property is required. Number
The remaining completion time of the snapshot being created, in seconds.
retentionDays This property is required. Number
The retention days of the snapshot.
snapshotId This property is required. String
The ID of the snapshot.
snapshotName This property is required. String
The name of the snapshot.
snapshotType This property is required. String
The creation of the snapshot.
sourceFsSize This property is required. Number
Source database file system capacity.
status This property is required. String
The status of the snapshot. Possible values: progressing, accomplished, failed.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi