alicloud.databasefilesystem.Snapshot
Explore with Pulumi AI
Provides a Database File System (DBFS) Snapshot resource.
For information about Database File System (DBFS) Snapshot and how to use it, see What is Snapshot.
NOTE: Available since v1.156.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const default = alicloud.databasefilesystem.getInstances({});
const example = new alicloud.databasefilesystem.Snapshot("example", {
instanceId: _default.then(_default => _default.instances?.[0]?.id),
retentionDays: 50,
snapshotName: name,
description: "DbfsSnapshot",
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = alicloud.databasefilesystem.get_instances()
example = alicloud.databasefilesystem.Snapshot("example",
instance_id=default.instances[0].id,
retention_days=50,
snapshot_name=name,
description="DbfsSnapshot")
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/databasefilesystem"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := databasefilesystem.GetInstances(ctx, &databasefilesystem.GetInstancesArgs{}, nil)
if err != nil {
return err
}
_, err = databasefilesystem.NewSnapshot(ctx, "example", &databasefilesystem.SnapshotArgs{
InstanceId: pulumi.String(_default.Instances[0].Id),
RetentionDays: pulumi.Int(50),
SnapshotName: pulumi.String(name),
Description: pulumi.String("DbfsSnapshot"),
})
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 config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = AliCloud.DatabaseFilesystem.GetInstances.Invoke();
var example = new AliCloud.DatabaseFilesystem.Snapshot("example", new()
{
InstanceId = @default.Apply(@default => @default.Apply(getInstancesResult => getInstancesResult.Instances[0]?.Id)),
RetentionDays = 50,
SnapshotName = name,
Description = "DbfsSnapshot",
});
});
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.GetInstancesArgs;
import com.pulumi.alicloud.databasefilesystem.Snapshot;
import com.pulumi.alicloud.databasefilesystem.SnapshotArgs;
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 config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
final var default = DatabasefilesystemFunctions.getInstances();
var example = new Snapshot("example", SnapshotArgs.builder()
.instanceId(default_.instances()[0].id())
.retentionDays(50)
.snapshotName(name)
.description("DbfsSnapshot")
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
example:
type: alicloud:databasefilesystem:Snapshot
properties:
instanceId: ${default.instances[0].id}
retentionDays: 50
snapshotName: ${name}
description: DbfsSnapshot
variables:
default:
fn::invoke:
Function: alicloud:databasefilesystem:getInstances
Arguments: {}
Create Snapshot Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Snapshot(name: string, args: SnapshotArgs, opts?: CustomResourceOptions);
@overload
def Snapshot(resource_name: str,
args: SnapshotArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Snapshot(resource_name: str,
opts: Optional[ResourceOptions] = None,
instance_id: Optional[str] = None,
description: Optional[str] = None,
force: Optional[bool] = None,
retention_days: Optional[int] = None,
snapshot_name: Optional[str] = None)
func NewSnapshot(ctx *Context, name string, args SnapshotArgs, opts ...ResourceOption) (*Snapshot, error)
public Snapshot(string name, SnapshotArgs args, CustomResourceOptions? opts = null)
public Snapshot(String name, SnapshotArgs args)
public Snapshot(String name, SnapshotArgs args, CustomResourceOptions options)
type: alicloud:databasefilesystem:Snapshot
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args SnapshotArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args SnapshotArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SnapshotArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SnapshotArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SnapshotArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var snapshotResource = new AliCloud.DatabaseFilesystem.Snapshot("snapshotResource", new()
{
InstanceId = "string",
Description = "string",
Force = false,
RetentionDays = 0,
SnapshotName = "string",
});
example, err := databasefilesystem.NewSnapshot(ctx, "snapshotResource", &databasefilesystem.SnapshotArgs{
InstanceId: pulumi.String("string"),
Description: pulumi.String("string"),
Force: pulumi.Bool(false),
RetentionDays: pulumi.Int(0),
SnapshotName: pulumi.String("string"),
})
var snapshotResource = new Snapshot("snapshotResource", SnapshotArgs.builder()
.instanceId("string")
.description("string")
.force(false)
.retentionDays(0)
.snapshotName("string")
.build());
snapshot_resource = alicloud.databasefilesystem.Snapshot("snapshotResource",
instance_id="string",
description="string",
force=False,
retention_days=0,
snapshot_name="string")
const snapshotResource = new alicloud.databasefilesystem.Snapshot("snapshotResource", {
instanceId: "string",
description: "string",
force: false,
retentionDays: 0,
snapshotName: "string",
});
type: alicloud:databasefilesystem:Snapshot
properties:
description: string
force: false
instanceId: string
retentionDays: 0
snapshotName: string
Snapshot Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Snapshot resource accepts the following input properties:
- Instance
Id string - The ID of the Database File System.
- Description string
- The description of the snapshot. The
description
must be2
to256
characters in length. It cannot start withhttp://
orhttps://
. NOTE: From version 1.233.1,description
can be modified. - Force bool
- Specifies whether to force delete the snapshot. Valid values:
- Retention
Days int - The retention period of the snapshot. Valid values:
1
to65536
. - Snapshot
Name string - The name of the snapshot. The
snapshot_name
must be2
to128
characters in length. It must start with a large or small letter or Chinese, and cannot start withhttp://
,https://
,auto
ordbfs-auto
. It can contain numbers, colons (:), underscores (_), or hyphens (-). NOTE: From version 1.233.1,snapshot_name
can be modified.
- Instance
Id string - The ID of the Database File System.
- Description string
- The description of the snapshot. The
description
must be2
to256
characters in length. It cannot start withhttp://
orhttps://
. NOTE: From version 1.233.1,description
can be modified. - Force bool
- Specifies whether to force delete the snapshot. Valid values:
- Retention
Days int - The retention period of the snapshot. Valid values:
1
to65536
. - Snapshot
Name string - The name of the snapshot. The
snapshot_name
must be2
to128
characters in length. It must start with a large or small letter or Chinese, and cannot start withhttp://
,https://
,auto
ordbfs-auto
. It can contain numbers, colons (:), underscores (_), or hyphens (-). NOTE: From version 1.233.1,snapshot_name
can be modified.
- instance
Id String - The ID of the Database File System.
- description String
- The description of the snapshot. The
description
must be2
to256
characters in length. It cannot start withhttp://
orhttps://
. NOTE: From version 1.233.1,description
can be modified. - force Boolean
- Specifies whether to force delete the snapshot. Valid values:
- retention
Days Integer - The retention period of the snapshot. Valid values:
1
to65536
. - snapshot
Name String - The name of the snapshot. The
snapshot_name
must be2
to128
characters in length. It must start with a large or small letter or Chinese, and cannot start withhttp://
,https://
,auto
ordbfs-auto
. It can contain numbers, colons (:), underscores (_), or hyphens (-). NOTE: From version 1.233.1,snapshot_name
can be modified.
- instance
Id string - The ID of the Database File System.
- description string
- The description of the snapshot. The
description
must be2
to256
characters in length. It cannot start withhttp://
orhttps://
. NOTE: From version 1.233.1,description
can be modified. - force boolean
- Specifies whether to force delete the snapshot. Valid values:
- retention
Days number - The retention period of the snapshot. Valid values:
1
to65536
. - snapshot
Name string - The name of the snapshot. The
snapshot_name
must be2
to128
characters in length. It must start with a large or small letter or Chinese, and cannot start withhttp://
,https://
,auto
ordbfs-auto
. It can contain numbers, colons (:), underscores (_), or hyphens (-). NOTE: From version 1.233.1,snapshot_name
can be modified.
- instance_
id str - The ID of the Database File System.
- description str
- The description of the snapshot. The
description
must be2
to256
characters in length. It cannot start withhttp://
orhttps://
. NOTE: From version 1.233.1,description
can be modified. - force bool
- Specifies whether to force delete the snapshot. Valid values:
- retention_
days int - The retention period of the snapshot. Valid values:
1
to65536
. - snapshot_
name str - The name of the snapshot. The
snapshot_name
must be2
to128
characters in length. It must start with a large or small letter or Chinese, and cannot start withhttp://
,https://
,auto
ordbfs-auto
. It can contain numbers, colons (:), underscores (_), or hyphens (-). NOTE: From version 1.233.1,snapshot_name
can be modified.
- instance
Id String - The ID of the Database File System.
- description String
- The description of the snapshot. The
description
must be2
to256
characters in length. It cannot start withhttp://
orhttps://
. NOTE: From version 1.233.1,description
can be modified. - force Boolean
- Specifies whether to force delete the snapshot. Valid values:
- retention
Days Number - The retention period of the snapshot. Valid values:
1
to65536
. - snapshot
Name String - The name of the snapshot. The
snapshot_name
must be2
to128
characters in length. It must start with a large or small letter or Chinese, and cannot start withhttp://
,https://
,auto
ordbfs-auto
. It can contain numbers, colons (:), underscores (_), or hyphens (-). NOTE: From version 1.233.1,snapshot_name
can be modified.
Outputs
All input properties are implicitly available as output properties. Additionally, the Snapshot resource produces the following output properties:
Look up Existing Snapshot Resource
Get an existing Snapshot resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: SnapshotState, opts?: CustomResourceOptions): Snapshot
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
force: Optional[bool] = None,
instance_id: Optional[str] = None,
retention_days: Optional[int] = None,
snapshot_name: Optional[str] = None,
status: Optional[str] = None) -> Snapshot
func GetSnapshot(ctx *Context, name string, id IDInput, state *SnapshotState, opts ...ResourceOption) (*Snapshot, error)
public static Snapshot Get(string name, Input<string> id, SnapshotState? state, CustomResourceOptions? opts = null)
public static Snapshot get(String name, Output<String> id, SnapshotState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Description string
- The description of the snapshot. The
description
must be2
to256
characters in length. It cannot start withhttp://
orhttps://
. NOTE: From version 1.233.1,description
can be modified. - Force bool
- Specifies whether to force delete the snapshot. Valid values:
- Instance
Id string - The ID of the Database File System.
- Retention
Days int - The retention period of the snapshot. Valid values:
1
to65536
. - Snapshot
Name string - The name of the snapshot. The
snapshot_name
must be2
to128
characters in length. It must start with a large or small letter or Chinese, and cannot start withhttp://
,https://
,auto
ordbfs-auto
. It can contain numbers, colons (:), underscores (_), or hyphens (-). NOTE: From version 1.233.1,snapshot_name
can be modified. - Status string
- The status of the Snapshot.
- Description string
- The description of the snapshot. The
description
must be2
to256
characters in length. It cannot start withhttp://
orhttps://
. NOTE: From version 1.233.1,description
can be modified. - Force bool
- Specifies whether to force delete the snapshot. Valid values:
- Instance
Id string - The ID of the Database File System.
- Retention
Days int - The retention period of the snapshot. Valid values:
1
to65536
. - Snapshot
Name string - The name of the snapshot. The
snapshot_name
must be2
to128
characters in length. It must start with a large or small letter or Chinese, and cannot start withhttp://
,https://
,auto
ordbfs-auto
. It can contain numbers, colons (:), underscores (_), or hyphens (-). NOTE: From version 1.233.1,snapshot_name
can be modified. - Status string
- The status of the Snapshot.
- description String
- The description of the snapshot. The
description
must be2
to256
characters in length. It cannot start withhttp://
orhttps://
. NOTE: From version 1.233.1,description
can be modified. - force Boolean
- Specifies whether to force delete the snapshot. Valid values:
- instance
Id String - The ID of the Database File System.
- retention
Days Integer - The retention period of the snapshot. Valid values:
1
to65536
. - snapshot
Name String - The name of the snapshot. The
snapshot_name
must be2
to128
characters in length. It must start with a large or small letter or Chinese, and cannot start withhttp://
,https://
,auto
ordbfs-auto
. It can contain numbers, colons (:), underscores (_), or hyphens (-). NOTE: From version 1.233.1,snapshot_name
can be modified. - status String
- The status of the Snapshot.
- description string
- The description of the snapshot. The
description
must be2
to256
characters in length. It cannot start withhttp://
orhttps://
. NOTE: From version 1.233.1,description
can be modified. - force boolean
- Specifies whether to force delete the snapshot. Valid values:
- instance
Id string - The ID of the Database File System.
- retention
Days number - The retention period of the snapshot. Valid values:
1
to65536
. - snapshot
Name string - The name of the snapshot. The
snapshot_name
must be2
to128
characters in length. It must start with a large or small letter or Chinese, and cannot start withhttp://
,https://
,auto
ordbfs-auto
. It can contain numbers, colons (:), underscores (_), or hyphens (-). NOTE: From version 1.233.1,snapshot_name
can be modified. - status string
- The status of the Snapshot.
- description str
- The description of the snapshot. The
description
must be2
to256
characters in length. It cannot start withhttp://
orhttps://
. NOTE: From version 1.233.1,description
can be modified. - force bool
- Specifies whether to force delete the snapshot. Valid values:
- instance_
id str - The ID of the Database File System.
- retention_
days int - The retention period of the snapshot. Valid values:
1
to65536
. - snapshot_
name str - The name of the snapshot. The
snapshot_name
must be2
to128
characters in length. It must start with a large or small letter or Chinese, and cannot start withhttp://
,https://
,auto
ordbfs-auto
. It can contain numbers, colons (:), underscores (_), or hyphens (-). NOTE: From version 1.233.1,snapshot_name
can be modified. - status str
- The status of the Snapshot.
- description String
- The description of the snapshot. The
description
must be2
to256
characters in length. It cannot start withhttp://
orhttps://
. NOTE: From version 1.233.1,description
can be modified. - force Boolean
- Specifies whether to force delete the snapshot. Valid values:
- instance
Id String - The ID of the Database File System.
- retention
Days Number - The retention period of the snapshot. Valid values:
1
to65536
. - snapshot
Name String - The name of the snapshot. The
snapshot_name
must be2
to128
characters in length. It must start with a large or small letter or Chinese, and cannot start withhttp://
,https://
,auto
ordbfs-auto
. It can contain numbers, colons (:), underscores (_), or hyphens (-). NOTE: From version 1.233.1,snapshot_name
can be modified. - status String
- The status of the Snapshot.
Import
Database File System (DBFS) Snapshot can be imported using the id, e.g.
$ pulumi import alicloud:databasefilesystem/snapshot:Snapshot example <id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.