com.pulumi.azure.hpc.kotlin.CacheAccessPolicy.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.hpc.kotlin
import com.pulumi.azure.hpc.kotlin.outputs.CacheAccessPolicyAccessRule
import com.pulumi.azure.hpc.kotlin.outputs.CacheAccessPolicyAccessRule.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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
/**
* Builder for [CacheAccessPolicy].
*/
@PulumiTagMarker
public class CacheAccessPolicyResourceBuilder internal constructor() {
public var name: String? = null
public var args: CacheAccessPolicyArgs = CacheAccessPolicyArgs()
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 CacheAccessPolicyArgsBuilder.() -> Unit) {
val builder = CacheAccessPolicyArgsBuilder()
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(): CacheAccessPolicy {
val builtJavaResource = com.pulumi.azure.hpc.CacheAccessPolicy(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return CacheAccessPolicy(builtJavaResource)
}
}
/**
* 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=[azure.hpc.CacheAccessPolicyAccessRuleArgs(
* 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
* ```
*/
public class CacheAccessPolicy internal constructor(
override val javaResource: com.pulumi.azure.hpc.CacheAccessPolicy,
) : KotlinCustomResource(javaResource, CacheAccessPolicyMapper) {
/**
* One or more `access_rule` blocks (up to three) as defined below.
*/
public val accessRules: Output>
get() = javaResource.accessRules().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
toKotlin(args0)
})
})
})
/**
* 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.
*/
public val hpcCacheId: Output
get() = javaResource.hpcCacheId().applyValue({ args0 -> args0 })
/**
* 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 val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
}
public object CacheAccessPolicyMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.hpc.CacheAccessPolicy::class == javaResource::class
override fun map(javaResource: Resource): CacheAccessPolicy = CacheAccessPolicy(
javaResource as
com.pulumi.azure.hpc.CacheAccessPolicy,
)
}
/**
* @see [CacheAccessPolicy].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [CacheAccessPolicy].
*/
public suspend fun cacheAccessPolicy(
name: String,
block: suspend CacheAccessPolicyResourceBuilder.() -> Unit,
): CacheAccessPolicy {
val builder = CacheAccessPolicyResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [CacheAccessPolicy].
* @param name The _unique_ name of the resulting resource.
*/
public fun cacheAccessPolicy(name: String): CacheAccessPolicy {
val builder = CacheAccessPolicyResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy