Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.azure.hpc.kotlin.CacheBlobTarget.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.hpc.kotlin
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
/**
* Builder for [CacheBlobTarget].
*/
@PulumiTagMarker
public class CacheBlobTargetResourceBuilder internal constructor() {
public var name: String? = null
public var args: CacheBlobTargetArgs = CacheBlobTargetArgs()
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 CacheBlobTargetArgsBuilder.() -> Unit) {
val builder = CacheBlobTargetArgsBuilder()
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(): CacheBlobTarget {
val builtJavaResource = com.pulumi.azure.hpc.CacheBlobTarget(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return CacheBlobTarget(builtJavaResource)
}
}
/**
* Manages a Blob Target within 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";
* import * as azuread from "@pulumi/azuread";
* const exampleResourceGroup = 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: exampleResourceGroup.location,
* resourceGroupName: exampleResourceGroup.name,
* });
* const exampleSubnet = new azure.network.Subnet("example", {
* name: "examplesubnet",
* resourceGroupName: exampleResourceGroup.name,
* virtualNetworkName: exampleVirtualNetwork.name,
* addressPrefixes: ["10.0.1.0/24"],
* });
* const exampleCache = new azure.hpc.Cache("example", {
* name: "examplehpccache",
* resourceGroupName: exampleResourceGroup.name,
* location: exampleResourceGroup.location,
* cacheSizeInGb: 3072,
* subnetId: exampleSubnet.id,
* skuName: "Standard_2G",
* });
* const exampleAccount = new azure.storage.Account("example", {
* name: "examplestorgaccount",
* resourceGroupName: exampleResourceGroup.name,
* location: exampleResourceGroup.location,
* accountTier: "Standard",
* accountReplicationType: "LRS",
* });
* const exampleContainer = new azure.storage.Container("example", {
* name: "examplestoragecontainer",
* storageAccountName: exampleAccount.name,
* });
* const example = azuread.getServicePrincipal({
* displayName: "HPC Cache Resource Provider",
* });
* const exampleStorageAccountContrib = new azure.authorization.Assignment("example_storage_account_contrib", {
* scope: exampleAccount.id,
* roleDefinitionName: "Storage Account Contributor",
* principalId: example.then(example => example.objectId),
* });
* const exampleStorageBlobDataContrib = new azure.authorization.Assignment("example_storage_blob_data_contrib", {
* scope: exampleAccount.id,
* roleDefinitionName: "Storage Blob Data Contributor",
* principalId: example.then(example => example.objectId),
* });
* const exampleCacheBlobTarget = new azure.hpc.CacheBlobTarget("example", {
* name: "examplehpccblobtarget",
* resourceGroupName: exampleResourceGroup.name,
* cacheName: exampleCache.name,
* storageContainerId: exampleContainer.resourceManagerId,
* namespacePath: "/blob_storage",
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* import pulumi_azuread as azuread
* example_resource_group = 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_resource_group.location,
* resource_group_name=example_resource_group.name)
* example_subnet = azure.network.Subnet("example",
* name="examplesubnet",
* resource_group_name=example_resource_group.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_resource_group.name,
* location=example_resource_group.location,
* cache_size_in_gb=3072,
* subnet_id=example_subnet.id,
* sku_name="Standard_2G")
* example_account = azure.storage.Account("example",
* name="examplestorgaccount",
* resource_group_name=example_resource_group.name,
* location=example_resource_group.location,
* account_tier="Standard",
* account_replication_type="LRS")
* example_container = azure.storage.Container("example",
* name="examplestoragecontainer",
* storage_account_name=example_account.name)
* example = azuread.get_service_principal(display_name="HPC Cache Resource Provider")
* example_storage_account_contrib = azure.authorization.Assignment("example_storage_account_contrib",
* scope=example_account.id,
* role_definition_name="Storage Account Contributor",
* principal_id=example.object_id)
* example_storage_blob_data_contrib = azure.authorization.Assignment("example_storage_blob_data_contrib",
* scope=example_account.id,
* role_definition_name="Storage Blob Data Contributor",
* principal_id=example.object_id)
* example_cache_blob_target = azure.hpc.CacheBlobTarget("example",
* name="examplehpccblobtarget",
* resource_group_name=example_resource_group.name,
* cache_name=example_cache.name,
* storage_container_id=example_container.resource_manager_id,
* namespace_path="/blob_storage")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* using AzureAD = Pulumi.AzureAD;
* return await Deployment.RunAsync(() =>
* {
* var exampleResourceGroup = 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 = exampleResourceGroup.Location,
* ResourceGroupName = exampleResourceGroup.Name,
* });
* var exampleSubnet = new Azure.Network.Subnet("example", new()
* {
* Name = "examplesubnet",
* ResourceGroupName = exampleResourceGroup.Name,
* VirtualNetworkName = exampleVirtualNetwork.Name,
* AddressPrefixes = new[]
* {
* "10.0.1.0/24",
* },
* });
* var exampleCache = new Azure.Hpc.Cache("example", new()
* {
* Name = "examplehpccache",
* ResourceGroupName = exampleResourceGroup.Name,
* Location = exampleResourceGroup.Location,
* CacheSizeInGb = 3072,
* SubnetId = exampleSubnet.Id,
* SkuName = "Standard_2G",
* });
* var exampleAccount = new Azure.Storage.Account("example", new()
* {
* Name = "examplestorgaccount",
* ResourceGroupName = exampleResourceGroup.Name,
* Location = exampleResourceGroup.Location,
* AccountTier = "Standard",
* AccountReplicationType = "LRS",
* });
* var exampleContainer = new Azure.Storage.Container("example", new()
* {
* Name = "examplestoragecontainer",
* StorageAccountName = exampleAccount.Name,
* });
* var example = AzureAD.GetServicePrincipal.Invoke(new()
* {
* DisplayName = "HPC Cache Resource Provider",
* });
* var exampleStorageAccountContrib = new Azure.Authorization.Assignment("example_storage_account_contrib", new()
* {
* Scope = exampleAccount.Id,
* RoleDefinitionName = "Storage Account Contributor",
* PrincipalId = example.Apply(getServicePrincipalResult => getServicePrincipalResult.ObjectId),
* });
* var exampleStorageBlobDataContrib = new Azure.Authorization.Assignment("example_storage_blob_data_contrib", new()
* {
* Scope = exampleAccount.Id,
* RoleDefinitionName = "Storage Blob Data Contributor",
* PrincipalId = example.Apply(getServicePrincipalResult => getServicePrincipalResult.ObjectId),
* });
* var exampleCacheBlobTarget = new Azure.Hpc.CacheBlobTarget("example", new()
* {
* Name = "examplehpccblobtarget",
* ResourceGroupName = exampleResourceGroup.Name,
* CacheName = exampleCache.Name,
* StorageContainerId = exampleContainer.ResourceManagerId,
* NamespacePath = "/blob_storage",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
* "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-azure/sdk/v5/go/azure/storage"
* "github.com/pulumi/pulumi-azuread/sdk/v5/go/azuread"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* exampleResourceGroup, 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: exampleResourceGroup.Location,
* ResourceGroupName: exampleResourceGroup.Name,
* })
* if err != nil {
* return err
* }
* exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
* Name: pulumi.String("examplesubnet"),
* ResourceGroupName: exampleResourceGroup.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: exampleResourceGroup.Name,
* Location: exampleResourceGroup.Location,
* CacheSizeInGb: pulumi.Int(3072),
* SubnetId: exampleSubnet.ID(),
* SkuName: pulumi.String("Standard_2G"),
* })
* if err != nil {
* return err
* }
* exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
* Name: pulumi.String("examplestorgaccount"),
* ResourceGroupName: exampleResourceGroup.Name,
* Location: exampleResourceGroup.Location,
* AccountTier: pulumi.String("Standard"),
* AccountReplicationType: pulumi.String("LRS"),
* })
* if err != nil {
* return err
* }
* exampleContainer, err := storage.NewContainer(ctx, "example", &storage.ContainerArgs{
* Name: pulumi.String("examplestoragecontainer"),
* StorageAccountName: exampleAccount.Name,
* })
* if err != nil {
* return err
* }
* example, err := azuread.LookupServicePrincipal(ctx, &azuread.LookupServicePrincipalArgs{
* DisplayName: pulumi.StringRef("HPC Cache Resource Provider"),
* }, nil)
* if err != nil {
* return err
* }
* _, err = authorization.NewAssignment(ctx, "example_storage_account_contrib", &authorization.AssignmentArgs{
* Scope: exampleAccount.ID(),
* RoleDefinitionName: pulumi.String("Storage Account Contributor"),
* PrincipalId: pulumi.String(example.ObjectId),
* })
* if err != nil {
* return err
* }
* _, err = authorization.NewAssignment(ctx, "example_storage_blob_data_contrib", &authorization.AssignmentArgs{
* Scope: exampleAccount.ID(),
* RoleDefinitionName: pulumi.String("Storage Blob Data Contributor"),
* PrincipalId: pulumi.String(example.ObjectId),
* })
* if err != nil {
* return err
* }
* _, err = hpc.NewCacheBlobTarget(ctx, "example", &hpc.CacheBlobTargetArgs{
* Name: pulumi.String("examplehpccblobtarget"),
* ResourceGroupName: exampleResourceGroup.Name,
* CacheName: exampleCache.Name,
* StorageContainerId: exampleContainer.ResourceManagerId,
* NamespacePath: pulumi.String("/blob_storage"),
* })
* 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.storage.Account;
* import com.pulumi.azure.storage.AccountArgs;
* import com.pulumi.azure.storage.Container;
* import com.pulumi.azure.storage.ContainerArgs;
* import com.pulumi.azuread.AzureadFunctions;
* import com.pulumi.azuread.inputs.GetServicePrincipalArgs;
* import com.pulumi.azure.authorization.Assignment;
* import com.pulumi.azure.authorization.AssignmentArgs;
* import com.pulumi.azure.hpc.CacheBlobTarget;
* import com.pulumi.azure.hpc.CacheBlobTargetArgs;
* 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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", 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(exampleResourceGroup.location())
* .resourceGroupName(exampleResourceGroup.name())
* .build());
* var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
* .name("examplesubnet")
* .resourceGroupName(exampleResourceGroup.name())
* .virtualNetworkName(exampleVirtualNetwork.name())
* .addressPrefixes("10.0.1.0/24")
* .build());
* var exampleCache = new Cache("exampleCache", CacheArgs.builder()
* .name("examplehpccache")
* .resourceGroupName(exampleResourceGroup.name())
* .location(exampleResourceGroup.location())
* .cacheSizeInGb(3072)
* .subnetId(exampleSubnet.id())
* .skuName("Standard_2G")
* .build());
* var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
* .name("examplestorgaccount")
* .resourceGroupName(exampleResourceGroup.name())
* .location(exampleResourceGroup.location())
* .accountTier("Standard")
* .accountReplicationType("LRS")
* .build());
* var exampleContainer = new Container("exampleContainer", ContainerArgs.builder()
* .name("examplestoragecontainer")
* .storageAccountName(exampleAccount.name())
* .build());
* final var example = AzureadFunctions.getServicePrincipal(GetServicePrincipalArgs.builder()
* .displayName("HPC Cache Resource Provider")
* .build());
* var exampleStorageAccountContrib = new Assignment("exampleStorageAccountContrib", AssignmentArgs.builder()
* .scope(exampleAccount.id())
* .roleDefinitionName("Storage Account Contributor")
* .principalId(example.applyValue(getServicePrincipalResult -> getServicePrincipalResult.objectId()))
* .build());
* var exampleStorageBlobDataContrib = new Assignment("exampleStorageBlobDataContrib", AssignmentArgs.builder()
* .scope(exampleAccount.id())
* .roleDefinitionName("Storage Blob Data Contributor")
* .principalId(example.applyValue(getServicePrincipalResult -> getServicePrincipalResult.objectId()))
* .build());
* var exampleCacheBlobTarget = new CacheBlobTarget("exampleCacheBlobTarget", CacheBlobTargetArgs.builder()
* .name("examplehpccblobtarget")
* .resourceGroupName(exampleResourceGroup.name())
* .cacheName(exampleCache.name())
* .storageContainerId(exampleContainer.resourceManagerId())
* .namespacePath("/blob_storage")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* exampleResourceGroup:
* type: azure:core:ResourceGroup
* name: example
* properties:
* name: example-resources
* location: West Europe
* exampleVirtualNetwork:
* type: azure:network:VirtualNetwork
* name: example
* properties:
* name: examplevn
* addressSpaces:
* - 10.0.0.0/16
* location: ${exampleResourceGroup.location}
* resourceGroupName: ${exampleResourceGroup.name}
* exampleSubnet:
* type: azure:network:Subnet
* name: example
* properties:
* name: examplesubnet
* resourceGroupName: ${exampleResourceGroup.name}
* virtualNetworkName: ${exampleVirtualNetwork.name}
* addressPrefixes:
* - 10.0.1.0/24
* exampleCache:
* type: azure:hpc:Cache
* name: example
* properties:
* name: examplehpccache
* resourceGroupName: ${exampleResourceGroup.name}
* location: ${exampleResourceGroup.location}
* cacheSizeInGb: 3072
* subnetId: ${exampleSubnet.id}
* skuName: Standard_2G
* exampleAccount:
* type: azure:storage:Account
* name: example
* properties:
* name: examplestorgaccount
* resourceGroupName: ${exampleResourceGroup.name}
* location: ${exampleResourceGroup.location}
* accountTier: Standard
* accountReplicationType: LRS
* exampleContainer:
* type: azure:storage:Container
* name: example
* properties:
* name: examplestoragecontainer
* storageAccountName: ${exampleAccount.name}
* exampleStorageAccountContrib:
* type: azure:authorization:Assignment
* name: example_storage_account_contrib
* properties:
* scope: ${exampleAccount.id}
* roleDefinitionName: Storage Account Contributor
* principalId: ${example.objectId}
* exampleStorageBlobDataContrib:
* type: azure:authorization:Assignment
* name: example_storage_blob_data_contrib
* properties:
* scope: ${exampleAccount.id}
* roleDefinitionName: Storage Blob Data Contributor
* principalId: ${example.objectId}
* exampleCacheBlobTarget:
* type: azure:hpc:CacheBlobTarget
* name: example
* properties:
* name: examplehpccblobtarget
* resourceGroupName: ${exampleResourceGroup.name}
* cacheName: ${exampleCache.name}
* storageContainerId: ${exampleContainer.resourceManagerId}
* namespacePath: /blob_storage
* variables:
* example:
* fn::invoke:
* Function: azuread:getServicePrincipal
* Arguments:
* displayName: HPC Cache Resource Provider
* ```
*
* ## Import
* Blob Targets within an HPC Cache can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:hpc/cacheBlobTarget:CacheBlobTarget example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.StorageCache/caches/cache1/storageTargets/target1
* ```
*/
public class CacheBlobTarget internal constructor(
override val javaResource: com.pulumi.azure.hpc.CacheBlobTarget,
) : KotlinCustomResource(javaResource, CacheBlobTargetMapper) {
/**
* The name of the access policy applied to this target. Defaults to `default`.
*/
public val accessPolicyName: Output?
get() = javaResource.accessPolicyName().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The name HPC Cache, which the HPC Cache Blob Target will be added to. Changing this forces a new resource to be created.
*/
public val cacheName: Output
get() = javaResource.cacheName().applyValue({ args0 -> args0 })
/**
* The name of the HPC Cache Blob Target. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The client-facing file path of the HPC Cache Blob Target.
*/
public val namespacePath: Output
get() = javaResource.namespacePath().applyValue({ args0 -> args0 })
/**
* The name of the Resource Group in which to create the HPC Cache Blob Target. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* The Resource Manager ID of the Storage Container used as the HPC Cache Blob Target. Changing this forces a new resource to be created.
* > **Note:** This is the Resource Manager ID of the Storage Container, rather than the regular ID - and can be accessed on the `azure.storage.Container` Data Source/Resource as `resource_manager_id`.
*/
public val storageContainerId: Output
get() = javaResource.storageContainerId().applyValue({ args0 -> args0 })
}
public object CacheBlobTargetMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.hpc.CacheBlobTarget::class == javaResource::class
override fun map(javaResource: Resource): CacheBlobTarget = CacheBlobTarget(
javaResource as
com.pulumi.azure.hpc.CacheBlobTarget,
)
}
/**
* @see [CacheBlobTarget].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [CacheBlobTarget].
*/
public suspend fun cacheBlobTarget(
name: String,
block: suspend CacheBlobTargetResourceBuilder.() -> Unit,
): CacheBlobTarget {
val builder = CacheBlobTargetResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [CacheBlobTarget].
* @param name The _unique_ name of the resulting resource.
*/
public fun cacheBlobTarget(name: String): CacheBlobTarget {
val builder = CacheBlobTargetResourceBuilder()
builder.name(name)
return builder.build()
}