All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.compute.kotlin.SnapshotArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.compute.kotlin

import com.pulumi.azure.compute.SnapshotArgs.builder
import com.pulumi.azure.compute.kotlin.inputs.SnapshotEncryptionSettingsArgs
import com.pulumi.azure.compute.kotlin.inputs.SnapshotEncryptionSettingsArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.Int
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages a Disk Snapshot.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "snapshot-rg",
 *     location: "West Europe",
 * });
 * const exampleManagedDisk = new azure.compute.ManagedDisk("example", {
 *     name: "managed-disk",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     storageAccountType: "Standard_LRS",
 *     createOption: "Empty",
 *     diskSizeGb: 10,
 * });
 * const exampleSnapshot = new azure.compute.Snapshot("example", {
 *     name: "snapshot",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     createOption: "Copy",
 *     sourceUri: exampleManagedDisk.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="snapshot-rg",
 *     location="West Europe")
 * example_managed_disk = azure.compute.ManagedDisk("example",
 *     name="managed-disk",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     storage_account_type="Standard_LRS",
 *     create_option="Empty",
 *     disk_size_gb=10)
 * example_snapshot = azure.compute.Snapshot("example",
 *     name="snapshot",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     create_option="Copy",
 *     source_uri=example_managed_disk.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "snapshot-rg",
 *         Location = "West Europe",
 *     });
 *     var exampleManagedDisk = new Azure.Compute.ManagedDisk("example", new()
 *     {
 *         Name = "managed-disk",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         StorageAccountType = "Standard_LRS",
 *         CreateOption = "Empty",
 *         DiskSizeGb = 10,
 *     });
 *     var exampleSnapshot = new Azure.Compute.Snapshot("example", new()
 *     {
 *         Name = "snapshot",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         CreateOption = "Copy",
 *         SourceUri = exampleManagedDisk.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/compute"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("snapshot-rg"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleManagedDisk, err := compute.NewManagedDisk(ctx, "example", &compute.ManagedDiskArgs{
 * 			Name:               pulumi.String("managed-disk"),
 * 			Location:           example.Location,
 * 			ResourceGroupName:  example.Name,
 * 			StorageAccountType: pulumi.String("Standard_LRS"),
 * 			CreateOption:       pulumi.String("Empty"),
 * 			DiskSizeGb:         pulumi.Int(10),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewSnapshot(ctx, "example", &compute.SnapshotArgs{
 * 			Name:              pulumi.String("snapshot"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			CreateOption:      pulumi.String("Copy"),
 * 			SourceUri:         exampleManagedDisk.ID(),
 * 		})
 * 		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.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.compute.ManagedDisk;
 * import com.pulumi.azure.compute.ManagedDiskArgs;
 * import com.pulumi.azure.compute.Snapshot;
 * import com.pulumi.azure.compute.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) {
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("snapshot-rg")
 *             .location("West Europe")
 *             .build());
 *         var exampleManagedDisk = new ManagedDisk("exampleManagedDisk", ManagedDiskArgs.builder()
 *             .name("managed-disk")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .storageAccountType("Standard_LRS")
 *             .createOption("Empty")
 *             .diskSizeGb("10")
 *             .build());
 *         var exampleSnapshot = new Snapshot("exampleSnapshot", SnapshotArgs.builder()
 *             .name("snapshot")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .createOption("Copy")
 *             .sourceUri(exampleManagedDisk.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: snapshot-rg
 *       location: West Europe
 *   exampleManagedDisk:
 *     type: azure:compute:ManagedDisk
 *     name: example
 *     properties:
 *       name: managed-disk
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       storageAccountType: Standard_LRS
 *       createOption: Empty
 *       diskSizeGb: '10'
 *   exampleSnapshot:
 *     type: azure:compute:Snapshot
 *     name: example
 *     properties:
 *       name: snapshot
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       createOption: Copy
 *       sourceUri: ${exampleManagedDisk.id}
 * ```
 * 
 * ## Import
 * Snapshots can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:compute/snapshot:Snapshot example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/snapshots/snapshot1
 * ```
 * @property createOption Indicates how the snapshot is to be created. Possible values are `Copy` or `Import`.
 * > **Note:** One of `source_uri`, `source_resource_id` or `storage_account_id` must be specified.
 * @property diskAccessId Specifies the ID of the Disk Access which should be used for this Snapshot. This is used in conjunction with setting `network_access_policy` to `AllowPrivate`.
 * @property diskSizeGb The size of the Snapshotted Disk in GB.
 * @property encryptionSettings A `encryption_settings` block as defined below.
 * > **NOTE:** Removing `encryption_settings` forces a new resource to be created.
 * @property incrementalEnabled Specifies if the Snapshot is incremental. Changing this forces a new resource to be created.
 * @property location Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
 * @property name Specifies the name of the Snapshot resource. Changing this forces a new resource to be created.
 * @property networkAccessPolicy Policy for accessing the disk via network. Possible values are `AllowAll`, `AllowPrivate`, or `DenyAll`. Defaults to `AllowAll`.
 * @property publicNetworkAccessEnabled Policy for controlling export on the disk. Possible values are `true` or `false`. Defaults to `true`.
 * @property resourceGroupName The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.
 * @property sourceResourceId Specifies a reference to an existing snapshot, when `create_option` is `Copy`. Changing this forces a new resource to be created.
 * @property sourceUri Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.
 * @property storageAccountId Specifies the ID of an storage account. Used with `source_uri` to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.
 * @property tags A mapping of tags to assign to the resource.
 */
public data class SnapshotArgs(
    public val createOption: Output? = null,
    public val diskAccessId: Output? = null,
    public val diskSizeGb: Output? = null,
    public val encryptionSettings: Output? = null,
    public val incrementalEnabled: Output? = null,
    public val location: Output? = null,
    public val name: Output? = null,
    public val networkAccessPolicy: Output? = null,
    public val publicNetworkAccessEnabled: Output? = null,
    public val resourceGroupName: Output? = null,
    public val sourceResourceId: Output? = null,
    public val sourceUri: Output? = null,
    public val storageAccountId: Output? = null,
    public val tags: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.compute.SnapshotArgs =
        com.pulumi.azure.compute.SnapshotArgs.builder()
            .createOption(createOption?.applyValue({ args0 -> args0 }))
            .diskAccessId(diskAccessId?.applyValue({ args0 -> args0 }))
            .diskSizeGb(diskSizeGb?.applyValue({ args0 -> args0 }))
            .encryptionSettings(
                encryptionSettings?.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            )
            .incrementalEnabled(incrementalEnabled?.applyValue({ args0 -> args0 }))
            .location(location?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .networkAccessPolicy(networkAccessPolicy?.applyValue({ args0 -> args0 }))
            .publicNetworkAccessEnabled(publicNetworkAccessEnabled?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .sourceResourceId(sourceResourceId?.applyValue({ args0 -> args0 }))
            .sourceUri(sourceUri?.applyValue({ args0 -> args0 }))
            .storageAccountId(storageAccountId?.applyValue({ args0 -> args0 }))
            .tags(
                tags?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            ).build()
}

/**
 * Builder for [SnapshotArgs].
 */
@PulumiTagMarker
public class SnapshotArgsBuilder internal constructor() {
    private var createOption: Output? = null

    private var diskAccessId: Output? = null

    private var diskSizeGb: Output? = null

    private var encryptionSettings: Output? = null

    private var incrementalEnabled: Output? = null

    private var location: Output? = null

    private var name: Output? = null

    private var networkAccessPolicy: Output? = null

    private var publicNetworkAccessEnabled: Output? = null

    private var resourceGroupName: Output? = null

    private var sourceResourceId: Output? = null

    private var sourceUri: Output? = null

    private var storageAccountId: Output? = null

    private var tags: Output>? = null

    /**
     * @param value Indicates how the snapshot is to be created. Possible values are `Copy` or `Import`.
     * > **Note:** One of `source_uri`, `source_resource_id` or `storage_account_id` must be specified.
     */
    @JvmName("falqkaqnpwxdnrih")
    public suspend fun createOption(`value`: Output) {
        this.createOption = value
    }

    /**
     * @param value Specifies the ID of the Disk Access which should be used for this Snapshot. This is used in conjunction with setting `network_access_policy` to `AllowPrivate`.
     */
    @JvmName("mmlybxbjycbwbkfj")
    public suspend fun diskAccessId(`value`: Output) {
        this.diskAccessId = value
    }

    /**
     * @param value The size of the Snapshotted Disk in GB.
     */
    @JvmName("juuwgyoougyhjkha")
    public suspend fun diskSizeGb(`value`: Output) {
        this.diskSizeGb = value
    }

    /**
     * @param value A `encryption_settings` block as defined below.
     * > **NOTE:** Removing `encryption_settings` forces a new resource to be created.
     */
    @JvmName("ffhtrrjrbybuienb")
    public suspend fun encryptionSettings(`value`: Output) {
        this.encryptionSettings = value
    }

    /**
     * @param value Specifies if the Snapshot is incremental. Changing this forces a new resource to be created.
     */
    @JvmName("wkibxvqjlusxfnll")
    public suspend fun incrementalEnabled(`value`: Output) {
        this.incrementalEnabled = value
    }

    /**
     * @param value Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
     */
    @JvmName("lgrovpexainilmii")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

    /**
     * @param value Specifies the name of the Snapshot resource. Changing this forces a new resource to be created.
     */
    @JvmName("rsllmxweqqkmmnbj")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Policy for accessing the disk via network. Possible values are `AllowAll`, `AllowPrivate`, or `DenyAll`. Defaults to `AllowAll`.
     */
    @JvmName("iyupoltheulooidm")
    public suspend fun networkAccessPolicy(`value`: Output) {
        this.networkAccessPolicy = value
    }

    /**
     * @param value Policy for controlling export on the disk. Possible values are `true` or `false`. Defaults to `true`.
     */
    @JvmName("jnwgdjehohtyljpa")
    public suspend fun publicNetworkAccessEnabled(`value`: Output) {
        this.publicNetworkAccessEnabled = value
    }

    /**
     * @param value The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.
     */
    @JvmName("iacfenjaxxouoxpe")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value Specifies a reference to an existing snapshot, when `create_option` is `Copy`. Changing this forces a new resource to be created.
     */
    @JvmName("dkgnotylpgginpdm")
    public suspend fun sourceResourceId(`value`: Output) {
        this.sourceResourceId = value
    }

    /**
     * @param value Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.
     */
    @JvmName("qjsnyswltghinsws")
    public suspend fun sourceUri(`value`: Output) {
        this.sourceUri = value
    }

    /**
     * @param value Specifies the ID of an storage account. Used with `source_uri` to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.
     */
    @JvmName("jaehfxkjsdtrcmrh")
    public suspend fun storageAccountId(`value`: Output) {
        this.storageAccountId = value
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     */
    @JvmName("kdxbdtbvikpmhqye")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value Indicates how the snapshot is to be created. Possible values are `Copy` or `Import`.
     * > **Note:** One of `source_uri`, `source_resource_id` or `storage_account_id` must be specified.
     */
    @JvmName("advttmrvpdnxkoag")
    public suspend fun createOption(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.createOption = mapped
    }

    /**
     * @param value Specifies the ID of the Disk Access which should be used for this Snapshot. This is used in conjunction with setting `network_access_policy` to `AllowPrivate`.
     */
    @JvmName("dxgbxjljbatkokas")
    public suspend fun diskAccessId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.diskAccessId = mapped
    }

    /**
     * @param value The size of the Snapshotted Disk in GB.
     */
    @JvmName("jpkpjgjpxwidxiew")
    public suspend fun diskSizeGb(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.diskSizeGb = mapped
    }

    /**
     * @param value A `encryption_settings` block as defined below.
     * > **NOTE:** Removing `encryption_settings` forces a new resource to be created.
     */
    @JvmName("gfufmmcehervjnvi")
    public suspend fun encryptionSettings(`value`: SnapshotEncryptionSettingsArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.encryptionSettings = mapped
    }

    /**
     * @param argument A `encryption_settings` block as defined below.
     * > **NOTE:** Removing `encryption_settings` forces a new resource to be created.
     */
    @JvmName("hgyxnllxcclrhptu")
    public suspend fun encryptionSettings(argument: suspend SnapshotEncryptionSettingsArgsBuilder.() -> Unit) {
        val toBeMapped = SnapshotEncryptionSettingsArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.encryptionSettings = mapped
    }

    /**
     * @param value Specifies if the Snapshot is incremental. Changing this forces a new resource to be created.
     */
    @JvmName("cvlwhriqtydhjygj")
    public suspend fun incrementalEnabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.incrementalEnabled = mapped
    }

    /**
     * @param value Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
     */
    @JvmName("dbyvqgidcbcjhskt")
    public suspend fun location(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.location = mapped
    }

    /**
     * @param value Specifies the name of the Snapshot resource. Changing this forces a new resource to be created.
     */
    @JvmName("wbgcorvwanirmkmd")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value Policy for accessing the disk via network. Possible values are `AllowAll`, `AllowPrivate`, or `DenyAll`. Defaults to `AllowAll`.
     */
    @JvmName("pchmjmquoadyiala")
    public suspend fun networkAccessPolicy(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.networkAccessPolicy = mapped
    }

    /**
     * @param value Policy for controlling export on the disk. Possible values are `true` or `false`. Defaults to `true`.
     */
    @JvmName("iwhygvidegujhxmv")
    public suspend fun publicNetworkAccessEnabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.publicNetworkAccessEnabled = mapped
    }

    /**
     * @param value The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.
     */
    @JvmName("ymhkyuulqjgmduap")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value Specifies a reference to an existing snapshot, when `create_option` is `Copy`. Changing this forces a new resource to be created.
     */
    @JvmName("virpxkvbllrtjqwb")
    public suspend fun sourceResourceId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.sourceResourceId = mapped
    }

    /**
     * @param value Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.
     */
    @JvmName("uqgmecmmvxgaynll")
    public suspend fun sourceUri(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.sourceUri = mapped
    }

    /**
     * @param value Specifies the ID of an storage account. Used with `source_uri` to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.
     */
    @JvmName("jlbxocvxxlsnpnbo")
    public suspend fun storageAccountId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.storageAccountId = mapped
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     */
    @JvmName("kkwhjxqjugeepbbk")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A mapping of tags to assign to the resource.
     */
    @JvmName("lmthaeecskewtlbt")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    internal fun build(): SnapshotArgs = SnapshotArgs(
        createOption = createOption,
        diskAccessId = diskAccessId,
        diskSizeGb = diskSizeGb,
        encryptionSettings = encryptionSettings,
        incrementalEnabled = incrementalEnabled,
        location = location,
        name = name,
        networkAccessPolicy = networkAccessPolicy,
        publicNetworkAccessEnabled = publicNetworkAccessEnabled,
        resourceGroupName = resourceGroupName,
        sourceResourceId = sourceResourceId,
        sourceUri = sourceUri,
        storageAccountId = storageAccountId,
        tags = tags,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy