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

com.pulumi.azure.recoveryservices.kotlin.Vault.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.recoveryservices.kotlin

import com.pulumi.azure.recoveryservices.kotlin.outputs.VaultEncryption
import com.pulumi.azure.recoveryservices.kotlin.outputs.VaultIdentity
import com.pulumi.azure.recoveryservices.kotlin.outputs.VaultMonitoring
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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import com.pulumi.azure.recoveryservices.kotlin.outputs.VaultEncryption.Companion.toKotlin as vaultEncryptionToKotlin
import com.pulumi.azure.recoveryservices.kotlin.outputs.VaultIdentity.Companion.toKotlin as vaultIdentityToKotlin
import com.pulumi.azure.recoveryservices.kotlin.outputs.VaultMonitoring.Companion.toKotlin as vaultMonitoringToKotlin

/**
 * Builder for [Vault].
 */
@PulumiTagMarker
public class VaultResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: VaultArgs = VaultArgs()

    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 VaultArgsBuilder.() -> Unit) {
        val builder = VaultArgsBuilder()
        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(): Vault {
        val builtJavaResource = com.pulumi.azure.recoveryservices.Vault(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Vault(builtJavaResource)
    }
}

/**
 * Manages a Recovery Services Vault.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "tfex-recovery_vault",
 *     location: "West Europe",
 * });
 * const vault = new azure.recoveryservices.Vault("vault", {
 *     name: "example-recovery-vault",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     sku: "Standard",
 *     softDeleteEnabled: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="tfex-recovery_vault",
 *     location="West Europe")
 * vault = azure.recoveryservices.Vault("vault",
 *     name="example-recovery-vault",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku="Standard",
 *     soft_delete_enabled=True)
 * ```
 * ```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 = "tfex-recovery_vault",
 *         Location = "West Europe",
 *     });
 *     var vault = new Azure.RecoveryServices.Vault("vault", new()
 *     {
 *         Name = "example-recovery-vault",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Sku = "Standard",
 *         SoftDeleteEnabled = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/recoveryservices"
 * 	"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("tfex-recovery_vault"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = recoveryservices.NewVault(ctx, "vault", &recoveryservices.VaultArgs{
 * 			Name:              pulumi.String("example-recovery-vault"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Sku:               pulumi.String("Standard"),
 * 			SoftDeleteEnabled: pulumi.Bool(true),
 * 		})
 * 		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.recoveryservices.Vault;
 * import com.pulumi.azure.recoveryservices.VaultArgs;
 * 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("tfex-recovery_vault")
 *             .location("West Europe")
 *             .build());
 *         var vault = new Vault("vault", VaultArgs.builder()
 *             .name("example-recovery-vault")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .sku("Standard")
 *             .softDeleteEnabled(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: tfex-recovery_vault
 *       location: West Europe
 *   vault:
 *     type: azure:recoveryservices:Vault
 *     properties:
 *       name: example-recovery-vault
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       sku: Standard
 *       softDeleteEnabled: true
 * ```
 * 
 * ## Import
 * Recovery Services Vaults can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:recoveryservices/vault:Vault vault1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/vault1
 * ```
 */
public class Vault internal constructor(
    override val javaResource: com.pulumi.azure.recoveryservices.Vault,
) : KotlinCustomResource(javaResource, VaultMapper) {
    /**
     * Whether to enable the Classic experience for VMware replication. If set to `false` VMware machines will be protected using the new stateless ASR replication appliance. Changing this forces a new resource to be created.
     */
    public val classicVmwareReplicationEnabled: Output?
        get() = javaResource.classicVmwareReplicationEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Is cross region restore enabled for this Vault? Only can be `true`, when `storage_mode_type` is `GeoRedundant`. Defaults to `false`.
     * > **Note:** Once `cross_region_restore_enabled` is set to `true`, changing it back to `false` forces a new Recovery Service Vault to be created.
     */
    public val crossRegionRestoreEnabled: Output?
        get() = javaResource.crossRegionRestoreEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An `encryption` block as defined below. Required with `identity`.
     * !> **Note:** Once Encryption with your own key has been Enabled it's not possible to Disable it.
     */
    public val encryption: Output?
        get() = javaResource.encryption().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    vaultEncryptionToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    vaultIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Immutability Settings of vault, possible values include: `Locked`, `Unlocked` and `Disabled`.
     * > **Note:** Once `immutability` is set to `Locked`, changing it to other values forces a new Recovery Services Vault to be created.
     */
    public val immutability: Output
        get() = javaResource.immutability().applyValue({ args0 -> args0 })

    /**
     * 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 })

    /**
     * A `monitoring` block as defined below.
     */
    public val monitoring: Output?
        get() = javaResource.monitoring().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    vaultMonitoringToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Specifies the name of the Recovery Services Vault. Recovery Service Vault name must be 2 - 50 characters long, start with a letter, contain only letters, numbers and hyphens. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Is it enabled to access the vault from public networks. 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 Recovery Services Vault. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * Sets the vault's SKU. Possible values include: `Standard`, `RS0`.
     */
    public val sku: Output
        get() = javaResource.sku().applyValue({ args0 -> args0 })

    /**
     * Is soft delete enable for this Vault? Defaults to `true`.
     */
    public val softDeleteEnabled: Output?
        get() = javaResource.softDeleteEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The storage type of the Recovery Services Vault. Possible values are `GeoRedundant`, `LocallyRedundant` and `ZoneRedundant`. Defaults to `GeoRedundant`.
     */
    public val storageModeType: Output?
        get() = javaResource.storageModeType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A mapping of tags to assign to the resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })
}

public object VaultMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.recoveryservices.Vault::class == javaResource::class

    override fun map(javaResource: Resource): Vault = Vault(
        javaResource as
            com.pulumi.azure.recoveryservices.Vault,
    )
}

/**
 * @see [Vault].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Vault].
 */
public suspend fun vault(name: String, block: suspend VaultResourceBuilder.() -> Unit): Vault {
    val builder = VaultResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Vault].
 * @param name The _unique_ name of the resulting resource.
 */
public fun vault(name: String): Vault {
    val builder = VaultResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy