alicloud.nas.Snapshot
Explore with Pulumi AI
Provides a Network Attached Storage (NAS) Snapshot resource.
For information about Network Attached Storage (NAS) Snapshot and how to use it, see What is Snapshot.
NOTE: Available in v1.152.0+.
NOTE: Only Extreme NAS file systems support the snapshot feature.
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") || "testacc";
const default = alicloud.nas.getZones({
fileSystemType: "extreme",
});
const defaultFileSystem = new alicloud.nas.FileSystem("default", {
fileSystemType: "extreme",
protocolType: "NFS",
zoneId: _default.then(_default => _default.zones?.[0]?.zoneId),
storageType: "standard",
capacity: 100,
});
const defaultSnapshot = new alicloud.nas.Snapshot("default", {
fileSystemId: defaultFileSystem.id,
description: name,
retentionDays: 20,
snapshotName: name,
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "testacc"
default = alicloud.nas.get_zones(file_system_type="extreme")
default_file_system = alicloud.nas.FileSystem("default",
file_system_type="extreme",
protocol_type="NFS",
zone_id=default.zones[0].zone_id,
storage_type="standard",
capacity=100)
default_snapshot = alicloud.nas.Snapshot("default",
file_system_id=default_file_system.id,
description=name,
retention_days=20,
snapshot_name=name)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/nas"
"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 := "testacc"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := nas.GetZones(ctx, &nas.GetZonesArgs{
FileSystemType: pulumi.StringRef("extreme"),
}, nil)
if err != nil {
return err
}
defaultFileSystem, err := nas.NewFileSystem(ctx, "default", &nas.FileSystemArgs{
FileSystemType: pulumi.String("extreme"),
ProtocolType: pulumi.String("NFS"),
ZoneId: pulumi.String(_default.Zones[0].ZoneId),
StorageType: pulumi.String("standard"),
Capacity: pulumi.Int(100),
})
if err != nil {
return err
}
_, err = nas.NewSnapshot(ctx, "default", &nas.SnapshotArgs{
FileSystemId: defaultFileSystem.ID(),
Description: pulumi.String(name),
RetentionDays: pulumi.Int(20),
SnapshotName: pulumi.String(name),
})
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") ?? "testacc";
var @default = AliCloud.Nas.GetZones.Invoke(new()
{
FileSystemType = "extreme",
});
var defaultFileSystem = new AliCloud.Nas.FileSystem("default", new()
{
FileSystemType = "extreme",
ProtocolType = "NFS",
ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.ZoneId)),
StorageType = "standard",
Capacity = 100,
});
var defaultSnapshot = new AliCloud.Nas.Snapshot("default", new()
{
FileSystemId = defaultFileSystem.Id,
Description = name,
RetentionDays = 20,
SnapshotName = name,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.nas.NasFunctions;
import com.pulumi.alicloud.nas.inputs.GetZonesArgs;
import com.pulumi.alicloud.nas.FileSystem;
import com.pulumi.alicloud.nas.FileSystemArgs;
import com.pulumi.alicloud.nas.Snapshot;
import com.pulumi.alicloud.nas.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("testacc");
final var default = NasFunctions.getZones(GetZonesArgs.builder()
.fileSystemType("extreme")
.build());
var defaultFileSystem = new FileSystem("defaultFileSystem", FileSystemArgs.builder()
.fileSystemType("extreme")
.protocolType("NFS")
.zoneId(default_.zones()[0].zoneId())
.storageType("standard")
.capacity(100)
.build());
var defaultSnapshot = new Snapshot("defaultSnapshot", SnapshotArgs.builder()
.fileSystemId(defaultFileSystem.id())
.description(name)
.retentionDays(20)
.snapshotName(name)
.build());
}
}
configuration:
name:
type: string
default: testacc
resources:
defaultFileSystem:
type: alicloud:nas:FileSystem
name: default
properties:
fileSystemType: extreme
protocolType: NFS
zoneId: ${default.zones[0].zoneId}
storageType: standard
capacity: 100
defaultSnapshot:
type: alicloud:nas:Snapshot
name: default
properties:
fileSystemId: ${defaultFileSystem.id}
description: ${name}
retentionDays: 20
snapshotName: ${name}
variables:
default:
fn::invoke:
Function: alicloud:nas:getZones
Arguments:
fileSystemType: extreme
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,
file_system_id: Optional[str] = None,
description: Optional[str] = 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:nas: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 examplesnapshotResourceResourceFromNassnapshot = new AliCloud.Nas.Snapshot("examplesnapshotResourceResourceFromNassnapshot", new()
{
FileSystemId = "string",
Description = "string",
RetentionDays = 0,
SnapshotName = "string",
});
example, err := nas.NewSnapshot(ctx, "examplesnapshotResourceResourceFromNassnapshot", &nas.SnapshotArgs{
FileSystemId: pulumi.String("string"),
Description: pulumi.String("string"),
RetentionDays: pulumi.Int(0),
SnapshotName: pulumi.String("string"),
})
var examplesnapshotResourceResourceFromNassnapshot = new Snapshot("examplesnapshotResourceResourceFromNassnapshot", SnapshotArgs.builder()
.fileSystemId("string")
.description("string")
.retentionDays(0)
.snapshotName("string")
.build());
examplesnapshot_resource_resource_from_nassnapshot = alicloud.nas.Snapshot("examplesnapshotResourceResourceFromNassnapshot",
file_system_id="string",
description="string",
retention_days=0,
snapshot_name="string")
const examplesnapshotResourceResourceFromNassnapshot = new alicloud.nas.Snapshot("examplesnapshotResourceResourceFromNassnapshot", {
fileSystemId: "string",
description: "string",
retentionDays: 0,
snapshotName: "string",
});
type: alicloud:nas:Snapshot
properties:
description: string
fileSystemId: 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
The Snapshot resource accepts the following input properties:
- File
System stringId - The ID of the file system.
- Description string
- The description of the snapshot. It must be
2
to256
characters in length and cannot start withhttps://
orhttps://
. - Retention
Days int - The retention period of the snapshot. Unit: days. Valid values:
-1
: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
- Snapshot
Name string - SnapshotName. It must be
2
to128
characters in length and must start with a letter, but cannot start withhttps://
orhttps://
.
- File
System stringId - The ID of the file system.
- Description string
- The description of the snapshot. It must be
2
to256
characters in length and cannot start withhttps://
orhttps://
. - Retention
Days int - The retention period of the snapshot. Unit: days. Valid values:
-1
: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
- Snapshot
Name string - SnapshotName. It must be
2
to128
characters in length and must start with a letter, but cannot start withhttps://
orhttps://
.
- file
System StringId - The ID of the file system.
- description String
- The description of the snapshot. It must be
2
to256
characters in length and cannot start withhttps://
orhttps://
. - retention
Days Integer - The retention period of the snapshot. Unit: days. Valid values:
-1
: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
- snapshot
Name String - SnapshotName. It must be
2
to128
characters in length and must start with a letter, but cannot start withhttps://
orhttps://
.
- file
System stringId - The ID of the file system.
- description string
- The description of the snapshot. It must be
2
to256
characters in length and cannot start withhttps://
orhttps://
. - retention
Days number - The retention period of the snapshot. Unit: days. Valid values:
-1
: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
- snapshot
Name string - SnapshotName. It must be
2
to128
characters in length and must start with a letter, but cannot start withhttps://
orhttps://
.
- file_
system_ strid - The ID of the file system.
- description str
- The description of the snapshot. It must be
2
to256
characters in length and cannot start withhttps://
orhttps://
. - retention_
days int - The retention period of the snapshot. Unit: days. Valid values:
-1
: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
- snapshot_
name str - SnapshotName. It must be
2
to128
characters in length and must start with a letter, but cannot start withhttps://
orhttps://
.
- file
System StringId - The ID of the file system.
- description String
- The description of the snapshot. It must be
2
to256
characters in length and cannot start withhttps://
orhttps://
. - retention
Days Number - The retention period of the snapshot. Unit: days. Valid values:
-1
: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
- snapshot
Name String - SnapshotName. It must be
2
to128
characters in length and must start with a letter, but cannot start withhttps://
orhttps://
.
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,
file_system_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. It must be
2
to256
characters in length and cannot start withhttps://
orhttps://
. - File
System stringId - The ID of the file system.
- Retention
Days int - The retention period of the snapshot. Unit: days. Valid values:
-1
: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
- Snapshot
Name string - SnapshotName. It must be
2
to128
characters in length and must start with a letter, but cannot start withhttps://
orhttps://
. - Status string
- The status of the snapshot.
- Description string
- The description of the snapshot. It must be
2
to256
characters in length and cannot start withhttps://
orhttps://
. - File
System stringId - The ID of the file system.
- Retention
Days int - The retention period of the snapshot. Unit: days. Valid values:
-1
: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
- Snapshot
Name string - SnapshotName. It must be
2
to128
characters in length and must start with a letter, but cannot start withhttps://
orhttps://
. - Status string
- The status of the snapshot.
- description String
- The description of the snapshot. It must be
2
to256
characters in length and cannot start withhttps://
orhttps://
. - file
System StringId - The ID of the file system.
- retention
Days Integer - The retention period of the snapshot. Unit: days. Valid values:
-1
: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
- snapshot
Name String - SnapshotName. It must be
2
to128
characters in length and must start with a letter, but cannot start withhttps://
orhttps://
. - status String
- The status of the snapshot.
- description string
- The description of the snapshot. It must be
2
to256
characters in length and cannot start withhttps://
orhttps://
. - file
System stringId - The ID of the file system.
- retention
Days number - The retention period of the snapshot. Unit: days. Valid values:
-1
: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
- snapshot
Name string - SnapshotName. It must be
2
to128
characters in length and must start with a letter, but cannot start withhttps://
orhttps://
. - status string
- The status of the snapshot.
- description str
- The description of the snapshot. It must be
2
to256
characters in length and cannot start withhttps://
orhttps://
. - file_
system_ strid - The ID of the file system.
- retention_
days int - The retention period of the snapshot. Unit: days. Valid values:
-1
: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
- snapshot_
name str - SnapshotName. It must be
2
to128
characters in length and must start with a letter, but cannot start withhttps://
orhttps://
. - status str
- The status of the snapshot.
- description String
- The description of the snapshot. It must be
2
to256
characters in length and cannot start withhttps://
orhttps://
. - file
System StringId - The ID of the file system.
- retention
Days Number - The retention period of the snapshot. Unit: days. Valid values:
-1
: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
- snapshot
Name String - SnapshotName. It must be
2
to128
characters in length and must start with a letter, but cannot start withhttps://
orhttps://
. - status String
- The status of the snapshot.
Import
Network Attached Storage (NAS) Snapshot can be imported using the id, e.g.
$ pulumi import alicloud:nas/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.