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

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

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

package com.pulumi.azure.iot.kotlin

import com.pulumi.azure.iot.kotlin.outputs.IoTHubCloudToDevice
import com.pulumi.azure.iot.kotlin.outputs.IoTHubEndpoint
import com.pulumi.azure.iot.kotlin.outputs.IoTHubEnrichment
import com.pulumi.azure.iot.kotlin.outputs.IoTHubFallbackRoute
import com.pulumi.azure.iot.kotlin.outputs.IoTHubFileUpload
import com.pulumi.azure.iot.kotlin.outputs.IoTHubIdentity
import com.pulumi.azure.iot.kotlin.outputs.IoTHubNetworkRuleSet
import com.pulumi.azure.iot.kotlin.outputs.IoTHubRoute
import com.pulumi.azure.iot.kotlin.outputs.IoTHubSharedAccessPolicy
import com.pulumi.azure.iot.kotlin.outputs.IoTHubSku
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
import com.pulumi.azure.iot.kotlin.outputs.IoTHubCloudToDevice.Companion.toKotlin as ioTHubCloudToDeviceToKotlin
import com.pulumi.azure.iot.kotlin.outputs.IoTHubEndpoint.Companion.toKotlin as ioTHubEndpointToKotlin
import com.pulumi.azure.iot.kotlin.outputs.IoTHubEnrichment.Companion.toKotlin as ioTHubEnrichmentToKotlin
import com.pulumi.azure.iot.kotlin.outputs.IoTHubFallbackRoute.Companion.toKotlin as ioTHubFallbackRouteToKotlin
import com.pulumi.azure.iot.kotlin.outputs.IoTHubFileUpload.Companion.toKotlin as ioTHubFileUploadToKotlin
import com.pulumi.azure.iot.kotlin.outputs.IoTHubIdentity.Companion.toKotlin as ioTHubIdentityToKotlin
import com.pulumi.azure.iot.kotlin.outputs.IoTHubNetworkRuleSet.Companion.toKotlin as ioTHubNetworkRuleSetToKotlin
import com.pulumi.azure.iot.kotlin.outputs.IoTHubRoute.Companion.toKotlin as ioTHubRouteToKotlin
import com.pulumi.azure.iot.kotlin.outputs.IoTHubSharedAccessPolicy.Companion.toKotlin as ioTHubSharedAccessPolicyToKotlin
import com.pulumi.azure.iot.kotlin.outputs.IoTHubSku.Companion.toKotlin as ioTHubSkuToKotlin

/**
 * Builder for [IoTHub].
 */
@PulumiTagMarker
public class IoTHubResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: IoTHubArgs = IoTHubArgs()

    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 IoTHubArgsBuilder.() -> Unit) {
        val builder = IoTHubArgsBuilder()
        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(): IoTHub {
        val builtJavaResource = com.pulumi.azure.iot.IoTHub(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return IoTHub(builtJavaResource)
    }
}

/**
 * Manages an IotHub
 * > **NOTE:** Endpoints can be defined either directly on the `azure.iot.IoTHub` resource, or using the `azurerm_iothub_endpoint_*` resources - but the two ways of defining the endpoints cannot be used together. If both are used against the same IoTHub, spurious changes will occur. Also, defining a `azurerm_iothub_endpoint_*` resource and another endpoint of a different type directly on the `azure.iot.IoTHub` resource is not supported.
 * > **NOTE:** Routes can be defined either directly on the `azure.iot.IoTHub` resource, or using the `azure.iot.Route` resource - but the two cannot be used together. If both are used against the same IoTHub, spurious changes will occur.
 * > **NOTE:** Enrichments can be defined either directly on the `azure.iot.IoTHub` resource, or using the `azure.iot.Enrichment` resource - but the two cannot be used together. If both are used against the same IoTHub, spurious changes will occur.
 * > **NOTE:** Fallback route can be defined either directly on the `azure.iot.IoTHub` resource, or using the `azure.iot.FallbackRoute` resource - but the two cannot be used together. If both are used against the same IoTHub, spurious changes will occur.
 * > **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 exampleEventHubNamespace = new azure.eventhub.EventHubNamespace("example", {
 *     name: "example-namespace",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     sku: "Basic",
 * });
 * const exampleEventHub = new azure.eventhub.EventHub("example", {
 *     name: "example-eventhub",
 *     resourceGroupName: example.name,
 *     namespaceName: exampleEventHubNamespace.name,
 *     partitionCount: 2,
 *     messageRetention: 1,
 * });
 * const exampleAuthorizationRule = new azure.eventhub.AuthorizationRule("example", {
 *     resourceGroupName: example.name,
 *     namespaceName: exampleEventHubNamespace.name,
 *     eventhubName: exampleEventHub.name,
 *     name: "acctest",
 *     send: true,
 * });
 * const exampleIoTHub = new azure.iot.IoTHub("example", {
 *     name: "Example-IoTHub",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     localAuthenticationEnabled: false,
 *     sku: {
 *         name: "S1",
 *         capacity: 1,
 *     },
 *     endpoints: [
 *         {
 *             type: "AzureIotHub.StorageContainer",
 *             connectionString: exampleAccount.primaryBlobConnectionString,
 *             name: "export",
 *             batchFrequencyInSeconds: 60,
 *             maxChunkSizeInBytes: 10485760,
 *             containerName: exampleContainer.name,
 *             encoding: "Avro",
 *             fileNameFormat: "{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}",
 *         },
 *         {
 *             type: "AzureIotHub.EventHub",
 *             connectionString: exampleAuthorizationRule.primaryConnectionString,
 *             name: "export2",
 *         },
 *     ],
 *     routes: [
 *         {
 *             name: "export",
 *             source: "DeviceMessages",
 *             condition: "true",
 *             endpointNames: ["export"],
 *             enabled: true,
 *         },
 *         {
 *             name: "export2",
 *             source: "DeviceMessages",
 *             condition: "true",
 *             endpointNames: ["export2"],
 *             enabled: true,
 *         },
 *     ],
 *     enrichments: [{
 *         key: "tenant",
 *         value: "$twin.tags.Tenant",
 *         endpointNames: [
 *             "export",
 *             "export2",
 *         ],
 *     }],
 *     cloudToDevice: {
 *         maxDeliveryCount: 30,
 *         defaultTtl: "PT1H",
 *         feedbacks: [{
 *             timeToLive: "PT1H10M",
 *             maxDeliveryCount: 15,
 *             lockDuration: "PT30S",
 *         }],
 *     },
 *     tags: {
 *         purpose: "testing",
 *     },
 * });
 * ```
 * ```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_event_hub_namespace = azure.eventhub.EventHubNamespace("example",
 *     name="example-namespace",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     sku="Basic")
 * example_event_hub = azure.eventhub.EventHub("example",
 *     name="example-eventhub",
 *     resource_group_name=example.name,
 *     namespace_name=example_event_hub_namespace.name,
 *     partition_count=2,
 *     message_retention=1)
 * example_authorization_rule = azure.eventhub.AuthorizationRule("example",
 *     resource_group_name=example.name,
 *     namespace_name=example_event_hub_namespace.name,
 *     eventhub_name=example_event_hub.name,
 *     name="acctest",
 *     send=True)
 * example_io_t_hub = azure.iot.IoTHub("example",
 *     name="Example-IoTHub",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     local_authentication_enabled=False,
 *     sku={
 *         "name": "S1",
 *         "capacity": 1,
 *     },
 *     endpoints=[
 *         {
 *             "type": "AzureIotHub.StorageContainer",
 *             "connection_string": example_account.primary_blob_connection_string,
 *             "name": "export",
 *             "batch_frequency_in_seconds": 60,
 *             "max_chunk_size_in_bytes": 10485760,
 *             "container_name": example_container.name,
 *             "encoding": "Avro",
 *             "file_name_format": "{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}",
 *         },
 *         {
 *             "type": "AzureIotHub.EventHub",
 *             "connection_string": example_authorization_rule.primary_connection_string,
 *             "name": "export2",
 *         },
 *     ],
 *     routes=[
 *         {
 *             "name": "export",
 *             "source": "DeviceMessages",
 *             "condition": "true",
 *             "endpoint_names": ["export"],
 *             "enabled": True,
 *         },
 *         {
 *             "name": "export2",
 *             "source": "DeviceMessages",
 *             "condition": "true",
 *             "endpoint_names": ["export2"],
 *             "enabled": True,
 *         },
 *     ],
 *     enrichments=[{
 *         "key": "tenant",
 *         "value": "$twin.tags.Tenant",
 *         "endpoint_names": [
 *             "export",
 *             "export2",
 *         ],
 *     }],
 *     cloud_to_device={
 *         "max_delivery_count": 30,
 *         "default_ttl": "PT1H",
 *         "feedbacks": [{
 *             "time_to_live": "PT1H10M",
 *             "max_delivery_count": 15,
 *             "lock_duration": "PT30S",
 *         }],
 *     },
 *     tags={
 *         "purpose": "testing",
 *     })
 * ```
 * ```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 exampleEventHubNamespace = new Azure.EventHub.EventHubNamespace("example", new()
 *     {
 *         Name = "example-namespace",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Sku = "Basic",
 *     });
 *     var exampleEventHub = new Azure.EventHub.EventHub("example", new()
 *     {
 *         Name = "example-eventhub",
 *         ResourceGroupName = example.Name,
 *         NamespaceName = exampleEventHubNamespace.Name,
 *         PartitionCount = 2,
 *         MessageRetention = 1,
 *     });
 *     var exampleAuthorizationRule = new Azure.EventHub.AuthorizationRule("example", new()
 *     {
 *         ResourceGroupName = example.Name,
 *         NamespaceName = exampleEventHubNamespace.Name,
 *         EventhubName = exampleEventHub.Name,
 *         Name = "acctest",
 *         Send = true,
 *     });
 *     var exampleIoTHub = new Azure.Iot.IoTHub("example", new()
 *     {
 *         Name = "Example-IoTHub",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         LocalAuthenticationEnabled = false,
 *         Sku = new Azure.Iot.Inputs.IoTHubSkuArgs
 *         {
 *             Name = "S1",
 *             Capacity = 1,
 *         },
 *         Endpoints = new[]
 *         {
 *             new Azure.Iot.Inputs.IoTHubEndpointArgs
 *             {
 *                 Type = "AzureIotHub.StorageContainer",
 *                 ConnectionString = exampleAccount.PrimaryBlobConnectionString,
 *                 Name = "export",
 *                 BatchFrequencyInSeconds = 60,
 *                 MaxChunkSizeInBytes = 10485760,
 *                 ContainerName = exampleContainer.Name,
 *                 Encoding = "Avro",
 *                 FileNameFormat = "{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}",
 *             },
 *             new Azure.Iot.Inputs.IoTHubEndpointArgs
 *             {
 *                 Type = "AzureIotHub.EventHub",
 *                 ConnectionString = exampleAuthorizationRule.PrimaryConnectionString,
 *                 Name = "export2",
 *             },
 *         },
 *         Routes = new[]
 *         {
 *             new Azure.Iot.Inputs.IoTHubRouteArgs
 *             {
 *                 Name = "export",
 *                 Source = "DeviceMessages",
 *                 Condition = "true",
 *                 EndpointNames = new[]
 *                 {
 *                     "export",
 *                 },
 *                 Enabled = true,
 *             },
 *             new Azure.Iot.Inputs.IoTHubRouteArgs
 *             {
 *                 Name = "export2",
 *                 Source = "DeviceMessages",
 *                 Condition = "true",
 *                 EndpointNames = new[]
 *                 {
 *                     "export2",
 *                 },
 *                 Enabled = true,
 *             },
 *         },
 *         Enrichments = new[]
 *         {
 *             new Azure.Iot.Inputs.IoTHubEnrichmentArgs
 *             {
 *                 Key = "tenant",
 *                 Value = "$twin.tags.Tenant",
 *                 EndpointNames = new[]
 *                 {
 *                     "export",
 *                     "export2",
 *                 },
 *             },
 *         },
 *         CloudToDevice = new Azure.Iot.Inputs.IoTHubCloudToDeviceArgs
 *         {
 *             MaxDeliveryCount = 30,
 *             DefaultTtl = "PT1H",
 *             Feedbacks = new[]
 *             {
 *                 new Azure.Iot.Inputs.IoTHubCloudToDeviceFeedbackArgs
 *                 {
 *                     TimeToLive = "PT1H10M",
 *                     MaxDeliveryCount = 15,
 *                     LockDuration = "PT30S",
 *                 },
 *             },
 *         },
 *         Tags =
 *         {
 *             { "purpose", "testing" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/eventhub"
 * 	"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
 * 		}
 * 		exampleEventHubNamespace, err := eventhub.NewEventHubNamespace(ctx, "example", &eventhub.EventHubNamespaceArgs{
 * 			Name:              pulumi.String("example-namespace"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			Sku:               pulumi.String("Basic"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleEventHub, err := eventhub.NewEventHub(ctx, "example", &eventhub.EventHubArgs{
 * 			Name:              pulumi.String("example-eventhub"),
 * 			ResourceGroupName: example.Name,
 * 			NamespaceName:     exampleEventHubNamespace.Name,
 * 			PartitionCount:    pulumi.Int(2),
 * 			MessageRetention:  pulumi.Int(1),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAuthorizationRule, err := eventhub.NewAuthorizationRule(ctx, "example", &eventhub.AuthorizationRuleArgs{
 * 			ResourceGroupName: example.Name,
 * 			NamespaceName:     exampleEventHubNamespace.Name,
 * 			EventhubName:      exampleEventHub.Name,
 * 			Name:              pulumi.String("acctest"),
 * 			Send:              pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = iot.NewIoTHub(ctx, "example", &iot.IoTHubArgs{
 * 			Name:                       pulumi.String("Example-IoTHub"),
 * 			ResourceGroupName:          example.Name,
 * 			Location:                   example.Location,
 * 			LocalAuthenticationEnabled: pulumi.Bool(false),
 * 			Sku: &iot.IoTHubSkuArgs{
 * 				Name:     pulumi.String("S1"),
 * 				Capacity: pulumi.Int(1),
 * 			},
 * 			Endpoints: iot.IoTHubEndpointArray{
 * 				&iot.IoTHubEndpointArgs{
 * 					Type:                    pulumi.String("AzureIotHub.StorageContainer"),
 * 					ConnectionString:        exampleAccount.PrimaryBlobConnectionString,
 * 					Name:                    pulumi.String("export"),
 * 					BatchFrequencyInSeconds: pulumi.Int(60),
 * 					MaxChunkSizeInBytes:     pulumi.Int(10485760),
 * 					ContainerName:           exampleContainer.Name,
 * 					Encoding:                pulumi.String("Avro"),
 * 					FileNameFormat:          pulumi.String("{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}"),
 * 				},
 * 				&iot.IoTHubEndpointArgs{
 * 					Type:             pulumi.String("AzureIotHub.EventHub"),
 * 					ConnectionString: exampleAuthorizationRule.PrimaryConnectionString,
 * 					Name:             pulumi.String("export2"),
 * 				},
 * 			},
 * 			Routes: iot.IoTHubRouteArray{
 * 				&iot.IoTHubRouteArgs{
 * 					Name:      pulumi.String("export"),
 * 					Source:    pulumi.String("DeviceMessages"),
 * 					Condition: pulumi.String("true"),
 * 					EndpointNames: pulumi.StringArray{
 * 						pulumi.String("export"),
 * 					},
 * 					Enabled: pulumi.Bool(true),
 * 				},
 * 				&iot.IoTHubRouteArgs{
 * 					Name:      pulumi.String("export2"),
 * 					Source:    pulumi.String("DeviceMessages"),
 * 					Condition: pulumi.String("true"),
 * 					EndpointNames: pulumi.StringArray{
 * 						pulumi.String("export2"),
 * 					},
 * 					Enabled: pulumi.Bool(true),
 * 				},
 * 			},
 * 			Enrichments: iot.IoTHubEnrichmentArray{
 * 				&iot.IoTHubEnrichmentArgs{
 * 					Key:   pulumi.String("tenant"),
 * 					Value: pulumi.String("$twin.tags.Tenant"),
 * 					EndpointNames: pulumi.StringArray{
 * 						pulumi.String("export"),
 * 						pulumi.String("export2"),
 * 					},
 * 				},
 * 			},
 * 			CloudToDevice: &iot.IoTHubCloudToDeviceArgs{
 * 				MaxDeliveryCount: pulumi.Int(30),
 * 				DefaultTtl:       pulumi.String("PT1H"),
 * 				Feedbacks: iot.IoTHubCloudToDeviceFeedbackArray{
 * 					&iot.IoTHubCloudToDeviceFeedbackArgs{
 * 						TimeToLive:       pulumi.String("PT1H10M"),
 * 						MaxDeliveryCount: pulumi.Int(15),
 * 						LockDuration:     pulumi.String("PT30S"),
 * 					},
 * 				},
 * 			},
 * 			Tags: pulumi.StringMap{
 * 				"purpose": pulumi.String("testing"),
 * 			},
 * 		})
 * 		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.eventhub.EventHubNamespace;
 * import com.pulumi.azure.eventhub.EventHubNamespaceArgs;
 * import com.pulumi.azure.eventhub.EventHub;
 * import com.pulumi.azure.eventhub.EventHubArgs;
 * import com.pulumi.azure.eventhub.AuthorizationRule;
 * import com.pulumi.azure.eventhub.AuthorizationRuleArgs;
 * import com.pulumi.azure.iot.IoTHub;
 * import com.pulumi.azure.iot.IoTHubArgs;
 * import com.pulumi.azure.iot.inputs.IoTHubSkuArgs;
 * import com.pulumi.azure.iot.inputs.IoTHubEndpointArgs;
 * import com.pulumi.azure.iot.inputs.IoTHubRouteArgs;
 * import com.pulumi.azure.iot.inputs.IoTHubEnrichmentArgs;
 * import com.pulumi.azure.iot.inputs.IoTHubCloudToDeviceArgs;
 * 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 exampleEventHubNamespace = new EventHubNamespace("exampleEventHubNamespace", EventHubNamespaceArgs.builder()
 *             .name("example-namespace")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .sku("Basic")
 *             .build());
 *         var exampleEventHub = new EventHub("exampleEventHub", EventHubArgs.builder()
 *             .name("example-eventhub")
 *             .resourceGroupName(example.name())
 *             .namespaceName(exampleEventHubNamespace.name())
 *             .partitionCount(2)
 *             .messageRetention(1)
 *             .build());
 *         var exampleAuthorizationRule = new AuthorizationRule("exampleAuthorizationRule", AuthorizationRuleArgs.builder()
 *             .resourceGroupName(example.name())
 *             .namespaceName(exampleEventHubNamespace.name())
 *             .eventhubName(exampleEventHub.name())
 *             .name("acctest")
 *             .send(true)
 *             .build());
 *         var exampleIoTHub = new IoTHub("exampleIoTHub", IoTHubArgs.builder()
 *             .name("Example-IoTHub")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .localAuthenticationEnabled(false)
 *             .sku(IoTHubSkuArgs.builder()
 *                 .name("S1")
 *                 .capacity("1")
 *                 .build())
 *             .endpoints(
 *                 IoTHubEndpointArgs.builder()
 *                     .type("AzureIotHub.StorageContainer")
 *                     .connectionString(exampleAccount.primaryBlobConnectionString())
 *                     .name("export")
 *                     .batchFrequencyInSeconds(60)
 *                     .maxChunkSizeInBytes(10485760)
 *                     .containerName(exampleContainer.name())
 *                     .encoding("Avro")
 *                     .fileNameFormat("{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}")
 *                     .build(),
 *                 IoTHubEndpointArgs.builder()
 *                     .type("AzureIotHub.EventHub")
 *                     .connectionString(exampleAuthorizationRule.primaryConnectionString())
 *                     .name("export2")
 *                     .build())
 *             .routes(
 *                 IoTHubRouteArgs.builder()
 *                     .name("export")
 *                     .source("DeviceMessages")
 *                     .condition("true")
 *                     .endpointNames("export")
 *                     .enabled(true)
 *                     .build(),
 *                 IoTHubRouteArgs.builder()
 *                     .name("export2")
 *                     .source("DeviceMessages")
 *                     .condition("true")
 *                     .endpointNames("export2")
 *                     .enabled(true)
 *                     .build())
 *             .enrichments(IoTHubEnrichmentArgs.builder()
 *                 .key("tenant")
 *                 .value("$twin.tags.Tenant")
 *                 .endpointNames(
 *                     "export",
 *                     "export2")
 *                 .build())
 *             .cloudToDevice(IoTHubCloudToDeviceArgs.builder()
 *                 .maxDeliveryCount(30)
 *                 .defaultTtl("PT1H")
 *                 .feedbacks(IoTHubCloudToDeviceFeedbackArgs.builder()
 *                     .timeToLive("PT1H10M")
 *                     .maxDeliveryCount(15)
 *                     .lockDuration("PT30S")
 *                     .build())
 *                 .build())
 *             .tags(Map.of("purpose", "testing"))
 *             .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
 *   exampleEventHubNamespace:
 *     type: azure:eventhub:EventHubNamespace
 *     name: example
 *     properties:
 *       name: example-namespace
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       sku: Basic
 *   exampleEventHub:
 *     type: azure:eventhub:EventHub
 *     name: example
 *     properties:
 *       name: example-eventhub
 *       resourceGroupName: ${example.name}
 *       namespaceName: ${exampleEventHubNamespace.name}
 *       partitionCount: 2
 *       messageRetention: 1
 *   exampleAuthorizationRule:
 *     type: azure:eventhub:AuthorizationRule
 *     name: example
 *     properties:
 *       resourceGroupName: ${example.name}
 *       namespaceName: ${exampleEventHubNamespace.name}
 *       eventhubName: ${exampleEventHub.name}
 *       name: acctest
 *       send: true
 *   exampleIoTHub:
 *     type: azure:iot:IoTHub
 *     name: example
 *     properties:
 *       name: Example-IoTHub
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       localAuthenticationEnabled: false
 *       sku:
 *         name: S1
 *         capacity: '1'
 *       endpoints:
 *         - type: AzureIotHub.StorageContainer
 *           connectionString: ${exampleAccount.primaryBlobConnectionString}
 *           name: export
 *           batchFrequencyInSeconds: 60
 *           maxChunkSizeInBytes: 1.048576e+07
 *           containerName: ${exampleContainer.name}
 *           encoding: Avro
 *           fileNameFormat: '{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}'
 *         - type: AzureIotHub.EventHub
 *           connectionString: ${exampleAuthorizationRule.primaryConnectionString}
 *           name: export2
 *       routes:
 *         - name: export
 *           source: DeviceMessages
 *           condition: 'true'
 *           endpointNames:
 *             - export
 *           enabled: true
 *         - name: export2
 *           source: DeviceMessages
 *           condition: 'true'
 *           endpointNames:
 *             - export2
 *           enabled: true
 *       enrichments:
 *         - key: tenant
 *           value: $twin.tags.Tenant
 *           endpointNames:
 *             - export
 *             - export2
 *       cloudToDevice:
 *         maxDeliveryCount: 30
 *         defaultTtl: PT1H
 *         feedbacks:
 *           - timeToLive: PT1H10M
 *             maxDeliveryCount: 15
 *             lockDuration: PT30S
 *       tags:
 *         purpose: testing
 * ```
 * 
 * ## Import
 * IoTHubs can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:iot/ioTHub:IoTHub hub1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/iotHubs/hub1
 * ```
 */
public class IoTHub internal constructor(
    override val javaResource: com.pulumi.azure.iot.IoTHub,
) : KotlinCustomResource(javaResource, IoTHubMapper) {
    public val cloudToDevice: Output
        get() = javaResource.cloudToDevice().applyValue({ args0 ->
            args0.let({ args0 ->
                ioTHubCloudToDeviceToKotlin(args0)
            })
        })

    /**
     * An `endpoint` block as defined below.
     */
    public val endpoints: Output>
        get() = javaResource.endpoints().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    ioTHubEndpointToKotlin(args0)
                })
            })
        })

    public val enrichments: Output>
        get() = javaResource.enrichments().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    ioTHubEnrichmentToKotlin(args0)
                })
            })
        })

    /**
     * The EventHub compatible endpoint for events data
     */
    public val eventHubEventsEndpoint: Output
        get() = javaResource.eventHubEventsEndpoint().applyValue({ args0 -> args0 })

    /**
     * The EventHub namespace for events data
     */
    public val eventHubEventsNamespace: Output
        get() = javaResource.eventHubEventsNamespace().applyValue({ args0 -> args0 })

    /**
     * The EventHub compatible path for events data
     */
    public val eventHubEventsPath: Output
        get() = javaResource.eventHubEventsPath().applyValue({ args0 -> args0 })

    /**
     * The EventHub compatible endpoint for operational data
     */
    public val eventHubOperationsEndpoint: Output
        get() = javaResource.eventHubOperationsEndpoint().applyValue({ args0 -> args0 })

    /**
     * The EventHub compatible path for operational data
     */
    public val eventHubOperationsPath: Output
        get() = javaResource.eventHubOperationsPath().applyValue({ args0 -> args0 })

    /**
     * The number of device-to-cloud partitions used by backing event hubs. Must be between `2` and `128`.
     */
    public val eventHubPartitionCount: Output
        get() = javaResource.eventHubPartitionCount().applyValue({ args0 -> args0 })

    /**
     * The event hub retention to use in days. Must be between `1` and `7`.
     */
    public val eventHubRetentionInDays: Output
        get() = javaResource.eventHubRetentionInDays().applyValue({ args0 -> args0 })

    /**
     * A `fallback_route` block as defined below. If the fallback route is enabled, messages that don't match any of the supplied routes are automatically sent to this route. Defaults to messages/events.
     * > **NOTE:** If `fallback_route` isn't explicitly specified, the fallback route wouldn't be enabled by default.
     */
    public val fallbackRoute: Output
        get() = javaResource.fallbackRoute().applyValue({ args0 ->
            args0.let({ args0 ->
                ioTHubFallbackRouteToKotlin(args0)
            })
        })

    /**
     * A `file_upload` block as defined below.
     */
    public val fileUpload: Output?
        get() = javaResource.fileUpload().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    ioTHubFileUploadToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The hostname of the IotHub Resource.
     */
    public val hostname: Output
        get() = javaResource.hostname().applyValue({ args0 -> args0 })

    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    ioTHubIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * If false, SAS tokens with Iot hub scoped SAS keys cannot be used for authentication. Defaults to `true`.
     */
    public val localAuthenticationEnabled: Output?
        get() = javaResource.localAuthenticationEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the supported Azure location where the resource has to be created. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    public val minTlsVersion: Output?
        get() = javaResource.minTlsVersion().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the name of the IotHub resource. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * A `network_rule_set` block as defined below.
     */
    public val networkRuleSets: Output>?
        get() = javaResource.networkRuleSets().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        ioTHubNetworkRuleSetToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    public val publicNetworkAccessEnabled: Output?
        get() = javaResource.publicNetworkAccessEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the resource group under which the IotHub resource has to be created. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    public val routes: Output>
        get() = javaResource.routes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    ioTHubRouteToKotlin(args0)
                })
            })
        })

    /**
     * One or more `shared_access_policy` blocks as defined below.
     */
    public val sharedAccessPolicies: Output>
        get() = javaResource.sharedAccessPolicies().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> ioTHubSharedAccessPolicyToKotlin(args0) })
            })
        })

    /**
     * A `sku` block as defined below.
     */
    public val sku: Output
        get() = javaResource.sku().applyValue({ args0 -> args0.let({ args0 -> ioTHubSkuToKotlin(args0) }) })

    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object IoTHubMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.iot.IoTHub::class == javaResource::class

    override fun map(javaResource: Resource): IoTHub = IoTHub(
        javaResource as
            com.pulumi.azure.iot.IoTHub,
    )
}

/**
 * @see [IoTHub].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [IoTHub].
 */
public suspend fun ioTHub(name: String, block: suspend IoTHubResourceBuilder.() -> Unit): IoTHub {
    val builder = IoTHubResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [IoTHub].
 * @param name The _unique_ name of the resulting resource.
 */
public fun ioTHub(name: String): IoTHub {
    val builder = IoTHubResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy