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

com.pulumi.azure.storage.kotlin.BlobArgs.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.storage.kotlin

import com.pulumi.asset.AssetOrArchive
import com.pulumi.azure.storage.BlobArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Int
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages a Blob within a Storage Container.
 * ## Example Usage
 * ```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.Container;
 * import com.pulumi.azure.storage.ContainerArgs;
 * import com.pulumi.azure.storage.Blob;
 * import com.pulumi.azure.storage.BlobArgs;
 * import com.pulumi.asset.FileAsset;
 * 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()
 *             .location("West Europe")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var exampleContainer = new Container("exampleContainer", ContainerArgs.builder()
 *             .storageAccountName(exampleAccount.name())
 *             .containerAccessType("private")
 *             .build());
 *         var exampleBlob = new Blob("exampleBlob", BlobArgs.builder()
 *             .storageAccountName(exampleAccount.name())
 *             .storageContainerName(exampleContainer.name())
 *             .type("Block")
 *             .source(new FileAsset("some-local-file.zip"))
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * Storage Blob's can be imported using the `resource id`, e.g.
 * ```sh
 *  $ pulumi import azure:storage/blob:Blob blob1 https://example.blob.core.windows.net/container/blob.vhd
 * ```
 * @property accessTier The access tier of the storage blob. Possible values are `Archive`, `Cool` and `Hot`.
 * @property cacheControl Controls the [cache control header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) content of the response when blob is requested .
 * @property contentMd5 The MD5 sum of the blob contents. Cannot be defined if `source_uri` is defined, or if blob type is Append or Page. Changing this forces a new resource to be created.
 * @property contentType The content type of the storage blob. Cannot be defined if `source_uri` is defined. Defaults to `application/octet-stream`.
 * @property metadata A map of custom blob metadata.
 * @property name The name of the storage blob. Must be unique within the storage container the blob is located. Changing this forces a new resource to be created.
 * @property parallelism The number of workers per CPU core to run for concurrent uploads. Defaults to `8`. Changing this forces a new resource to be created.
 * > **NOTE:** `parallelism` is only applicable for Page blobs - support for [Block Blobs is blocked on the upstream issue](https://github.com/tombuildsstuff/giovanni/issues/15).
 * @property size Used only for `page` blobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to `0`. Changing this forces a new resource to be created.
 * > **Note:** `size` is required if `source_uri` is not set.
 * @property source An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if `source_content` or `source_uri` is specified. Changing this forces a new resource to be created.
 * @property sourceContent The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if `source` or `source_uri` is specified. Changing this forces a new resource to be created.
 * @property sourceUri The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if `source` or `source_content` is specified.
 * @property storageAccountName Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.
 * Changing this forces a new resource to be created.
 * @property storageContainerName The name of the storage container in which this blob should be created. Changing this forces a new resource to be created.
 * @property type The type of the storage blob to be created. Possible values are `Append`, `Block` or `Page`. Changing this forces a new resource to be created.
 */
public data class BlobArgs(
    public val accessTier: Output? = null,
    public val cacheControl: Output? = null,
    public val contentMd5: Output? = null,
    public val contentType: Output? = null,
    public val metadata: Output>? = null,
    public val name: Output? = null,
    public val parallelism: Output? = null,
    public val size: Output? = null,
    public val source: Output? = null,
    public val sourceContent: Output? = null,
    public val sourceUri: Output? = null,
    public val storageAccountName: Output? = null,
    public val storageContainerName: Output? = null,
    public val type: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.storage.BlobArgs =
        com.pulumi.azure.storage.BlobArgs.builder()
            .accessTier(accessTier?.applyValue({ args0 -> args0 }))
            .cacheControl(cacheControl?.applyValue({ args0 -> args0 }))
            .contentMd5(contentMd5?.applyValue({ args0 -> args0 }))
            .contentType(contentType?.applyValue({ args0 -> args0 }))
            .metadata(
                metadata?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            )
            .name(name?.applyValue({ args0 -> args0 }))
            .parallelism(parallelism?.applyValue({ args0 -> args0 }))
            .size(size?.applyValue({ args0 -> args0 }))
            .source(source?.applyValue({ args0 -> args0 }))
            .sourceContent(sourceContent?.applyValue({ args0 -> args0 }))
            .sourceUri(sourceUri?.applyValue({ args0 -> args0 }))
            .storageAccountName(storageAccountName?.applyValue({ args0 -> args0 }))
            .storageContainerName(storageContainerName?.applyValue({ args0 -> args0 }))
            .type(type?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [BlobArgs].
 */
@PulumiTagMarker
public class BlobArgsBuilder internal constructor() {
    private var accessTier: Output? = null

    private var cacheControl: Output? = null

    private var contentMd5: Output? = null

    private var contentType: Output? = null

    private var metadata: Output>? = null

    private var name: Output? = null

    private var parallelism: Output? = null

    private var size: Output? = null

    private var source: Output? = null

    private var sourceContent: Output? = null

    private var sourceUri: Output? = null

    private var storageAccountName: Output? = null

    private var storageContainerName: Output? = null

    private var type: Output? = null

    /**
     * @param value The access tier of the storage blob. Possible values are `Archive`, `Cool` and `Hot`.
     */
    @JvmName("ipwrlhtjuvobopkj")
    public suspend fun accessTier(`value`: Output) {
        this.accessTier = value
    }

    /**
     * @param value Controls the [cache control header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) content of the response when blob is requested .
     */
    @JvmName("yorrnyufgpefpiby")
    public suspend fun cacheControl(`value`: Output) {
        this.cacheControl = value
    }

    /**
     * @param value The MD5 sum of the blob contents. Cannot be defined if `source_uri` is defined, or if blob type is Append or Page. Changing this forces a new resource to be created.
     */
    @JvmName("diyoglboidaqtory")
    public suspend fun contentMd5(`value`: Output) {
        this.contentMd5 = value
    }

    /**
     * @param value The content type of the storage blob. Cannot be defined if `source_uri` is defined. Defaults to `application/octet-stream`.
     */
    @JvmName("hoywheghlypjdkpb")
    public suspend fun contentType(`value`: Output) {
        this.contentType = value
    }

    /**
     * @param value A map of custom blob metadata.
     */
    @JvmName("qixhflwkubweefnx")
    public suspend fun metadata(`value`: Output>) {
        this.metadata = value
    }

    /**
     * @param value The name of the storage blob. Must be unique within the storage container the blob is located. Changing this forces a new resource to be created.
     */
    @JvmName("rjfofbwrbhxaorje")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The number of workers per CPU core to run for concurrent uploads. Defaults to `8`. Changing this forces a new resource to be created.
     * > **NOTE:** `parallelism` is only applicable for Page blobs - support for [Block Blobs is blocked on the upstream issue](https://github.com/tombuildsstuff/giovanni/issues/15).
     */
    @JvmName("aueaqbauliuqdjwg")
    public suspend fun parallelism(`value`: Output) {
        this.parallelism = value
    }

    /**
     * @param value Used only for `page` blobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to `0`. Changing this forces a new resource to be created.
     * > **Note:** `size` is required if `source_uri` is not set.
     */
    @JvmName("vrywxtbtwmreyvbs")
    public suspend fun size(`value`: Output) {
        this.size = value
    }

    /**
     * @param value An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if `source_content` or `source_uri` is specified. Changing this forces a new resource to be created.
     */
    @JvmName("jupglhdmltxejgur")
    public suspend fun source(`value`: Output) {
        this.source = value
    }

    /**
     * @param value The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if `source` or `source_uri` is specified. Changing this forces a new resource to be created.
     */
    @JvmName("ukwerrpekwclenhr")
    public suspend fun sourceContent(`value`: Output) {
        this.sourceContent = value
    }

    /**
     * @param value The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if `source` or `source_content` is specified.
     */
    @JvmName("pqyhfnelsfcninyd")
    public suspend fun sourceUri(`value`: Output) {
        this.sourceUri = value
    }

    /**
     * @param value Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.
     * Changing this forces a new resource to be created.
     */
    @JvmName("sqrkknfibuxkywlh")
    public suspend fun storageAccountName(`value`: Output) {
        this.storageAccountName = value
    }

    /**
     * @param value The name of the storage container in which this blob should be created. Changing this forces a new resource to be created.
     */
    @JvmName("scoidxtduvkqowqm")
    public suspend fun storageContainerName(`value`: Output) {
        this.storageContainerName = value
    }

    /**
     * @param value The type of the storage blob to be created. Possible values are `Append`, `Block` or `Page`. Changing this forces a new resource to be created.
     */
    @JvmName("xgcksjxglwpygway")
    public suspend fun type(`value`: Output) {
        this.type = value
    }

    /**
     * @param value The access tier of the storage blob. Possible values are `Archive`, `Cool` and `Hot`.
     */
    @JvmName("ondtxffpmgqdaltl")
    public suspend fun accessTier(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.accessTier = mapped
    }

    /**
     * @param value Controls the [cache control header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) content of the response when blob is requested .
     */
    @JvmName("amosniefivawetuo")
    public suspend fun cacheControl(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.cacheControl = mapped
    }

    /**
     * @param value The MD5 sum of the blob contents. Cannot be defined if `source_uri` is defined, or if blob type is Append or Page. Changing this forces a new resource to be created.
     */
    @JvmName("htfsefolwahnlnjm")
    public suspend fun contentMd5(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.contentMd5 = mapped
    }

    /**
     * @param value The content type of the storage blob. Cannot be defined if `source_uri` is defined. Defaults to `application/octet-stream`.
     */
    @JvmName("nsactfeuhmnanlls")
    public suspend fun contentType(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.contentType = mapped
    }

    /**
     * @param value A map of custom blob metadata.
     */
    @JvmName("ashkchaddeoulbqr")
    public suspend fun metadata(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.metadata = mapped
    }

    /**
     * @param values A map of custom blob metadata.
     */
    @JvmName("xuyyujflypcspkbi")
    public fun metadata(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.metadata = mapped
    }

    /**
     * @param value The name of the storage blob. Must be unique within the storage container the blob is located. Changing this forces a new resource to be created.
     */
    @JvmName("vagoxeqmmkfneklu")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The number of workers per CPU core to run for concurrent uploads. Defaults to `8`. Changing this forces a new resource to be created.
     * > **NOTE:** `parallelism` is only applicable for Page blobs - support for [Block Blobs is blocked on the upstream issue](https://github.com/tombuildsstuff/giovanni/issues/15).
     */
    @JvmName("gyfhwrishcxegsan")
    public suspend fun parallelism(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.parallelism = mapped
    }

    /**
     * @param value Used only for `page` blobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to `0`. Changing this forces a new resource to be created.
     * > **Note:** `size` is required if `source_uri` is not set.
     */
    @JvmName("cugwnpotemgjemio")
    public suspend fun size(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.size = mapped
    }

    /**
     * @param value An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if `source_content` or `source_uri` is specified. Changing this forces a new resource to be created.
     */
    @JvmName("iudbjjjdmraoptqf")
    public suspend fun source(`value`: AssetOrArchive?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.source = mapped
    }

    /**
     * @param value The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if `source` or `source_uri` is specified. Changing this forces a new resource to be created.
     */
    @JvmName("xjwvwyxcdyyivyva")
    public suspend fun sourceContent(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.sourceContent = mapped
    }

    /**
     * @param value The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if `source` or `source_content` is specified.
     */
    @JvmName("hjlyrnkmkksebudr")
    public suspend fun sourceUri(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.sourceUri = mapped
    }

    /**
     * @param value Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.
     * Changing this forces a new resource to be created.
     */
    @JvmName("sblvqmbsxjsqjswk")
    public suspend fun storageAccountName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.storageAccountName = mapped
    }

    /**
     * @param value The name of the storage container in which this blob should be created. Changing this forces a new resource to be created.
     */
    @JvmName("oexjlnbdkbkjaepb")
    public suspend fun storageContainerName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.storageContainerName = mapped
    }

    /**
     * @param value The type of the storage blob to be created. Possible values are `Append`, `Block` or `Page`. Changing this forces a new resource to be created.
     */
    @JvmName("tairgrybqeqtetse")
    public suspend fun type(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.type = mapped
    }

    internal fun build(): BlobArgs = BlobArgs(
        accessTier = accessTier,
        cacheControl = cacheControl,
        contentMd5 = contentMd5,
        contentType = contentType,
        metadata = metadata,
        name = name,
        parallelism = parallelism,
        size = size,
        source = source,
        sourceContent = sourceContent,
        sourceUri = sourceUri,
        storageAccountName = storageAccountName,
        storageContainerName = storageContainerName,
        type = type,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy