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

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

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.21.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.iot.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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map

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

    public var args: TimeSeriesInsightsEventSourceIothubArgs =
        TimeSeriesInsightsEventSourceIothubArgs()

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

/**
 * Manages an Azure IoT Time Series Insights IoTHub Event Source.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example",
 *     location: "West Europe",
 * });
 * const exampleIoTHub = new azure.iot.IoTHub("example", {
 *     name: "example",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     sku: {
 *         name: "B1",
 *         capacity: 1,
 *     },
 * });
 * const exampleConsumerGroup = new azure.iot.ConsumerGroup("example", {
 *     name: "example",
 *     iothubName: exampleIoTHub.name,
 *     eventhubEndpointName: "events",
 *     resourceGroupName: example.name,
 * });
 * const storage = new azure.storage.Account("storage", {
 *     name: "example",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const exampleTimeSeriesInsightsGen2Environment = new azure.iot.TimeSeriesInsightsGen2Environment("example", {
 *     name: "example",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     skuName: "L1",
 *     idProperties: ["id"],
 *     storage: {
 *         name: storage.name,
 *         key: storage.primaryAccessKey,
 *     },
 * });
 * const exampleTimeSeriesInsightsEventSourceIothub = new azure.iot.TimeSeriesInsightsEventSourceIothub("example", {
 *     name: "example",
 *     location: example.location,
 *     environmentId: exampleTimeSeriesInsightsGen2Environment.id,
 *     iothubName: exampleIoTHub.name,
 *     sharedAccessKey: exampleIoTHub.sharedAccessPolicies.apply(sharedAccessPolicies => sharedAccessPolicies[0].primaryKey),
 *     sharedAccessKeyName: exampleIoTHub.sharedAccessPolicies.apply(sharedAccessPolicies => sharedAccessPolicies[0].keyName),
 *     consumerGroupName: exampleConsumerGroup.name,
 *     eventSourceResourceId: exampleIoTHub.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example",
 *     location="West Europe")
 * example_io_t_hub = azure.iot.IoTHub("example",
 *     name="example",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     sku=azure.iot.IoTHubSkuArgs(
 *         name="B1",
 *         capacity=1,
 *     ))
 * example_consumer_group = azure.iot.ConsumerGroup("example",
 *     name="example",
 *     iothub_name=example_io_t_hub.name,
 *     eventhub_endpoint_name="events",
 *     resource_group_name=example.name)
 * storage = azure.storage.Account("storage",
 *     name="example",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     account_tier="Standard",
 *     account_replication_type="LRS")
 * example_time_series_insights_gen2_environment = azure.iot.TimeSeriesInsightsGen2Environment("example",
 *     name="example",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku_name="L1",
 *     id_properties=["id"],
 *     storage=azure.iot.TimeSeriesInsightsGen2EnvironmentStorageArgs(
 *         name=storage.name,
 *         key=storage.primary_access_key,
 *     ))
 * example_time_series_insights_event_source_iothub = azure.iot.TimeSeriesInsightsEventSourceIothub("example",
 *     name="example",
 *     location=example.location,
 *     environment_id=example_time_series_insights_gen2_environment.id,
 *     iothub_name=example_io_t_hub.name,
 *     shared_access_key=example_io_t_hub.shared_access_policies[0].primary_key,
 *     shared_access_key_name=example_io_t_hub.shared_access_policies[0].key_name,
 *     consumer_group_name=example_consumer_group.name,
 *     event_source_resource_id=example_io_t_hub.id)
 * ```
 * ```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",
 *         Location = "West Europe",
 *     });
 *     var exampleIoTHub = new Azure.Iot.IoTHub("example", new()
 *     {
 *         Name = "example",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Sku = new Azure.Iot.Inputs.IoTHubSkuArgs
 *         {
 *             Name = "B1",
 *             Capacity = 1,
 *         },
 *     });
 *     var exampleConsumerGroup = new Azure.Iot.ConsumerGroup("example", new()
 *     {
 *         Name = "example",
 *         IothubName = exampleIoTHub.Name,
 *         EventhubEndpointName = "events",
 *         ResourceGroupName = example.Name,
 *     });
 *     var storage = new Azure.Storage.Account("storage", new()
 *     {
 *         Name = "example",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *     });
 *     var exampleTimeSeriesInsightsGen2Environment = new Azure.Iot.TimeSeriesInsightsGen2Environment("example", new()
 *     {
 *         Name = "example",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         SkuName = "L1",
 *         IdProperties = new[]
 *         {
 *             "id",
 *         },
 *         Storage = new Azure.Iot.Inputs.TimeSeriesInsightsGen2EnvironmentStorageArgs
 *         {
 *             Name = storage.Name,
 *             Key = storage.PrimaryAccessKey,
 *         },
 *     });
 *     var exampleTimeSeriesInsightsEventSourceIothub = new Azure.Iot.TimeSeriesInsightsEventSourceIothub("example", new()
 *     {
 *         Name = "example",
 *         Location = example.Location,
 *         EnvironmentId = exampleTimeSeriesInsightsGen2Environment.Id,
 *         IothubName = exampleIoTHub.Name,
 *         SharedAccessKey = exampleIoTHub.SharedAccessPolicies.Apply(sharedAccessPolicies => sharedAccessPolicies[0].PrimaryKey),
 *         SharedAccessKeyName = exampleIoTHub.SharedAccessPolicies.Apply(sharedAccessPolicies => sharedAccessPolicies[0].KeyName),
 *         ConsumerGroupName = exampleConsumerGroup.Name,
 *         EventSourceResourceId = exampleIoTHub.Id,
 *     });
 * });
 * ```
 * ```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"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		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("B1"),
 * 				Capacity: pulumi.Int(1),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleConsumerGroup, err := iot.NewConsumerGroup(ctx, "example", &iot.ConsumerGroupArgs{
 * 			Name:                 pulumi.String("example"),
 * 			IothubName:           exampleIoTHub.Name,
 * 			EventhubEndpointName: pulumi.String("events"),
 * 			ResourceGroupName:    example.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		storage, err := storage.NewAccount(ctx, "storage", &storage.AccountArgs{
 * 			Name:                   pulumi.String("example"),
 * 			Location:               example.Location,
 * 			ResourceGroupName:      example.Name,
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("LRS"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleTimeSeriesInsightsGen2Environment, err := iot.NewTimeSeriesInsightsGen2Environment(ctx, "example", &iot.TimeSeriesInsightsGen2EnvironmentArgs{
 * 			Name:              pulumi.String("example"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			SkuName:           pulumi.String("L1"),
 * 			IdProperties: pulumi.StringArray{
 * 				pulumi.String("id"),
 * 			},
 * 			Storage: &iot.TimeSeriesInsightsGen2EnvironmentStorageArgs{
 * 				Name: storage.Name,
 * 				Key:  storage.PrimaryAccessKey,
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = iot.NewTimeSeriesInsightsEventSourceIothub(ctx, "example", &iot.TimeSeriesInsightsEventSourceIothubArgs{
 * 			Name:          pulumi.String("example"),
 * 			Location:      example.Location,
 * 			EnvironmentId: exampleTimeSeriesInsightsGen2Environment.ID(),
 * 			IothubName:    exampleIoTHub.Name,
 * 			SharedAccessKey: exampleIoTHub.SharedAccessPolicies.ApplyT(func(sharedAccessPolicies []iot.IoTHubSharedAccessPolicy) (*string, error) {
 * 				return &sharedAccessPolicies[0].PrimaryKey, nil
 * 			}).(pulumi.StringPtrOutput),
 * 			SharedAccessKeyName: exampleIoTHub.SharedAccessPolicies.ApplyT(func(sharedAccessPolicies []iot.IoTHubSharedAccessPolicy) (*string, error) {
 * 				return &sharedAccessPolicies[0].KeyName, nil
 * 			}).(pulumi.StringPtrOutput),
 * 			ConsumerGroupName:     exampleConsumerGroup.Name,
 * 			EventSourceResourceId: exampleIoTHub.ID(),
 * 		})
 * 		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.iot.IoTHub;
 * import com.pulumi.azure.iot.IoTHubArgs;
 * import com.pulumi.azure.iot.inputs.IoTHubSkuArgs;
 * import com.pulumi.azure.iot.ConsumerGroup;
 * import com.pulumi.azure.iot.ConsumerGroupArgs;
 * import com.pulumi.azure.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.iot.TimeSeriesInsightsGen2Environment;
 * import com.pulumi.azure.iot.TimeSeriesInsightsGen2EnvironmentArgs;
 * import com.pulumi.azure.iot.inputs.TimeSeriesInsightsGen2EnvironmentStorageArgs;
 * import com.pulumi.azure.iot.TimeSeriesInsightsEventSourceIothub;
 * import com.pulumi.azure.iot.TimeSeriesInsightsEventSourceIothubArgs;
 * 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")
 *             .location("West Europe")
 *             .build());
 *         var exampleIoTHub = new IoTHub("exampleIoTHub", IoTHubArgs.builder()
 *             .name("example")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .sku(IoTHubSkuArgs.builder()
 *                 .name("B1")
 *                 .capacity("1")
 *                 .build())
 *             .build());
 *         var exampleConsumerGroup = new ConsumerGroup("exampleConsumerGroup", ConsumerGroupArgs.builder()
 *             .name("example")
 *             .iothubName(exampleIoTHub.name())
 *             .eventhubEndpointName("events")
 *             .resourceGroupName(example.name())
 *             .build());
 *         var storage = new Account("storage", AccountArgs.builder()
 *             .name("example")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var exampleTimeSeriesInsightsGen2Environment = new TimeSeriesInsightsGen2Environment("exampleTimeSeriesInsightsGen2Environment", TimeSeriesInsightsGen2EnvironmentArgs.builder()
 *             .name("example")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .skuName("L1")
 *             .idProperties("id")
 *             .storage(TimeSeriesInsightsGen2EnvironmentStorageArgs.builder()
 *                 .name(storage.name())
 *                 .key(storage.primaryAccessKey())
 *                 .build())
 *             .build());
 *         var exampleTimeSeriesInsightsEventSourceIothub = new TimeSeriesInsightsEventSourceIothub("exampleTimeSeriesInsightsEventSourceIothub", TimeSeriesInsightsEventSourceIothubArgs.builder()
 *             .name("example")
 *             .location(example.location())
 *             .environmentId(exampleTimeSeriesInsightsGen2Environment.id())
 *             .iothubName(exampleIoTHub.name())
 *             .sharedAccessKey(exampleIoTHub.sharedAccessPolicies().applyValue(sharedAccessPolicies -> sharedAccessPolicies[0].primaryKey()))
 *             .sharedAccessKeyName(exampleIoTHub.sharedAccessPolicies().applyValue(sharedAccessPolicies -> sharedAccessPolicies[0].keyName()))
 *             .consumerGroupName(exampleConsumerGroup.name())
 *             .eventSourceResourceId(exampleIoTHub.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example
 *       location: West Europe
 *   exampleIoTHub:
 *     type: azure:iot:IoTHub
 *     name: example
 *     properties:
 *       name: example
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       sku:
 *         name: B1
 *         capacity: '1'
 *   exampleConsumerGroup:
 *     type: azure:iot:ConsumerGroup
 *     name: example
 *     properties:
 *       name: example
 *       iothubName: ${exampleIoTHub.name}
 *       eventhubEndpointName: events
 *       resourceGroupName: ${example.name}
 *   storage:
 *     type: azure:storage:Account
 *     properties:
 *       name: example
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *   exampleTimeSeriesInsightsGen2Environment:
 *     type: azure:iot:TimeSeriesInsightsGen2Environment
 *     name: example
 *     properties:
 *       name: example
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       skuName: L1
 *       idProperties:
 *         - id
 *       storage:
 *         name: ${storage.name}
 *         key: ${storage.primaryAccessKey}
 *   exampleTimeSeriesInsightsEventSourceIothub:
 *     type: azure:iot:TimeSeriesInsightsEventSourceIothub
 *     name: example
 *     properties:
 *       name: example
 *       location: ${example.location}
 *       environmentId: ${exampleTimeSeriesInsightsGen2Environment.id}
 *       iothubName: ${exampleIoTHub.name}
 *       sharedAccessKey: ${exampleIoTHub.sharedAccessPolicies[0].primaryKey}
 *       sharedAccessKeyName: ${exampleIoTHub.sharedAccessPolicies[0].keyName}
 *       consumerGroupName: ${exampleConsumerGroup.name}
 *       eventSourceResourceId: ${exampleIoTHub.id}
 * ```
 * 
 * ## Import
 * Azure IoT Time Series Insights IoTHub Event Source can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:iot/timeSeriesInsightsEventSourceIothub:TimeSeriesInsightsEventSourceIothub example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example/providers/Microsoft.TimeSeriesInsights/environments/environment1/eventSources/example
 * ```
 */
public class TimeSeriesInsightsEventSourceIothub internal constructor(
    override val javaResource: com.pulumi.azure.iot.TimeSeriesInsightsEventSourceIothub,
) : KotlinCustomResource(javaResource, TimeSeriesInsightsEventSourceIothubMapper) {
    /**
     * Specifies the name of the IotHub Consumer Group that holds the partitions from which events will be read.
     */
    public val consumerGroupName: Output
        get() = javaResource.consumerGroupName().applyValue({ args0 -> args0 })

    /**
     * Specifies the id of the IoT Time Series Insights Environment that the Event Source should be associated with. Changing this forces a new resource to created.
     */
    public val environmentId: Output
        get() = javaResource.environmentId().applyValue({ args0 -> args0 })

    /**
     * Specifies the resource id where events will be coming from.
     */
    public val eventSourceResourceId: Output
        get() = javaResource.eventSourceResourceId().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the IotHub which will be associated with this resource.
     */
    public val iothubName: Output
        get() = javaResource.iothubName().applyValue({ args0 -> args0 })

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

    /**
     * Specifies the name of the Azure IoT Time Series Insights IoTHub Event Source. Changing this forces a new resource to be created. Must be globally unique.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Specifies the value of the Shared Access Policy key that grants the Time Series Insights service read access to the IotHub.
     */
    public val sharedAccessKey: Output
        get() = javaResource.sharedAccessKey().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the Shared Access key that grants the Event Source access to the IotHub.
     */
    public val sharedAccessKeyName: Output
        get() = javaResource.sharedAccessKeyName().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags to assign to the resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Specifies the value that will be used as the event source's timestamp. This value defaults to the event creation time.
     */
    public val timestampPropertyName: Output
        get() = javaResource.timestampPropertyName().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy