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.storage.kotlin.Share.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.storage.kotlin
import com.pulumi.azure.storage.kotlin.outputs.ShareAcl
import com.pulumi.azure.storage.kotlin.outputs.ShareAcl.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
/**
* Builder for [Share].
*/
@PulumiTagMarker
public class ShareResourceBuilder internal constructor() {
public var name: String? = null
public var args: ShareArgs = ShareArgs()
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 ShareArgsBuilder.() -> Unit) {
val builder = ShareArgsBuilder()
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(): Share {
val builtJavaResource = com.pulumi.azure.storage.Share(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Share(builtJavaResource)
}
}
/**
* Manages a File Share within Azure Storage.
* > **Note** The storage share supports two storage tiers: premium and standard. Standard file shares are created in general purpose (GPv1 or GPv2) storage accounts and premium file shares are created in FileStorage storage accounts. For further information, refer to the section "What storage tiers are supported in Azure Files?" of [documentation](https://docs.microsoft.com/azure/storage/files/storage-files-faq#general).
* > **Note on Authentication** Shared Key authentication will always be used for this resource, as AzureAD authentication is not supported by the Storage API for files.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "azuretest",
* location: "West Europe",
* });
* const exampleAccount = new azure.storage.Account("example", {
* name: "azureteststorage",
* resourceGroupName: example.name,
* location: example.location,
* accountTier: "Standard",
* accountReplicationType: "LRS",
* });
* const exampleShare = new azure.storage.Share("example", {
* name: "sharename",
* storageAccountName: exampleAccount.name,
* quota: 50,
* acls: [{
* id: "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI",
* accessPolicies: [{
* permissions: "rwdl",
* start: "2019-07-02T09:38:21.0000000Z",
* expiry: "2019-07-02T10:38:21.0000000Z",
* }],
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="azuretest",
* location="West Europe")
* example_account = azure.storage.Account("example",
* name="azureteststorage",
* resource_group_name=example.name,
* location=example.location,
* account_tier="Standard",
* account_replication_type="LRS")
* example_share = azure.storage.Share("example",
* name="sharename",
* storage_account_name=example_account.name,
* quota=50,
* acls=[{
* "id": "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI",
* "access_policies": [{
* "permissions": "rwdl",
* "start": "2019-07-02T09:38:21.0000000Z",
* "expiry": "2019-07-02T10:38:21.0000000Z",
* }],
* }])
* ```
* ```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 = "azuretest",
* Location = "West Europe",
* });
* var exampleAccount = new Azure.Storage.Account("example", new()
* {
* Name = "azureteststorage",
* ResourceGroupName = example.Name,
* Location = example.Location,
* AccountTier = "Standard",
* AccountReplicationType = "LRS",
* });
* var exampleShare = new Azure.Storage.Share("example", new()
* {
* Name = "sharename",
* StorageAccountName = exampleAccount.Name,
* Quota = 50,
* Acls = new[]
* {
* new Azure.Storage.Inputs.ShareAclArgs
* {
* Id = "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI",
* AccessPolicies = new[]
* {
* new Azure.Storage.Inputs.ShareAclAccessPolicyArgs
* {
* Permissions = "rwdl",
* Start = "2019-07-02T09:38:21.0000000Z",
* Expiry = "2019-07-02T10:38:21.0000000Z",
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
* "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("azuretest"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
* Name: pulumi.String("azureteststorage"),
* ResourceGroupName: example.Name,
* Location: example.Location,
* AccountTier: pulumi.String("Standard"),
* AccountReplicationType: pulumi.String("LRS"),
* })
* if err != nil {
* return err
* }
* _, err = storage.NewShare(ctx, "example", &storage.ShareArgs{
* Name: pulumi.String("sharename"),
* StorageAccountName: exampleAccount.Name,
* Quota: pulumi.Int(50),
* Acls: storage.ShareAclArray{
* &storage.ShareAclArgs{
* Id: pulumi.String("MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI"),
* AccessPolicies: storage.ShareAclAccessPolicyArray{
* &storage.ShareAclAccessPolicyArgs{
* Permissions: pulumi.String("rwdl"),
* Start: pulumi.String("2019-07-02T09:38:21.0000000Z"),
* Expiry: pulumi.String("2019-07-02T10:38:21.0000000Z"),
* },
* },
* },
* },
* })
* 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.storage.Account;
* import com.pulumi.azure.storage.AccountArgs;
* import com.pulumi.azure.storage.Share;
* import com.pulumi.azure.storage.ShareArgs;
* import com.pulumi.azure.storage.inputs.ShareAclArgs;
* 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("azuretest")
* .location("West Europe")
* .build());
* var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
* .name("azureteststorage")
* .resourceGroupName(example.name())
* .location(example.location())
* .accountTier("Standard")
* .accountReplicationType("LRS")
* .build());
* var exampleShare = new Share("exampleShare", ShareArgs.builder()
* .name("sharename")
* .storageAccountName(exampleAccount.name())
* .quota(50)
* .acls(ShareAclArgs.builder()
* .id("MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI")
* .accessPolicies(ShareAclAccessPolicyArgs.builder()
* .permissions("rwdl")
* .start("2019-07-02T09:38:21.0000000Z")
* .expiry("2019-07-02T10:38:21.0000000Z")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: azuretest
* location: West Europe
* exampleAccount:
* type: azure:storage:Account
* name: example
* properties:
* name: azureteststorage
* resourceGroupName: ${example.name}
* location: ${example.location}
* accountTier: Standard
* accountReplicationType: LRS
* exampleShare:
* type: azure:storage:Share
* name: example
* properties:
* name: sharename
* storageAccountName: ${exampleAccount.name}
* quota: 50
* acls:
* - id: MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI
* accessPolicies:
* - permissions: rwdl
* start: 2019-07-02T09:38:21.0000000Z
* expiry: 2019-07-02T10:38:21.0000000Z
* ```
*
* ## Import
* Storage Shares can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:storage/share:Share exampleShare https://account1.file.core.windows.net/share1
* ```
*/
public class Share internal constructor(
override val javaResource: com.pulumi.azure.storage.Share,
) : KotlinCustomResource(javaResource, ShareMapper) {
/**
* The access tier of the File Share. Possible values are `Hot`, `Cool` and `TransactionOptimized`, `Premium`.
* ~>**NOTE:** The `FileStorage` `account_kind` of the `azure.storage.Account` requires `Premium` `access_tier`.
*/
public val accessTier: Output
get() = javaResource.accessTier().applyValue({ args0 -> args0 })
/**
* One or more `acl` blocks as defined below.
*/
public val acls: Output>?
get() = javaResource.acls().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> toKotlin(args0) })
})
}).orElse(null)
})
/**
* The protocol used for the share. Possible values are `SMB` and `NFS`. The `SMB` indicates the share can be accessed by SMBv3.0, SMBv2.1 and REST. The `NFS` indicates the share can be accessed by NFSv4.1. Defaults to `SMB`. Changing this forces a new resource to be created.
* ~>**NOTE:** The `FileStorage` `account_kind` of the `azure.storage.Account` is required for the `NFS` protocol.
*/
public val enabledProtocol: Output?
get() = javaResource.enabledProtocol().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* A mapping of MetaData for this File Share.
*/
public val metadata: Output>
get() = javaResource.metadata().applyValue({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
})
/**
* The name of the share. Must be unique within the storage account where the share is located. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The maximum size of the share, in gigabytes.
* ~>**NOTE:** For Standard storage accounts, by default this must be `1` GB (or higher) and at most `5120` GB (`5` TB). This can be set to a value larger than `5120` GB if `large_file_share_enabled` is set to `true` in the parent `azure.storage.Account`.
* ~>**NOTE:** For Premium FileStorage storage accounts, this must be greater than `100` GB and at most `102400` GB (`100` TB).
*/
public val quota: Output
get() = javaResource.quota().applyValue({ args0 -> args0 })
/**
* The Resource Manager ID of this File Share.
*/
public val resourceManagerId: Output
get() = javaResource.resourceManagerId().applyValue({ args0 -> args0 })
/**
* Specifies the storage account in which to create the share. Changing this forces a new resource to be created.
*/
public val storageAccountName: Output
get() = javaResource.storageAccountName().applyValue({ args0 -> args0 })
/**
* The URL of the File Share
*/
public val url: Output
get() = javaResource.url().applyValue({ args0 -> args0 })
}
public object ShareMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.storage.Share::class == javaResource::class
override fun map(javaResource: Resource): Share = Share(
javaResource as
com.pulumi.azure.storage.Share,
)
}
/**
* @see [Share].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Share].
*/
public suspend fun share(name: String, block: suspend ShareResourceBuilder.() -> Unit): Share {
val builder = ShareResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Share].
* @param name The _unique_ name of the resulting resource.
*/
public fun share(name: String): Share {
val builder = ShareResourceBuilder()
builder.name(name)
return builder.build()
}