alicloud logo
Alibaba Cloud v3.34.0, Mar 17 23

alicloud.nas.Snapshot

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

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var name = config.Get("name") ?? "testacc";
    var defaultZones = AliCloud.Nas.GetZones.Invoke(new()
    {
        FileSystemType = "extreme",
    });

    var defaultFileSystem = new AliCloud.Nas.FileSystem("defaultFileSystem", new()
    {
        FileSystemType = "extreme",
        ProtocolType = "NFS",
        ZoneId = defaultZones.Apply(getZonesResult => getZonesResult.Zones[0]?.ZoneId),
        StorageType = "standard",
        Description = name,
        Capacity = 100,
    });

    var defaultSnapshot = new AliCloud.Nas.Snapshot("defaultSnapshot", new()
    {
        FileSystemId = defaultFileSystem.Id,
        Description = name,
        RetentionDays = 20,
        SnapshotName = 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
		}
		defaultZones, err := nas.GetZones(ctx, &nas.GetZonesArgs{
			FileSystemType: pulumi.StringRef("extreme"),
		}, nil)
		if err != nil {
			return err
		}
		defaultFileSystem, err := nas.NewFileSystem(ctx, "defaultFileSystem", &nas.FileSystemArgs{
			FileSystemType: pulumi.String("extreme"),
			ProtocolType:   pulumi.String("NFS"),
			ZoneId:         *pulumi.String(defaultZones.Zones[0].ZoneId),
			StorageType:    pulumi.String("standard"),
			Description:    pulumi.String(name),
			Capacity:       pulumi.Int(100),
		})
		if err != nil {
			return err
		}
		_, err = nas.NewSnapshot(ctx, "defaultSnapshot", &nas.SnapshotArgs{
			FileSystemId:  defaultFileSystem.ID(),
			Description:   pulumi.String(name),
			RetentionDays: pulumi.Int(20),
			SnapshotName:  pulumi.String(name),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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 defaultZones = NasFunctions.getZones(GetZonesArgs.builder()
            .fileSystemType("extreme")
            .build());

        var defaultFileSystem = new FileSystem("defaultFileSystem", FileSystemArgs.builder()        
            .fileSystemType("extreme")
            .protocolType("NFS")
            .zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].zoneId()))
            .storageType("standard")
            .description(name)
            .capacity(100)
            .build());

        var defaultSnapshot = new Snapshot("defaultSnapshot", SnapshotArgs.builder()        
            .fileSystemId(defaultFileSystem.id())
            .description(name)
            .retentionDays(20)
            .snapshotName(name)
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "testacc"
default_zones = alicloud.nas.get_zones(file_system_type="extreme")
default_file_system = alicloud.nas.FileSystem("defaultFileSystem",
    file_system_type="extreme",
    protocol_type="NFS",
    zone_id=default_zones.zones[0].zone_id,
    storage_type="standard",
    description=name,
    capacity=100)
default_snapshot = alicloud.nas.Snapshot("defaultSnapshot",
    file_system_id=default_file_system.id,
    description=name,
    retention_days=20,
    snapshot_name=name)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "testacc";
const defaultZones = alicloud.nas.getZones({
    fileSystemType: "extreme",
});
const defaultFileSystem = new alicloud.nas.FileSystem("defaultFileSystem", {
    fileSystemType: "extreme",
    protocolType: "NFS",
    zoneId: defaultZones.then(defaultZones => defaultZones.zones?.[0]?.zoneId),
    storageType: "standard",
    description: name,
    capacity: 100,
});
const defaultSnapshot = new alicloud.nas.Snapshot("defaultSnapshot", {
    fileSystemId: defaultFileSystem.id,
    description: name,
    retentionDays: 20,
    snapshotName: name,
});
configuration:
  name:
    type: string
    default: testacc
resources:
  defaultFileSystem:
    type: alicloud:nas:FileSystem
    properties:
      fileSystemType: extreme
      protocolType: NFS
      zoneId: ${defaultZones.zones[0].zoneId}
      storageType: standard
      description: ${name}
      capacity: 100
  defaultSnapshot:
    type: alicloud:nas:Snapshot
    properties:
      fileSystemId: ${defaultFileSystem.id}
      description: ${name}
      retentionDays: 20
      snapshotName: ${name}
variables:
  defaultZones:
    fn::invoke:
      Function: alicloud:nas:getZones
      Arguments:
        fileSystemType: extreme

Create Snapshot Resource

new Snapshot(name: string, args: SnapshotArgs, opts?: CustomResourceOptions);
@overload
def Snapshot(resource_name: 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)
@overload
def Snapshot(resource_name: str,
             args: SnapshotArgs,
             opts: Optional[ResourceOptions] = 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.

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.

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:

FileSystemId string

The ID of the file system.

Description string

The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.

RetentionDays 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.
SnapshotName string

SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.

FileSystemId string

The ID of the file system.

Description string

The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.

RetentionDays 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.
SnapshotName string

SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.

fileSystemId String

The ID of the file system.

description String

The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.

retentionDays 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.
snapshotName String

SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.

fileSystemId string

The ID of the file system.

description string

The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.

retentionDays 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.
snapshotName string

SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.

file_system_id str

The ID of the file system.

description str

The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.

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 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.

fileSystemId String

The ID of the file system.

description String

The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.

retentionDays 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.
snapshotName String

SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.

Outputs

All input properties are implicitly available as output properties. Additionally, the Snapshot resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Status string

The status of the snapshot.

Id string

The provider-assigned unique ID for this managed resource.

Status string

The status of the snapshot.

id String

The provider-assigned unique ID for this managed resource.

status String

The status of the snapshot.

id string

The provider-assigned unique ID for this managed resource.

status string

The status of the snapshot.

id str

The provider-assigned unique ID for this managed resource.

status str

The status of the snapshot.

id String

The provider-assigned unique ID for this managed resource.

status String

The status of the snapshot.

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.
The following state arguments are supported:
Description string

The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.

FileSystemId string

The ID of the file system.

RetentionDays 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.
SnapshotName string

SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.

Status string

The status of the snapshot.

Description string

The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.

FileSystemId string

The ID of the file system.

RetentionDays 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.
SnapshotName string

SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.

Status string

The status of the snapshot.

description String

The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.

fileSystemId String

The ID of the file system.

retentionDays 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.
snapshotName String

SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.

status String

The status of the snapshot.

description string

The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.

fileSystemId string

The ID of the file system.

retentionDays 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.
snapshotName string

SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.

status string

The status of the snapshot.

description str

The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.

file_system_id str

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 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.

status str

The status of the snapshot.

description String

The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.

fileSystemId String

The ID of the file system.

retentionDays 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.
snapshotName String

SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.

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>

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.