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.ShareFile.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.storage.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
/**
* Builder for [ShareFile].
*/
@PulumiTagMarker
public class ShareFileResourceBuilder internal constructor() {
public var name: String? = null
public var args: ShareFileArgs = ShareFileArgs()
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 ShareFileArgsBuilder.() -> Unit) {
val builder = ShareFileArgsBuilder()
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(): ShareFile {
val builtJavaResource = com.pulumi.azure.storage.ShareFile(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ShareFile(builtJavaResource)
}
}
/**
* ## 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 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,
* });
* const exampleShareFile = new azure.storage.ShareFile("example", {
* name: "my-awesome-content.zip",
* storageShareId: exampleShare.id,
* source: "some-local-file.zip",
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-resources",
* 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)
* example_share_file = azure.storage.ShareFile("example",
* name="my-awesome-content.zip",
* storage_share_id=example_share.id,
* source="some-local-file.zip")
* ```
* ```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 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,
* });
* var exampleShareFile = new Azure.Storage.ShareFile("example", new()
* {
* Name = "my-awesome-content.zip",
* StorageShareId = exampleShare.Id,
* Source = "some-local-file.zip",
* });
* });
* ```
* ```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("example-resources"),
* 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
* }
* exampleShare, err := storage.NewShare(ctx, "example", &storage.ShareArgs{
* Name: pulumi.String("sharename"),
* StorageAccountName: exampleAccount.Name,
* Quota: pulumi.Int(50),
* })
* if err != nil {
* return err
* }
* _, err = storage.NewShareFile(ctx, "example", &storage.ShareFileArgs{
* Name: pulumi.String("my-awesome-content.zip"),
* StorageShareId: exampleShare.ID(),
* Source: pulumi.String("some-local-file.zip"),
* })
* 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.ShareFile;
* import com.pulumi.azure.storage.ShareFileArgs;
* 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 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)
* .build());
* var exampleShareFile = new ShareFile("exampleShareFile", ShareFileArgs.builder()
* .name("my-awesome-content.zip")
* .storageShareId(exampleShare.id())
* .source("some-local-file.zip")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-resources
* 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
* exampleShareFile:
* type: azure:storage:ShareFile
* name: example
* properties:
* name: my-awesome-content.zip
* storageShareId: ${exampleShare.id}
* source: some-local-file.zip
* ```
*
* ## Import
* Directories within an Azure Storage File Share can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:storage/shareFile:ShareFile example https://account1.file.core.windows.net/share1/file1
* ```
*/
public class ShareFile internal constructor(
override val javaResource: com.pulumi.azure.storage.ShareFile,
) : KotlinCustomResource(javaResource, ShareFileMapper) {
/**
* Sets the file’s Content-Disposition header.
*/
public val contentDisposition: Output?
get() = javaResource.contentDisposition().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Specifies which content encodings have been applied to the file.
*/
public val contentEncoding: Output?
get() = javaResource.contentEncoding().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The length in bytes of the file content
*/
public val contentLength: Output
get() = javaResource.contentLength().applyValue({ args0 -> args0 })
public val contentMd5: Output?
get() = javaResource.contentMd5().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The content type of the share file. Defaults to `application/octet-stream`.
*/
public val contentType: Output?
get() = javaResource.contentType().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* A mapping of metadata to assign to this file.
*/
public val metadata: Output>?
get() = javaResource.metadata().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
}).orElse(null)
})
/**
* The name (or path) of the File that should be created within this File Share. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The storage share directory that you would like the file placed into. Changing this forces a new resource to be created. Defaults to `""`.
*/
public val path: Output?
get() = javaResource.path().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* An absolute path to a file on the local system. Changing this forces a new resource to be created.
* > **Note** The file specified with `source` can not be empty.
*/
public val source: Output?
get() = javaResource.source().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The Storage Share ID in which this file will be placed into. Changing this forces a new resource to be created.
*/
public val storageShareId: Output
get() = javaResource.storageShareId().applyValue({ args0 -> args0 })
}
public object ShareFileMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.storage.ShareFile::class == javaResource::class
override fun map(javaResource: Resource): ShareFile = ShareFile(
javaResource as
com.pulumi.azure.storage.ShareFile,
)
}
/**
* @see [ShareFile].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [ShareFile].
*/
public suspend fun shareFile(name: String, block: suspend ShareFileResourceBuilder.() -> Unit): ShareFile {
val builder = ShareFileResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [ShareFile].
* @param name The _unique_ name of the resulting resource.
*/
public fun shareFile(name: String): ShareFile {
val builder = ShareFileResourceBuilder()
builder.name(name)
return builder.build()
}