// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.azure.iot;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.iot.TimeSeriesInsightsEventSourceIothubArgs;
import com.pulumi.azure.iot.inputs.TimeSeriesInsightsEventSourceIothubState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Manages an Azure IoT Time Series Insights IoTHub Event Source.
 * 
 * ## Example Usage
 * ```java
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.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 exampleResourceGroup = new ResourceGroup(&#34;exampleResourceGroup&#34;, ResourceGroupArgs.builder()        
 *             .location(&#34;West Europe&#34;)
 *             .build());
 * 
 *         var exampleIoTHub = new IoTHub(&#34;exampleIoTHub&#34;, IoTHubArgs.builder()        
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .sku(IoTHubSkuArgs.builder()
 *                 .name(&#34;B1&#34;)
 *                 .capacity(&#34;1&#34;)
 *                 .build())
 *             .build());
 * 
 *         var exampleConsumerGroup = new ConsumerGroup(&#34;exampleConsumerGroup&#34;, ConsumerGroupArgs.builder()        
 *             .iothubName(exampleIoTHub.name())
 *             .eventhubEndpointName(&#34;events&#34;)
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .build());
 * 
 *         var storage = new Account(&#34;storage&#34;, AccountArgs.builder()        
 *             .location(exampleResourceGroup.location())
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .accountTier(&#34;Standard&#34;)
 *             .accountReplicationType(&#34;LRS&#34;)
 *             .build());
 * 
 *         var exampleTimeSeriesInsightsGen2Environment = new TimeSeriesInsightsGen2Environment(&#34;exampleTimeSeriesInsightsGen2Environment&#34;, TimeSeriesInsightsGen2EnvironmentArgs.builder()        
 *             .location(exampleResourceGroup.location())
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .skuName(&#34;L1&#34;)
 *             .idProperties(&#34;id&#34;)
 *             .storage(TimeSeriesInsightsGen2EnvironmentStorageArgs.builder()
 *                 .name(storage.name())
 *                 .key(storage.primaryAccessKey())
 *                 .build())
 *             .build());
 * 
 *         var exampleTimeSeriesInsightsEventSourceIothub = new TimeSeriesInsightsEventSourceIothub(&#34;exampleTimeSeriesInsightsEventSourceIothub&#34;, TimeSeriesInsightsEventSourceIothubArgs.builder()        
 *             .location(exampleResourceGroup.location())
 *             .environmentId(exampleTimeSeriesInsightsGen2Environment.id())
 *             .iothubName(exampleIoTHub.name())
 *             .sharedAccessKey(exampleIoTHub.sharedAccessPolicies().applyValue(sharedAccessPolicies -&gt; sharedAccessPolicies[0].primaryKey()))
 *             .sharedAccessKeyName(exampleIoTHub.sharedAccessPolicies().applyValue(sharedAccessPolicies -&gt; sharedAccessPolicies[0].keyName()))
 *             .consumerGroupName(exampleConsumerGroup.name())
 *             .eventSourceResourceId(exampleIoTHub.id())
 *             .build());
 * 
 *     }
 * }
 * ```
 * 
 * ## 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
 * ```
 * 
 */
@ResourceType(type="azure:iot/timeSeriesInsightsEventSourceIothub:TimeSeriesInsightsEventSourceIothub")
public class TimeSeriesInsightsEventSourceIothub extends com.pulumi.resources.CustomResource {
    /**
     * Specifies the name of the IotHub Consumer Group that holds the partitions from which events will be read.
     * 
     */
    @Export(name="consumerGroupName", refs={String.class}, tree="[0]")
    private Output<String> consumerGroupName;

    /**
     * @return Specifies the name of the IotHub Consumer Group that holds the partitions from which events will be read.
     * 
     */
    public Output<String> consumerGroupName() {
        return this.consumerGroupName;
    }
    /**
     * 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.
     * 
     */
    @Export(name="environmentId", refs={String.class}, tree="[0]")
    private Output<String> environmentId;

    /**
     * @return 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 Output<String> environmentId() {
        return this.environmentId;
    }
    /**
     * Specifies the resource id where events will be coming from.
     * 
     */
    @Export(name="eventSourceResourceId", refs={String.class}, tree="[0]")
    private Output<String> eventSourceResourceId;

    /**
     * @return Specifies the resource id where events will be coming from.
     * 
     */
    public Output<String> eventSourceResourceId() {
        return this.eventSourceResourceId;
    }
    /**
     * Specifies the name of the IotHub which will be associated with this resource.
     * 
     */
    @Export(name="iothubName", refs={String.class}, tree="[0]")
    private Output<String> iothubName;

    /**
     * @return Specifies the name of the IotHub which will be associated with this resource.
     * 
     */
    public Output<String> iothubName() {
        return this.iothubName;
    }
    /**
     * Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="location", refs={String.class}, tree="[0]")
    private Output<String> location;

    /**
     * @return Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> location() {
        return this.location;
    }
    /**
     * 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.
     * 
     */
    @Export(name="name", refs={String.class}, tree="[0]")
    private Output<String> name;

    /**
     * @return 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 Output<String> name() {
        return this.name;
    }
    /**
     * Specifies the value of the Shared Access Policy key that grants the Time Series Insights service read access to the IotHub.
     * 
     */
    @Export(name="sharedAccessKey", refs={String.class}, tree="[0]")
    private Output<String> sharedAccessKey;

    /**
     * @return Specifies the value of the Shared Access Policy key that grants the Time Series Insights service read access to the IotHub.
     * 
     */
    public Output<String> sharedAccessKey() {
        return this.sharedAccessKey;
    }
    /**
     * Specifies the name of the Shared Access key that grants the Event Source access to the IotHub.
     * 
     */
    @Export(name="sharedAccessKeyName", refs={String.class}, tree="[0]")
    private Output<String> sharedAccessKeyName;

    /**
     * @return Specifies the name of the Shared Access key that grants the Event Source access to the IotHub.
     * 
     */
    public Output<String> sharedAccessKeyName() {
        return this.sharedAccessKeyName;
    }
    /**
     * A mapping of tags to assign to the resource.
     * 
     */
    @Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]")
    private Output</* @Nullable */ Map<String,String>> tags;

    /**
     * @return A mapping of tags to assign to the resource.
     * 
     */
    public Output<Optional<Map<String,String>>> tags() {
        return Codegen.optional(this.tags);
    }
    /**
     * Specifies the value that will be used as the event source&#39;s timestamp. This value defaults to the event creation time.
     * 
     */
    @Export(name="timestampPropertyName", refs={String.class}, tree="[0]")
    private Output<String> timestampPropertyName;

    /**
     * @return Specifies the value that will be used as the event source&#39;s timestamp. This value defaults to the event creation time.
     * 
     */
    public Output<String> timestampPropertyName() {
        return this.timestampPropertyName;
    }

    /**
     *
     * @param name The _unique_ name of the resulting resource.
     */
    public TimeSeriesInsightsEventSourceIothub(String name) {
        this(name, TimeSeriesInsightsEventSourceIothubArgs.Empty);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     */
    public TimeSeriesInsightsEventSourceIothub(String name, TimeSeriesInsightsEventSourceIothubArgs args) {
        this(name, args, null);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     * @param options A bag of options that control this resource's behavior.
     */
    public TimeSeriesInsightsEventSourceIothub(String name, TimeSeriesInsightsEventSourceIothubArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:iot/timeSeriesInsightsEventSourceIothub:TimeSeriesInsightsEventSourceIothub", name, args == null ? TimeSeriesInsightsEventSourceIothubArgs.Empty : args, makeResourceOptions(options, Codegen.empty()));
    }

    private TimeSeriesInsightsEventSourceIothub(String name, Output<String> id, @Nullable TimeSeriesInsightsEventSourceIothubState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:iot/timeSeriesInsightsEventSourceIothub:TimeSeriesInsightsEventSourceIothub", name, state, makeResourceOptions(options, id));
    }

    private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output<String> id) {
        var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
            .version(Utilities.getVersion())
            .additionalSecretOutputs(List.of(
                "sharedAccessKey"
            ))
            .build();
        return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
    }

    /**
     * Get an existing Host resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state
     * @param options Optional settings to control the behavior of the CustomResource.
     */
    public static TimeSeriesInsightsEventSourceIothub get(String name, Output<String> id, @Nullable TimeSeriesInsightsEventSourceIothubState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        return new TimeSeriesInsightsEventSourceIothub(name, id, state, options);
    }
}
