com.pulumi.azure.compute.kotlin.Snapshot.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-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.azure.compute.kotlin
import com.pulumi.azure.compute.kotlin.outputs.SnapshotEncryptionSettings
import com.pulumi.azure.compute.kotlin.outputs.SnapshotEncryptionSettings.Companion.toKotlin
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
/**
* Builder for [Snapshot].
*/
@PulumiTagMarker
public class SnapshotResourceBuilder internal constructor() {
public var name: String? = null
public var args: SnapshotArgs = SnapshotArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend SnapshotArgsBuilder.() -> Unit) {
val builder = SnapshotArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): Snapshot {
val builtJavaResource = com.pulumi.azure.compute.Snapshot(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Snapshot(builtJavaResource)
}
}
/**
* 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
* ```
*/
public class Snapshot internal constructor(
override val javaResource: com.pulumi.azure.compute.Snapshot,
) : KotlinCustomResource(javaResource, SnapshotMapper) {
/**
* 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.
*/
public val createOption: Output
get() = javaResource.createOption().applyValue({ args0 -> args0 })
/**
* The size of the Snapshotted Disk in GB.
*/
public val diskSizeGb: Output
get() = javaResource.diskSizeGb().applyValue({ args0 -> args0 })
/**
* A `encryption_settings` block as defined below.
* > **NOTE:** Removing `encryption_settings` forces a new resource to be created.
*/
public val encryptionSettings: Output?
get() = javaResource.encryptionSettings().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> toKotlin(args0) })
}).orElse(null)
})
/**
* Specifies if the Snapshot is incremental. Changing this forces a new resource to be created.
*/
public val incrementalEnabled: Output?
get() = javaResource.incrementalEnabled().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* Specifies the name of the Snapshot resource. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Policy for accessing the disk via network. Possible values are `AllowAll`, `AllowPrivate`, or `DenyAll`. Defaults to `AllowAll`.
*/
public val networkAccessPolicy: Output?
get() = javaResource.networkAccessPolicy().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Policy for controlling export on the disk. Possible values are `true` or `false`. Defaults to `true`.
*/
public val publicNetworkAccessEnabled: Output?
get() = javaResource.publicNetworkAccessEnabled().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* Specifies a reference to an existing snapshot, when `create_option` is `Copy`. Changing this forces a new resource to be created.
*/
public val sourceResourceId: Output?
get() = javaResource.sourceResourceId().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.
*/
public val sourceUri: Output?
get() = javaResource.sourceUri().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* 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.
*/
public val storageAccountId: Output?
get() = javaResource.storageAccountId().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* A mapping of tags to assign to the resource.
*/
public val tags: Output
© 2015 - 2025 Weber Informatics LLC | Privacy Policy