IoTHubArgs

data class IoTHubArgs(val cloudToDevice: Output<IoTHubCloudToDeviceArgs>? = null, val endpoints: Output<List<IoTHubEndpointArgs>>? = null, val enrichments: Output<List<IoTHubEnrichmentArgs>>? = null, val eventHubPartitionCount: Output<Int>? = null, val eventHubRetentionInDays: Output<Int>? = null, val fallbackRoute: Output<IoTHubFallbackRouteArgs>? = null, val fileUpload: Output<IoTHubFileUploadArgs>? = null, val identity: Output<IoTHubIdentityArgs>? = null, val localAuthenticationEnabled: Output<Boolean>? = null, val location: Output<String>? = null, val minTlsVersion: Output<String>? = null, val name: Output<String>? = null, val networkRuleSets: Output<List<IoTHubNetworkRuleSetArgs>>? = null, val publicNetworkAccessEnabled: Output<Boolean>? = null, val resourceGroupName: Output<String>? = null, val routes: Output<List<IoTHubRouteArgs>>? = null, val sku: Output<IoTHubSkuArgs>? = null, val tags: Output<Map<String, String>>? = null) : ConvertibleToJava<IoTHubArgs>

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

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 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 exampleEventHubNamespace = new EventHubNamespace("exampleEventHubNamespace", EventHubNamespaceArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.sku("Basic")
.build());
var exampleEventHub = new EventHub("exampleEventHub", EventHubArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.namespaceName(exampleEventHubNamespace.name())
.partitionCount(2)
.messageRetention(1)
.build());
var exampleAuthorizationRule = new AuthorizationRule("exampleAuthorizationRule", AuthorizationRuleArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.namespaceName(exampleEventHubNamespace.name())
.eventhubName(exampleEventHub.name())
.send(true)
.build());
var exampleIoTHub = new IoTHub("exampleIoTHub", IoTHubArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.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());
}
}

Import

IoTHubs can be imported using the resource id, e.g.

$ pulumi import azure:iot/ioTHub:IoTHub hub1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/iotHubs/hub1

Constructors

Link copied to clipboard
fun IoTHubArgs(cloudToDevice: Output<IoTHubCloudToDeviceArgs>? = null, endpoints: Output<List<IoTHubEndpointArgs>>? = null, enrichments: Output<List<IoTHubEnrichmentArgs>>? = null, eventHubPartitionCount: Output<Int>? = null, eventHubRetentionInDays: Output<Int>? = null, fallbackRoute: Output<IoTHubFallbackRouteArgs>? = null, fileUpload: Output<IoTHubFileUploadArgs>? = null, identity: Output<IoTHubIdentityArgs>? = null, localAuthenticationEnabled: Output<Boolean>? = null, location: Output<String>? = null, minTlsVersion: Output<String>? = null, name: Output<String>? = null, networkRuleSets: Output<List<IoTHubNetworkRuleSetArgs>>? = null, publicNetworkAccessEnabled: Output<Boolean>? = null, resourceGroupName: Output<String>? = null, routes: Output<List<IoTHubRouteArgs>>? = null, sku: Output<IoTHubSkuArgs>? = null, tags: Output<Map<String, String>>? = null)

Functions

Link copied to clipboard
open override fun toJava(): IoTHubArgs

Properties

Link copied to clipboard

A cloud_to_device block as defined below.

Link copied to clipboard
val endpoints: Output<List<IoTHubEndpointArgs>>? = null

An endpoint block as defined below.

Link copied to clipboard
val enrichments: Output<List<IoTHubEnrichmentArgs>>? = null

A enrichment block as defined below.

Link copied to clipboard
val eventHubPartitionCount: Output<Int>? = null

The number of device-to-cloud partitions used by backing event hubs. Must be between 2 and 128.

Link copied to clipboard
val eventHubRetentionInDays: Output<Int>? = null

The event hub retention to use in days. Must be between 1 and 7.

Link copied to clipboard

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.

Link copied to clipboard
val fileUpload: Output<IoTHubFileUploadArgs>? = null

A file_upload block as defined below.

Link copied to clipboard
val identity: Output<IoTHubIdentityArgs>? = null

An identity block as defined below.

Link copied to clipboard
val localAuthenticationEnabled: Output<Boolean>? = null

If false, SAS tokens with Iot hub scoped SAS keys cannot be used for authentication. Defaults to true.

Link copied to clipboard
val location: Output<String>? = null

Specifies the supported Azure location where the resource has to be created. Changing this forces a new resource to be created.

Link copied to clipboard
val minTlsVersion: Output<String>? = null

Specifies the minimum TLS version to support for this hub. The only valid value is 1.2. Changing this forces a new resource to be created.

Link copied to clipboard
val name: Output<String>? = null

Specifies the name of the IotHub resource. Changing this forces a new resource to be created.

Link copied to clipboard

A network_rule_set block as defined below.

Link copied to clipboard
val publicNetworkAccessEnabled: Output<Boolean>? = null

Is the IotHub resource accessible from a public network?

Link copied to clipboard
val resourceGroupName: Output<String>? = 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.

Link copied to clipboard
val routes: Output<List<IoTHubRouteArgs>>? = null

A route block as defined below.

Link copied to clipboard
val sku: Output<IoTHubSkuArgs>? = null

A sku block as defined below.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

A mapping of tags to assign to the resource.