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

com.pulumi.azure.iot.kotlin.FileUploadArgs.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.iot.kotlin

import com.pulumi.azure.iot.FileUploadArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * Manages the File Upload of an IoT Hub.
 * > **NOTE:** File upload can be defined either directly on the `azure.iot.IoTHub` resource, or using the `azure.iot.FileUpload` resource - but the two cannot be used together. If both are used against the same IoTHub, spurious changes will occur.
 * ## 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: "examplestorage",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const exampleContainer = new azure.storage.Container("example", {
 *     name: "examplecontainer",
 *     storageAccountName: exampleAccount.name,
 *     containerAccessType: "private",
 * });
 * const exampleIoTHub = new azure.iot.IoTHub("example", {
 *     name: "example",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     sku: {
 *         name: "S1",
 *         capacity: 1,
 *     },
 * });
 * const exampleFileUpload = new azure.iot.FileUpload("example", {
 *     iothubId: exampleIoTHub.id,
 *     connectionString: exampleAccount.primaryBlobConnectionString,
 *     containerName: exampleContainer.name,
 * });
 * ```
 * ```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="examplestorage",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     account_tier="Standard",
 *     account_replication_type="LRS")
 * example_container = azure.storage.Container("example",
 *     name="examplecontainer",
 *     storage_account_name=example_account.name,
 *     container_access_type="private")
 * example_io_t_hub = azure.iot.IoTHub("example",
 *     name="example",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     sku={
 *         "name": "S1",
 *         "capacity": 1,
 *     })
 * example_file_upload = azure.iot.FileUpload("example",
 *     iothub_id=example_io_t_hub.id,
 *     connection_string=example_account.primary_blob_connection_string,
 *     container_name=example_container.name)
 * ```
 * ```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 = "examplestorage",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *     });
 *     var exampleContainer = new Azure.Storage.Container("example", new()
 *     {
 *         Name = "examplecontainer",
 *         StorageAccountName = exampleAccount.Name,
 *         ContainerAccessType = "private",
 *     });
 *     var exampleIoTHub = new Azure.Iot.IoTHub("example", new()
 *     {
 *         Name = "example",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Sku = new Azure.Iot.Inputs.IoTHubSkuArgs
 *         {
 *             Name = "S1",
 *             Capacity = 1,
 *         },
 *     });
 *     var exampleFileUpload = new Azure.Iot.FileUpload("example", new()
 *     {
 *         IothubId = exampleIoTHub.Id,
 *         ConnectionString = exampleAccount.PrimaryBlobConnectionString,
 *         ContainerName = exampleContainer.Name,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/iot"
 * 	"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("examplestorage"),
 * 			ResourceGroupName:      example.Name,
 * 			Location:               example.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("examplecontainer"),
 * 			StorageAccountName:  exampleAccount.Name,
 * 			ContainerAccessType: pulumi.String("private"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleIoTHub, err := iot.NewIoTHub(ctx, "example", &iot.IoTHubArgs{
 * 			Name:              pulumi.String("example"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			Sku: &iot.IoTHubSkuArgs{
 * 				Name:     pulumi.String("S1"),
 * 				Capacity: pulumi.Int(1),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = iot.NewFileUpload(ctx, "example", &iot.FileUploadArgs{
 * 			IothubId:         exampleIoTHub.ID(),
 * 			ConnectionString: exampleAccount.PrimaryBlobConnectionString,
 * 			ContainerName:    exampleContainer.Name,
 * 		})
 * 		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.Container;
 * import com.pulumi.azure.storage.ContainerArgs;
 * import com.pulumi.azure.iot.IoTHub;
 * import com.pulumi.azure.iot.IoTHubArgs;
 * import com.pulumi.azure.iot.inputs.IoTHubSkuArgs;
 * import com.pulumi.azure.iot.FileUpload;
 * import com.pulumi.azure.iot.FileUploadArgs;
 * 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("examplestorage")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var exampleContainer = new Container("exampleContainer", ContainerArgs.builder()
 *             .name("examplecontainer")
 *             .storageAccountName(exampleAccount.name())
 *             .containerAccessType("private")
 *             .build());
 *         var exampleIoTHub = new IoTHub("exampleIoTHub", IoTHubArgs.builder()
 *             .name("example")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .sku(IoTHubSkuArgs.builder()
 *                 .name("S1")
 *                 .capacity("1")
 *                 .build())
 *             .build());
 *         var exampleFileUpload = new FileUpload("exampleFileUpload", FileUploadArgs.builder()
 *             .iothubId(exampleIoTHub.id())
 *             .connectionString(exampleAccount.primaryBlobConnectionString())
 *             .containerName(exampleContainer.name())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: examplestorage
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *   exampleContainer:
 *     type: azure:storage:Container
 *     name: example
 *     properties:
 *       name: examplecontainer
 *       storageAccountName: ${exampleAccount.name}
 *       containerAccessType: private
 *   exampleIoTHub:
 *     type: azure:iot:IoTHub
 *     name: example
 *     properties:
 *       name: example
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       sku:
 *         name: S1
 *         capacity: '1'
 *   exampleFileUpload:
 *     type: azure:iot:FileUpload
 *     name: example
 *     properties:
 *       iothubId: ${exampleIoTHub.id}
 *       connectionString: ${exampleAccount.primaryBlobConnectionString}
 *       containerName: ${exampleContainer.name}
 * ```
 * 
 * ## Import
 * IoT Hub File Uploads can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:iot/fileUpload:FileUpload example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/iotHubs/hub1
 * ```
 * @property authenticationType The type used to authenticate against the storage account. Possible values are `keyBased` and `identityBased`. Defaults to `keyBased`.
 * @property connectionString The connection string for the Azure Storage account to which files are uploaded.
 * @property containerName The name of the root container where the files should be uploaded to. The container need not exist but should be creatable using the `connection_string` specified.
 * @property defaultTtl The period of time for which a file upload notification message is available to consume before it expires, specified as an [ISO 8601 timespan duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). This value must be between 1 minute and 48 hours. Defaults to `PT1H`.
 * @property identityId The ID of the User Managed Identity used to authenticate against the storage account.
 * > **NOTE:** `identity_id` can only be specified when `authentication_type` is `identityBased`. It must be one of the `identity_ids` of the IoT Hub. If `identity_id` is omitted when `authentication_type` is `identityBased`, then the System-Assigned Managed Identity of the IoT Hub will be used.
 * @property iothubId The ID of the IoT Hub. Changing this forces a new IoT Hub to be created.
 * @property lockDuration The lock duration for the file upload notifications queue, specified as an [ISO 8601 timespan duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). This value must be between 5 and 300 seconds. Defaults to `PT1M`.
 * @property maxDeliveryCount The number of times the IoT Hub attempts to deliver a file upload notification message. Defaults to `10`.
 * @property notificationsEnabled Used to specify whether file notifications are sent to IoT Hub on upload. Defaults to `false`.
 * @property sasTtl The period of time for which the SAS URI generated by IoT Hub for file upload is valid, specified as an [ISO 8601 timespan duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). This value must be between 1 minute and 24 hours. Defaults to `PT1H`.
 */
public data class FileUploadArgs(
    public val authenticationType: Output? = null,
    public val connectionString: Output? = null,
    public val containerName: Output? = null,
    public val defaultTtl: Output? = null,
    public val identityId: Output? = null,
    public val iothubId: Output? = null,
    public val lockDuration: Output? = null,
    public val maxDeliveryCount: Output? = null,
    public val notificationsEnabled: Output? = null,
    public val sasTtl: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.iot.FileUploadArgs =
        com.pulumi.azure.iot.FileUploadArgs.builder()
            .authenticationType(authenticationType?.applyValue({ args0 -> args0 }))
            .connectionString(connectionString?.applyValue({ args0 -> args0 }))
            .containerName(containerName?.applyValue({ args0 -> args0 }))
            .defaultTtl(defaultTtl?.applyValue({ args0 -> args0 }))
            .identityId(identityId?.applyValue({ args0 -> args0 }))
            .iothubId(iothubId?.applyValue({ args0 -> args0 }))
            .lockDuration(lockDuration?.applyValue({ args0 -> args0 }))
            .maxDeliveryCount(maxDeliveryCount?.applyValue({ args0 -> args0 }))
            .notificationsEnabled(notificationsEnabled?.applyValue({ args0 -> args0 }))
            .sasTtl(sasTtl?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [FileUploadArgs].
 */
@PulumiTagMarker
public class FileUploadArgsBuilder internal constructor() {
    private var authenticationType: Output? = null

    private var connectionString: Output? = null

    private var containerName: Output? = null

    private var defaultTtl: Output? = null

    private var identityId: Output? = null

    private var iothubId: Output? = null

    private var lockDuration: Output? = null

    private var maxDeliveryCount: Output? = null

    private var notificationsEnabled: Output? = null

    private var sasTtl: Output? = null

    /**
     * @param value The type used to authenticate against the storage account. Possible values are `keyBased` and `identityBased`. Defaults to `keyBased`.
     */
    @JvmName("lstjaarxhwfmaduo")
    public suspend fun authenticationType(`value`: Output) {
        this.authenticationType = value
    }

    /**
     * @param value The connection string for the Azure Storage account to which files are uploaded.
     */
    @JvmName("hntnciwsuacmknog")
    public suspend fun connectionString(`value`: Output) {
        this.connectionString = value
    }

    /**
     * @param value The name of the root container where the files should be uploaded to. The container need not exist but should be creatable using the `connection_string` specified.
     */
    @JvmName("bctlwchkqyaulnxa")
    public suspend fun containerName(`value`: Output) {
        this.containerName = value
    }

    /**
     * @param value The period of time for which a file upload notification message is available to consume before it expires, specified as an [ISO 8601 timespan duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). This value must be between 1 minute and 48 hours. Defaults to `PT1H`.
     */
    @JvmName("cynhwpnechtsrdlk")
    public suspend fun defaultTtl(`value`: Output) {
        this.defaultTtl = value
    }

    /**
     * @param value The ID of the User Managed Identity used to authenticate against the storage account.
     * > **NOTE:** `identity_id` can only be specified when `authentication_type` is `identityBased`. It must be one of the `identity_ids` of the IoT Hub. If `identity_id` is omitted when `authentication_type` is `identityBased`, then the System-Assigned Managed Identity of the IoT Hub will be used.
     */
    @JvmName("ifvktvakqqslivna")
    public suspend fun identityId(`value`: Output) {
        this.identityId = value
    }

    /**
     * @param value The ID of the IoT Hub. Changing this forces a new IoT Hub to be created.
     */
    @JvmName("jbpgylfrskwprkgv")
    public suspend fun iothubId(`value`: Output) {
        this.iothubId = value
    }

    /**
     * @param value The lock duration for the file upload notifications queue, specified as an [ISO 8601 timespan duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). This value must be between 5 and 300 seconds. Defaults to `PT1M`.
     */
    @JvmName("vblbhxslcgfplesb")
    public suspend fun lockDuration(`value`: Output) {
        this.lockDuration = value
    }

    /**
     * @param value The number of times the IoT Hub attempts to deliver a file upload notification message. Defaults to `10`.
     */
    @JvmName("btltggdgugaqktst")
    public suspend fun maxDeliveryCount(`value`: Output) {
        this.maxDeliveryCount = value
    }

    /**
     * @param value Used to specify whether file notifications are sent to IoT Hub on upload. Defaults to `false`.
     */
    @JvmName("kubwxmsfuxpmejud")
    public suspend fun notificationsEnabled(`value`: Output) {
        this.notificationsEnabled = value
    }

    /**
     * @param value The period of time for which the SAS URI generated by IoT Hub for file upload is valid, specified as an [ISO 8601 timespan duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). This value must be between 1 minute and 24 hours. Defaults to `PT1H`.
     */
    @JvmName("yucxkcojuugcyjrj")
    public suspend fun sasTtl(`value`: Output) {
        this.sasTtl = value
    }

    /**
     * @param value The type used to authenticate against the storage account. Possible values are `keyBased` and `identityBased`. Defaults to `keyBased`.
     */
    @JvmName("ouofwmqmmjikwwmf")
    public suspend fun authenticationType(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.authenticationType = mapped
    }

    /**
     * @param value The connection string for the Azure Storage account to which files are uploaded.
     */
    @JvmName("jmmmdiopavwithto")
    public suspend fun connectionString(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.connectionString = mapped
    }

    /**
     * @param value The name of the root container where the files should be uploaded to. The container need not exist but should be creatable using the `connection_string` specified.
     */
    @JvmName("iydscromavhnmbeb")
    public suspend fun containerName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.containerName = mapped
    }

    /**
     * @param value The period of time for which a file upload notification message is available to consume before it expires, specified as an [ISO 8601 timespan duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). This value must be between 1 minute and 48 hours. Defaults to `PT1H`.
     */
    @JvmName("cddemxlinnohdiwq")
    public suspend fun defaultTtl(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.defaultTtl = mapped
    }

    /**
     * @param value The ID of the User Managed Identity used to authenticate against the storage account.
     * > **NOTE:** `identity_id` can only be specified when `authentication_type` is `identityBased`. It must be one of the `identity_ids` of the IoT Hub. If `identity_id` is omitted when `authentication_type` is `identityBased`, then the System-Assigned Managed Identity of the IoT Hub will be used.
     */
    @JvmName("bbpmklcvwthtmjxh")
    public suspend fun identityId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.identityId = mapped
    }

    /**
     * @param value The ID of the IoT Hub. Changing this forces a new IoT Hub to be created.
     */
    @JvmName("bwbjiputotnnfelm")
    public suspend fun iothubId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.iothubId = mapped
    }

    /**
     * @param value The lock duration for the file upload notifications queue, specified as an [ISO 8601 timespan duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). This value must be between 5 and 300 seconds. Defaults to `PT1M`.
     */
    @JvmName("fgttjyrnyxosvdsg")
    public suspend fun lockDuration(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.lockDuration = mapped
    }

    /**
     * @param value The number of times the IoT Hub attempts to deliver a file upload notification message. Defaults to `10`.
     */
    @JvmName("evcgxcienpioubfw")
    public suspend fun maxDeliveryCount(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.maxDeliveryCount = mapped
    }

    /**
     * @param value Used to specify whether file notifications are sent to IoT Hub on upload. Defaults to `false`.
     */
    @JvmName("lhplwdpsmgakjowc")
    public suspend fun notificationsEnabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.notificationsEnabled = mapped
    }

    /**
     * @param value The period of time for which the SAS URI generated by IoT Hub for file upload is valid, specified as an [ISO 8601 timespan duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). This value must be between 1 minute and 24 hours. Defaults to `PT1H`.
     */
    @JvmName("hhvabdnqrpvjrcie")
    public suspend fun sasTtl(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.sasTtl = mapped
    }

    internal fun build(): FileUploadArgs = FileUploadArgs(
        authenticationType = authenticationType,
        connectionString = connectionString,
        containerName = containerName,
        defaultTtl = defaultTtl,
        identityId = identityId,
        iothubId = iothubId,
        lockDuration = lockDuration,
        maxDeliveryCount = maxDeliveryCount,
        notificationsEnabled = notificationsEnabled,
        sasTtl = sasTtl,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy