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

com.pulumi.azure.hpc.kotlin.Cache.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.14.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.hpc.kotlin

import com.pulumi.azure.hpc.kotlin.outputs.CacheDefaultAccessPolicy
import com.pulumi.azure.hpc.kotlin.outputs.CacheDirectoryActiveDirectory
import com.pulumi.azure.hpc.kotlin.outputs.CacheDirectoryFlatFile
import com.pulumi.azure.hpc.kotlin.outputs.CacheDirectoryLdap
import com.pulumi.azure.hpc.kotlin.outputs.CacheDns
import com.pulumi.azure.hpc.kotlin.outputs.CacheIdentity
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.List
import kotlin.collections.Map
import com.pulumi.azure.hpc.kotlin.outputs.CacheDefaultAccessPolicy.Companion.toKotlin as cacheDefaultAccessPolicyToKotlin
import com.pulumi.azure.hpc.kotlin.outputs.CacheDirectoryActiveDirectory.Companion.toKotlin as cacheDirectoryActiveDirectoryToKotlin
import com.pulumi.azure.hpc.kotlin.outputs.CacheDirectoryFlatFile.Companion.toKotlin as cacheDirectoryFlatFileToKotlin
import com.pulumi.azure.hpc.kotlin.outputs.CacheDirectoryLdap.Companion.toKotlin as cacheDirectoryLdapToKotlin
import com.pulumi.azure.hpc.kotlin.outputs.CacheDns.Companion.toKotlin as cacheDnsToKotlin
import com.pulumi.azure.hpc.kotlin.outputs.CacheIdentity.Companion.toKotlin as cacheIdentityToKotlin

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

    public var args: CacheArgs = CacheArgs()

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

/**
 * Manages a HPC Cache.
 * > **Note:** By request of the service team the provider no longer automatically registering the `Microsoft.StorageCache` Resource Provider for this resource. To register it you can run `az provider register --namespace 'Microsoft.StorageCache'`.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "examplevn",
 *     addressSpaces: ["10.0.0.0/16"],
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "examplesubnet",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.0.1.0/24"],
 * });
 * const exampleCache = new azure.hpc.Cache("example", {
 *     name: "examplehpccache",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     cacheSizeInGb: 3072,
 *     subnetId: exampleSubnet.id,
 *     skuName: "Standard_2G",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_virtual_network = azure.network.VirtualNetwork("example",
 *     name="examplevn",
 *     address_spaces=["10.0.0.0/16"],
 *     location=example.location,
 *     resource_group_name=example.name)
 * example_subnet = azure.network.Subnet("example",
 *     name="examplesubnet",
 *     resource_group_name=example.name,
 *     virtual_network_name=example_virtual_network.name,
 *     address_prefixes=["10.0.1.0/24"])
 * example_cache = azure.hpc.Cache("example",
 *     name="examplehpccache",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     cache_size_in_gb=3072,
 *     subnet_id=example_subnet.id,
 *     sku_name="Standard_2G")
 * ```
 * ```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 = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
 *     {
 *         Name = "examplevn",
 *         AddressSpaces = new[]
 *         {
 *             "10.0.0.0/16",
 *         },
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *     });
 *     var exampleSubnet = new Azure.Network.Subnet("example", new()
 *     {
 *         Name = "examplesubnet",
 *         ResourceGroupName = example.Name,
 *         VirtualNetworkName = exampleVirtualNetwork.Name,
 *         AddressPrefixes = new[]
 *         {
 *             "10.0.1.0/24",
 *         },
 *     });
 *     var exampleCache = new Azure.Hpc.Cache("example", new()
 *     {
 *         Name = "examplehpccache",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         CacheSizeInGb = 3072,
 *         SubnetId = exampleSubnet.Id,
 *         SkuName = "Standard_2G",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/hpc"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
 * 	"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("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
 * 			Name: pulumi.String("examplevn"),
 * 			AddressSpaces: pulumi.StringArray{
 * 				pulumi.String("10.0.0.0/16"),
 * 			},
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
 * 			Name:               pulumi.String("examplesubnet"),
 * 			ResourceGroupName:  example.Name,
 * 			VirtualNetworkName: exampleVirtualNetwork.Name,
 * 			AddressPrefixes: pulumi.StringArray{
 * 				pulumi.String("10.0.1.0/24"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = hpc.NewCache(ctx, "example", &hpc.CacheArgs{
 * 			Name:              pulumi.String("examplehpccache"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			CacheSizeInGb:     pulumi.Int(3072),
 * 			SubnetId:          exampleSubnet.ID(),
 * 			SkuName:           pulumi.String("Standard_2G"),
 * 		})
 * 		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.network.VirtualNetwork;
 * import com.pulumi.azure.network.VirtualNetworkArgs;
 * import com.pulumi.azure.network.Subnet;
 * import com.pulumi.azure.network.SubnetArgs;
 * import com.pulumi.azure.hpc.Cache;
 * import com.pulumi.azure.hpc.CacheArgs;
 * 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("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
 *             .name("examplevn")
 *             .addressSpaces("10.0.0.0/16")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .build());
 *         var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
 *             .name("examplesubnet")
 *             .resourceGroupName(example.name())
 *             .virtualNetworkName(exampleVirtualNetwork.name())
 *             .addressPrefixes("10.0.1.0/24")
 *             .build());
 *         var exampleCache = new Cache("exampleCache", CacheArgs.builder()
 *             .name("examplehpccache")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .cacheSizeInGb(3072)
 *             .subnetId(exampleSubnet.id())
 *             .skuName("Standard_2G")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleVirtualNetwork:
 *     type: azure:network:VirtualNetwork
 *     name: example
 *     properties:
 *       name: examplevn
 *       addressSpaces:
 *         - 10.0.0.0/16
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *   exampleSubnet:
 *     type: azure:network:Subnet
 *     name: example
 *     properties:
 *       name: examplesubnet
 *       resourceGroupName: ${example.name}
 *       virtualNetworkName: ${exampleVirtualNetwork.name}
 *       addressPrefixes:
 *         - 10.0.1.0/24
 *   exampleCache:
 *     type: azure:hpc:Cache
 *     name: example
 *     properties:
 *       name: examplehpccache
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       cacheSizeInGb: 3072
 *       subnetId: ${exampleSubnet.id}
 *       skuName: Standard_2G
 * ```
 * 
 * ## Import
 * HPC Caches can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:hpc/cache:Cache example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.StorageCache/caches/cacheName
 * ```
 */
public class Cache internal constructor(
    override val javaResource: com.pulumi.azure.hpc.Cache,
) : KotlinCustomResource(javaResource, CacheMapper) {
    /**
     * Specifies whether the HPC Cache automatically rotates Encryption Key to the latest version.
     */
    public val automaticallyRotateKeyToLatestEnabled: Output?
        get() = javaResource.automaticallyRotateKeyToLatestEnabled().applyValue({ args0 ->
            args0.map({ args0 -> args0 }).orElse(null)
        })

    /**
     * The size of the HPC Cache, in GB. Possible values are `3072`, `6144`, `12288`, `21623`, `24576`, `43246`, `49152` and `86491`. Changing this forces a new resource to be created.
     * > **NOTE:** The `21623`, `43246` and `86491` sizes are restricted to read only resources.
     */
    public val cacheSizeInGb: Output
        get() = javaResource.cacheSizeInGb().applyValue({ args0 -> args0 })

    /**
     * A `default_access_policy` block as defined below.
     */
    public val defaultAccessPolicy: Output
        get() = javaResource.defaultAccessPolicy().applyValue({ args0 ->
            args0.let({ args0 ->
                cacheDefaultAccessPolicyToKotlin(args0)
            })
        })

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

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

    /**
     * A `directory_ldap` block as defined below.
     * > **Note:** Only one of `directory_active_directory`, `directory_flat_file` and `directory_ldap` can be set.
     */
    public val directoryLdap: Output?
        get() = javaResource.directoryLdap().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> cacheDirectoryLdapToKotlin(args0) })
            }).orElse(null)
        })

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

    /**
     * An `identity` block as defined below. Changing this forces a new resource to be created.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    cacheIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The ID of the Key Vault Key which should be used to encrypt the data in this HPC Cache.
     */
    public val keyVaultKeyId: Output?
        get() = javaResource.keyVaultKeyId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the supported Azure Region where the HPC Cache should be created. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * A list of IP Addresses where the HPC Cache can be mounted.
     */
    public val mountAddresses: Output>
        get() = javaResource.mountAddresses().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * The IPv4 maximum transmission unit configured for the subnet of the HPC Cache. Possible values range from 576 - 1500. Defaults to `1500`.
     */
    public val mtu: Output?
        get() = javaResource.mtu().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name of the HPC Cache. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The NTP server IP Address or FQDN for the HPC Cache. Defaults to `time.windows.com`.
     */
    public val ntpServer: Output?
        get() = javaResource.ntpServer().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name of the Resource Group in which to create the HPC Cache. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * The SKU of HPC Cache to use. Possible values are (ReadWrite) - `Standard_2G`, `Standard_4G` `Standard_8G` or (ReadOnly) - `Standard_L4_5G`, `Standard_L9G`, and `Standard_L16G`. Changing this forces a new resource to be created.
     * > **NOTE:** The read-only SKUs have restricted cache sizes. `Standard_L4_5G` must be set to `21623`. `Standard_L9G` to `43246` and `Standard_L16G` to `86491`.
     */
    public val skuName: Output
        get() = javaResource.skuName().applyValue({ args0 -> args0 })

    /**
     * The ID of the Subnet for the HPC Cache. Changing this forces a new resource to be created.
     */
    public val subnetId: Output
        get() = javaResource.subnetId().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags to assign to the HPC Cache.
     */
    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 CacheMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.hpc.Cache::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy