com.pulumi.alicloud.nas.kotlin.SnapshotArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-alicloud-kotlin Show documentation
Show all versions of pulumi-alicloud-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.alicloud.nas.kotlin
import com.pulumi.alicloud.nas.SnapshotArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName
/**
* 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](https://www.alibabacloud.com/help/en/doc-detail/126549.html).
* > **NOTE:** Available in v1.152.0+.
* > **NOTE:** Only Extreme NAS file systems support the snapshot feature.
* ## Example Usage
* Basic Usage
*
* ```typescript
* 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,
* });
* ```
* ```python
* 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)
* ```
* ```csharp
* 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,
* });
* });
* ```
* ```go
* 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
* })
* }
* ```
* ```java
* 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());
* }
* }
* ```
* ```yaml
* 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
* ```
*
* ## Import
* Network Attached Storage (NAS) Snapshot can be imported using the id, e.g.
* ```sh
* $ pulumi import alicloud:nas/snapshot:Snapshot example
* ```
* @property description The description of the snapshot. It must be `2` to `256` characters in length and cannot start with `https://` or `https://`.
* @property fileSystemId The ID of the file system.
* @property retentionDays 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.
* @property snapshotName SnapshotName. It must be `2` to `128` characters in length and must start with a letter, but cannot start with `https://` or `https://`.
*/
public data class SnapshotArgs(
public val description: Output? = null,
public val fileSystemId: Output? = null,
public val retentionDays: Output? = null,
public val snapshotName: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.alicloud.nas.SnapshotArgs =
com.pulumi.alicloud.nas.SnapshotArgs.builder()
.description(description?.applyValue({ args0 -> args0 }))
.fileSystemId(fileSystemId?.applyValue({ args0 -> args0 }))
.retentionDays(retentionDays?.applyValue({ args0 -> args0 }))
.snapshotName(snapshotName?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [SnapshotArgs].
*/
@PulumiTagMarker
public class SnapshotArgsBuilder internal constructor() {
private var description: Output? = null
private var fileSystemId: Output? = null
private var retentionDays: Output? = null
private var snapshotName: Output? = null
/**
* @param value The description of the snapshot. It must be `2` to `256` characters in length and cannot start with `https://` or `https://`.
*/
@JvmName("cregnxqtvvduyjei")
public suspend fun description(`value`: Output) {
this.description = value
}
/**
* @param value The ID of the file system.
*/
@JvmName("cqvhxfoulyfscwdy")
public suspend fun fileSystemId(`value`: Output) {
this.fileSystemId = value
}
/**
* @param value 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.
*/
@JvmName("pnenvrklfgcvtqag")
public suspend fun retentionDays(`value`: Output) {
this.retentionDays = value
}
/**
* @param value SnapshotName. It must be `2` to `128` characters in length and must start with a letter, but cannot start with `https://` or `https://`.
*/
@JvmName("fnlaoscnmwajmwbe")
public suspend fun snapshotName(`value`: Output) {
this.snapshotName = value
}
/**
* @param value The description of the snapshot. It must be `2` to `256` characters in length and cannot start with `https://` or `https://`.
*/
@JvmName("gwhkitcfxsbbnsch")
public suspend fun description(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.description = mapped
}
/**
* @param value The ID of the file system.
*/
@JvmName("aqkycuklhpvttiox")
public suspend fun fileSystemId(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.fileSystemId = mapped
}
/**
* @param value 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.
*/
@JvmName("aoeqrbkkekdiveia")
public suspend fun retentionDays(`value`: Int?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.retentionDays = mapped
}
/**
* @param value SnapshotName. It must be `2` to `128` characters in length and must start with a letter, but cannot start with `https://` or `https://`.
*/
@JvmName("kxhbvsxihwpesedx")
public suspend fun snapshotName(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.snapshotName = mapped
}
internal fun build(): SnapshotArgs = SnapshotArgs(
description = description,
fileSystemId = fileSystemId,
retentionDays = retentionDays,
snapshotName = snapshotName,
)
}