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

com.pulumi.azure.hpc.kotlin.CacheAccessPolicyArgs.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.hpc.kotlin

import com.pulumi.azure.hpc.CacheAccessPolicyArgs.builder
import com.pulumi.azure.hpc.kotlin.inputs.CacheAccessPolicyAccessRuleArgs
import com.pulumi.azure.hpc.kotlin.inputs.CacheAccessPolicyAccessRuleArgsBuilder
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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Manages a HPC Cache Access Policy.
 * ## 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",
 * });
 * const exampleCacheAccessPolicy = new azure.hpc.CacheAccessPolicy("example", {
 *     name: "example",
 *     hpcCacheId: exampleCache.id,
 *     accessRules: [{
 *         scope: "default",
 *         access: "rw",
 *     }],
 * });
 * ```
 * ```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")
 * example_cache_access_policy = azure.hpc.CacheAccessPolicy("example",
 *     name="example",
 *     hpc_cache_id=example_cache.id,
 *     access_rules=[{
 *         "scope": "default",
 *         "access": "rw",
 *     }])
 * ```
 * ```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",
 *     });
 *     var exampleCacheAccessPolicy = new Azure.Hpc.CacheAccessPolicy("example", new()
 *     {
 *         Name = "example",
 *         HpcCacheId = exampleCache.Id,
 *         AccessRules = new[]
 *         {
 *             new Azure.Hpc.Inputs.CacheAccessPolicyAccessRuleArgs
 *             {
 *                 Scope = "default",
 *                 Access = "rw",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```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
 * 		}
 * 		exampleCache, 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
 * 		}
 * 		_, err = hpc.NewCacheAccessPolicy(ctx, "example", &hpc.CacheAccessPolicyArgs{
 * 			Name:       pulumi.String("example"),
 * 			HpcCacheId: exampleCache.ID(),
 * 			AccessRules: hpc.CacheAccessPolicyAccessRuleArray{
 * 				&hpc.CacheAccessPolicyAccessRuleArgs{
 * 					Scope:  pulumi.String("default"),
 * 					Access: pulumi.String("rw"),
 * 				},
 * 			},
 * 		})
 * 		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 com.pulumi.azure.hpc.CacheAccessPolicy;
 * import com.pulumi.azure.hpc.CacheAccessPolicyArgs;
 * import com.pulumi.azure.hpc.inputs.CacheAccessPolicyAccessRuleArgs;
 * 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());
 *         var exampleCacheAccessPolicy = new CacheAccessPolicy("exampleCacheAccessPolicy", CacheAccessPolicyArgs.builder()
 *             .name("example")
 *             .hpcCacheId(exampleCache.id())
 *             .accessRules(CacheAccessPolicyAccessRuleArgs.builder()
 *                 .scope("default")
 *                 .access("rw")
 *                 .build())
 *             .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
 *   exampleCacheAccessPolicy:
 *     type: azure:hpc:CacheAccessPolicy
 *     name: example
 *     properties:
 *       name: example
 *       hpcCacheId: ${exampleCache.id}
 *       accessRules:
 *         - scope: default
 *           access: rw
 * ```
 * 
 * ## Import
 * HPC Cache Access Policies can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:hpc/cacheAccessPolicy:CacheAccessPolicy example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.StorageCache/caches/cache1/cacheAccessPolicies/policy1
 * ```
 * @property accessRules One or more `access_rule` blocks (up to three) as defined below.
 * @property hpcCacheId The ID of the HPC Cache that this HPC Cache Access Policy resides in. Changing this forces a new HPC Cache Access Policy to be created.
 * @property name The name which should be used for this HPC Cache Access Policy. Changing this forces a new HPC Cache Access Policy to be created.
 */
public data class CacheAccessPolicyArgs(
    public val accessRules: Output>? = null,
    public val hpcCacheId: Output? = null,
    public val name: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.hpc.CacheAccessPolicyArgs =
        com.pulumi.azure.hpc.CacheAccessPolicyArgs.builder()
            .accessRules(
                accessRules?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .hpcCacheId(hpcCacheId?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [CacheAccessPolicyArgs].
 */
@PulumiTagMarker
public class CacheAccessPolicyArgsBuilder internal constructor() {
    private var accessRules: Output>? = null

    private var hpcCacheId: Output? = null

    private var name: Output? = null

    /**
     * @param value One or more `access_rule` blocks (up to three) as defined below.
     */
    @JvmName("pouymgejluqgkytw")
    public suspend fun accessRules(`value`: Output>) {
        this.accessRules = value
    }

    @JvmName("xgeyjimdsielqixc")
    public suspend fun accessRules(vararg values: Output) {
        this.accessRules = Output.all(values.asList())
    }

    /**
     * @param values One or more `access_rule` blocks (up to three) as defined below.
     */
    @JvmName("koythjlbaiisbppl")
    public suspend fun accessRules(values: List>) {
        this.accessRules = Output.all(values)
    }

    /**
     * @param value The ID of the HPC Cache that this HPC Cache Access Policy resides in. Changing this forces a new HPC Cache Access Policy to be created.
     */
    @JvmName("lyxrulckltrbcjks")
    public suspend fun hpcCacheId(`value`: Output) {
        this.hpcCacheId = value
    }

    /**
     * @param value The name which should be used for this HPC Cache Access Policy. Changing this forces a new HPC Cache Access Policy to be created.
     */
    @JvmName("qrwbrmimpnmftppn")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value One or more `access_rule` blocks (up to three) as defined below.
     */
    @JvmName("vvgaxhcurrtwqagc")
    public suspend fun accessRules(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.accessRules = mapped
    }

    /**
     * @param argument One or more `access_rule` blocks (up to three) as defined below.
     */
    @JvmName("abpgmtjkjivlhjxs")
    public suspend fun accessRules(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            CacheAccessPolicyAccessRuleArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.accessRules = mapped
    }

    /**
     * @param argument One or more `access_rule` blocks (up to three) as defined below.
     */
    @JvmName("dfwuorexituhvpqo")
    public suspend fun accessRules(vararg argument: suspend CacheAccessPolicyAccessRuleArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            CacheAccessPolicyAccessRuleArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.accessRules = mapped
    }

    /**
     * @param argument One or more `access_rule` blocks (up to three) as defined below.
     */
    @JvmName("shtxffiucinuixmj")
    public suspend fun accessRules(argument: suspend CacheAccessPolicyAccessRuleArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            CacheAccessPolicyAccessRuleArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.accessRules = mapped
    }

    /**
     * @param values One or more `access_rule` blocks (up to three) as defined below.
     */
    @JvmName("xyqcvrumhyychlxf")
    public suspend fun accessRules(vararg values: CacheAccessPolicyAccessRuleArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.accessRules = mapped
    }

    /**
     * @param value The ID of the HPC Cache that this HPC Cache Access Policy resides in. Changing this forces a new HPC Cache Access Policy to be created.
     */
    @JvmName("kwtpxrlkmunvumdn")
    public suspend fun hpcCacheId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.hpcCacheId = mapped
    }

    /**
     * @param value The name which should be used for this HPC Cache Access Policy. Changing this forces a new HPC Cache Access Policy to be created.
     */
    @JvmName("dvefsvevrmupdglk")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    internal fun build(): CacheAccessPolicyArgs = CacheAccessPolicyArgs(
        accessRules = accessRules,
        hpcCacheId = hpcCacheId,
        name = name,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy