# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import copy
import warnings
import sys
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
if sys.version_info >= (3, 11):
    from typing import NotRequired, TypedDict, TypeAlias
else:
    from typing_extensions import NotRequired, TypedDict, TypeAlias
from .. import _utilities

__all__ = ['EndpointEventHubArgs', 'EndpointEventHub']

@pulumi.input_type
class EndpointEventHubArgs:
    def __init__(__self__, *,
                 digital_twins_id: pulumi.Input[str],
                 eventhub_primary_connection_string: pulumi.Input[str],
                 eventhub_secondary_connection_string: pulumi.Input[str],
                 dead_letter_storage_secret: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None):
        """
        The set of arguments for constructing a EndpointEventHub resource.
        :param pulumi.Input[str] digital_twins_id: The resource ID of the Digital Twins Instance. Changing this forces a new Digital Twins Event Hub Endpoint to be created.
        :param pulumi.Input[str] eventhub_primary_connection_string: The primary connection string of the Event Hub Authorization Rule with a minimum of `send` permission.
        :param pulumi.Input[str] eventhub_secondary_connection_string: The secondary connection string of the Event Hub Authorization Rule with a minimum of `send` permission.
        :param pulumi.Input[str] dead_letter_storage_secret: The storage secret of the dead-lettering, whose format is `https://<storageAccountname>.blob.core.windows.net/<containerName>?<SASToken>`. When an endpoint can't deliver an event within a certain time period or after trying to deliver the event a certain number of times, it can send the undelivered event to a storage account.
        :param pulumi.Input[str] name: The name which should be used for this Digital Twins Event Hub Endpoint. Changing this forces a new Digital Twins Event Hub Endpoint to be created.
        """
        pulumi.set(__self__, "digital_twins_id", digital_twins_id)
        pulumi.set(__self__, "eventhub_primary_connection_string", eventhub_primary_connection_string)
        pulumi.set(__self__, "eventhub_secondary_connection_string", eventhub_secondary_connection_string)
        if dead_letter_storage_secret is not None:
            pulumi.set(__self__, "dead_letter_storage_secret", dead_letter_storage_secret)
        if name is not None:
            pulumi.set(__self__, "name", name)

    @property
    @pulumi.getter(name="digitalTwinsId")
    def digital_twins_id(self) -> pulumi.Input[str]:
        """
        The resource ID of the Digital Twins Instance. Changing this forces a new Digital Twins Event Hub Endpoint to be created.
        """
        return pulumi.get(self, "digital_twins_id")

    @digital_twins_id.setter
    def digital_twins_id(self, value: pulumi.Input[str]):
        pulumi.set(self, "digital_twins_id", value)

    @property
    @pulumi.getter(name="eventhubPrimaryConnectionString")
    def eventhub_primary_connection_string(self) -> pulumi.Input[str]:
        """
        The primary connection string of the Event Hub Authorization Rule with a minimum of `send` permission.
        """
        return pulumi.get(self, "eventhub_primary_connection_string")

    @eventhub_primary_connection_string.setter
    def eventhub_primary_connection_string(self, value: pulumi.Input[str]):
        pulumi.set(self, "eventhub_primary_connection_string", value)

    @property
    @pulumi.getter(name="eventhubSecondaryConnectionString")
    def eventhub_secondary_connection_string(self) -> pulumi.Input[str]:
        """
        The secondary connection string of the Event Hub Authorization Rule with a minimum of `send` permission.
        """
        return pulumi.get(self, "eventhub_secondary_connection_string")

    @eventhub_secondary_connection_string.setter
    def eventhub_secondary_connection_string(self, value: pulumi.Input[str]):
        pulumi.set(self, "eventhub_secondary_connection_string", value)

    @property
    @pulumi.getter(name="deadLetterStorageSecret")
    def dead_letter_storage_secret(self) -> Optional[pulumi.Input[str]]:
        """
        The storage secret of the dead-lettering, whose format is `https://<storageAccountname>.blob.core.windows.net/<containerName>?<SASToken>`. When an endpoint can't deliver an event within a certain time period or after trying to deliver the event a certain number of times, it can send the undelivered event to a storage account.
        """
        return pulumi.get(self, "dead_letter_storage_secret")

    @dead_letter_storage_secret.setter
    def dead_letter_storage_secret(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "dead_letter_storage_secret", value)

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[str]]:
        """
        The name which should be used for this Digital Twins Event Hub Endpoint. Changing this forces a new Digital Twins Event Hub Endpoint to be created.
        """
        return pulumi.get(self, "name")

    @name.setter
    def name(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "name", value)


@pulumi.input_type
class _EndpointEventHubState:
    def __init__(__self__, *,
                 dead_letter_storage_secret: Optional[pulumi.Input[str]] = None,
                 digital_twins_id: Optional[pulumi.Input[str]] = None,
                 eventhub_primary_connection_string: Optional[pulumi.Input[str]] = None,
                 eventhub_secondary_connection_string: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering EndpointEventHub resources.
        :param pulumi.Input[str] dead_letter_storage_secret: The storage secret of the dead-lettering, whose format is `https://<storageAccountname>.blob.core.windows.net/<containerName>?<SASToken>`. When an endpoint can't deliver an event within a certain time period or after trying to deliver the event a certain number of times, it can send the undelivered event to a storage account.
        :param pulumi.Input[str] digital_twins_id: The resource ID of the Digital Twins Instance. Changing this forces a new Digital Twins Event Hub Endpoint to be created.
        :param pulumi.Input[str] eventhub_primary_connection_string: The primary connection string of the Event Hub Authorization Rule with a minimum of `send` permission.
        :param pulumi.Input[str] eventhub_secondary_connection_string: The secondary connection string of the Event Hub Authorization Rule with a minimum of `send` permission.
        :param pulumi.Input[str] name: The name which should be used for this Digital Twins Event Hub Endpoint. Changing this forces a new Digital Twins Event Hub Endpoint to be created.
        """
        if dead_letter_storage_secret is not None:
            pulumi.set(__self__, "dead_letter_storage_secret", dead_letter_storage_secret)
        if digital_twins_id is not None:
            pulumi.set(__self__, "digital_twins_id", digital_twins_id)
        if eventhub_primary_connection_string is not None:
            pulumi.set(__self__, "eventhub_primary_connection_string", eventhub_primary_connection_string)
        if eventhub_secondary_connection_string is not None:
            pulumi.set(__self__, "eventhub_secondary_connection_string", eventhub_secondary_connection_string)
        if name is not None:
            pulumi.set(__self__, "name", name)

    @property
    @pulumi.getter(name="deadLetterStorageSecret")
    def dead_letter_storage_secret(self) -> Optional[pulumi.Input[str]]:
        """
        The storage secret of the dead-lettering, whose format is `https://<storageAccountname>.blob.core.windows.net/<containerName>?<SASToken>`. When an endpoint can't deliver an event within a certain time period or after trying to deliver the event a certain number of times, it can send the undelivered event to a storage account.
        """
        return pulumi.get(self, "dead_letter_storage_secret")

    @dead_letter_storage_secret.setter
    def dead_letter_storage_secret(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "dead_letter_storage_secret", value)

    @property
    @pulumi.getter(name="digitalTwinsId")
    def digital_twins_id(self) -> Optional[pulumi.Input[str]]:
        """
        The resource ID of the Digital Twins Instance. Changing this forces a new Digital Twins Event Hub Endpoint to be created.
        """
        return pulumi.get(self, "digital_twins_id")

    @digital_twins_id.setter
    def digital_twins_id(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "digital_twins_id", value)

    @property
    @pulumi.getter(name="eventhubPrimaryConnectionString")
    def eventhub_primary_connection_string(self) -> Optional[pulumi.Input[str]]:
        """
        The primary connection string of the Event Hub Authorization Rule with a minimum of `send` permission.
        """
        return pulumi.get(self, "eventhub_primary_connection_string")

    @eventhub_primary_connection_string.setter
    def eventhub_primary_connection_string(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "eventhub_primary_connection_string", value)

    @property
    @pulumi.getter(name="eventhubSecondaryConnectionString")
    def eventhub_secondary_connection_string(self) -> Optional[pulumi.Input[str]]:
        """
        The secondary connection string of the Event Hub Authorization Rule with a minimum of `send` permission.
        """
        return pulumi.get(self, "eventhub_secondary_connection_string")

    @eventhub_secondary_connection_string.setter
    def eventhub_secondary_connection_string(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "eventhub_secondary_connection_string", value)

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[str]]:
        """
        The name which should be used for this Digital Twins Event Hub Endpoint. Changing this forces a new Digital Twins Event Hub Endpoint to be created.
        """
        return pulumi.get(self, "name")

    @name.setter
    def name(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "name", value)


class EndpointEventHub(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 dead_letter_storage_secret: Optional[pulumi.Input[str]] = None,
                 digital_twins_id: Optional[pulumi.Input[str]] = None,
                 eventhub_primary_connection_string: Optional[pulumi.Input[str]] = None,
                 eventhub_secondary_connection_string: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Manages a Digital Twins Event Hub Endpoint.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure

        example = azure.core.ResourceGroup("example",
            name="example_resources",
            location="West Europe")
        example_instance = azure.digitaltwins.Instance("example",
            name="example-DT",
            resource_group_name=example.name,
            location=example.location)
        example_event_hub_namespace = azure.eventhub.EventHubNamespace("example",
            name="example-eh-ns",
            location=example.location,
            resource_group_name=example.name,
            sku="Standard")
        example_event_hub = azure.eventhub.EventHub("example",
            name="example-eh",
            namespace_name=example_event_hub_namespace.name,
            resource_group_name=example.name,
            partition_count=2,
            message_retention=1)
        example_authorization_rule = azure.eventhub.AuthorizationRule("example",
            name="example-ar",
            namespace_name=example_event_hub_namespace.name,
            eventhub_name=example_event_hub.name,
            resource_group_name=example.name,
            listen=False,
            send=True,
            manage=False)
        example_endpoint_event_hub = azure.digitaltwins.EndpointEventHub("example",
            name="example-EH",
            digital_twins_id=example_instance.id,
            eventhub_primary_connection_string=example_authorization_rule.primary_connection_string,
            eventhub_secondary_connection_string=example_authorization_rule.secondary_connection_string)
        ```

        ## Import

        Digital Twins Eventhub Endpoints can be imported using the `resource id`, e.g.

        ```sh
        $ pulumi import azure:digitaltwins/endpointEventHub:EndpointEventHub example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/dt1/endpoints/ep1
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] dead_letter_storage_secret: The storage secret of the dead-lettering, whose format is `https://<storageAccountname>.blob.core.windows.net/<containerName>?<SASToken>`. When an endpoint can't deliver an event within a certain time period or after trying to deliver the event a certain number of times, it can send the undelivered event to a storage account.
        :param pulumi.Input[str] digital_twins_id: The resource ID of the Digital Twins Instance. Changing this forces a new Digital Twins Event Hub Endpoint to be created.
        :param pulumi.Input[str] eventhub_primary_connection_string: The primary connection string of the Event Hub Authorization Rule with a minimum of `send` permission.
        :param pulumi.Input[str] eventhub_secondary_connection_string: The secondary connection string of the Event Hub Authorization Rule with a minimum of `send` permission.
        :param pulumi.Input[str] name: The name which should be used for this Digital Twins Event Hub Endpoint. Changing this forces a new Digital Twins Event Hub Endpoint to be created.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: EndpointEventHubArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Manages a Digital Twins Event Hub Endpoint.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure

        example = azure.core.ResourceGroup("example",
            name="example_resources",
            location="West Europe")
        example_instance = azure.digitaltwins.Instance("example",
            name="example-DT",
            resource_group_name=example.name,
            location=example.location)
        example_event_hub_namespace = azure.eventhub.EventHubNamespace("example",
            name="example-eh-ns",
            location=example.location,
            resource_group_name=example.name,
            sku="Standard")
        example_event_hub = azure.eventhub.EventHub("example",
            name="example-eh",
            namespace_name=example_event_hub_namespace.name,
            resource_group_name=example.name,
            partition_count=2,
            message_retention=1)
        example_authorization_rule = azure.eventhub.AuthorizationRule("example",
            name="example-ar",
            namespace_name=example_event_hub_namespace.name,
            eventhub_name=example_event_hub.name,
            resource_group_name=example.name,
            listen=False,
            send=True,
            manage=False)
        example_endpoint_event_hub = azure.digitaltwins.EndpointEventHub("example",
            name="example-EH",
            digital_twins_id=example_instance.id,
            eventhub_primary_connection_string=example_authorization_rule.primary_connection_string,
            eventhub_secondary_connection_string=example_authorization_rule.secondary_connection_string)
        ```

        ## Import

        Digital Twins Eventhub Endpoints can be imported using the `resource id`, e.g.

        ```sh
        $ pulumi import azure:digitaltwins/endpointEventHub:EndpointEventHub example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/dt1/endpoints/ep1
        ```

        :param str resource_name: The name of the resource.
        :param EndpointEventHubArgs args: The arguments to use to populate this resource's properties.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        ...
    def __init__(__self__, resource_name: str, *args, **kwargs):
        resource_args, opts = _utilities.get_resource_args_opts(EndpointEventHubArgs, pulumi.ResourceOptions, *args, **kwargs)
        if resource_args is not None:
            __self__._internal_init(resource_name, opts, **resource_args.__dict__)
        else:
            __self__._internal_init(resource_name, *args, **kwargs)

    def _internal_init(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 dead_letter_storage_secret: Optional[pulumi.Input[str]] = None,
                 digital_twins_id: Optional[pulumi.Input[str]] = None,
                 eventhub_primary_connection_string: Optional[pulumi.Input[str]] = None,
                 eventhub_secondary_connection_string: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = EndpointEventHubArgs.__new__(EndpointEventHubArgs)

            __props__.__dict__["dead_letter_storage_secret"] = None if dead_letter_storage_secret is None else pulumi.Output.secret(dead_letter_storage_secret)
            if digital_twins_id is None and not opts.urn:
                raise TypeError("Missing required property 'digital_twins_id'")
            __props__.__dict__["digital_twins_id"] = digital_twins_id
            if eventhub_primary_connection_string is None and not opts.urn:
                raise TypeError("Missing required property 'eventhub_primary_connection_string'")
            __props__.__dict__["eventhub_primary_connection_string"] = None if eventhub_primary_connection_string is None else pulumi.Output.secret(eventhub_primary_connection_string)
            if eventhub_secondary_connection_string is None and not opts.urn:
                raise TypeError("Missing required property 'eventhub_secondary_connection_string'")
            __props__.__dict__["eventhub_secondary_connection_string"] = None if eventhub_secondary_connection_string is None else pulumi.Output.secret(eventhub_secondary_connection_string)
            __props__.__dict__["name"] = name
        secret_opts = pulumi.ResourceOptions(additional_secret_outputs=["deadLetterStorageSecret", "eventhubPrimaryConnectionString", "eventhubSecondaryConnectionString"])
        opts = pulumi.ResourceOptions.merge(opts, secret_opts)
        super(EndpointEventHub, __self__).__init__(
            'azure:digitaltwins/endpointEventHub:EndpointEventHub',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            dead_letter_storage_secret: Optional[pulumi.Input[str]] = None,
            digital_twins_id: Optional[pulumi.Input[str]] = None,
            eventhub_primary_connection_string: Optional[pulumi.Input[str]] = None,
            eventhub_secondary_connection_string: Optional[pulumi.Input[str]] = None,
            name: Optional[pulumi.Input[str]] = None) -> 'EndpointEventHub':
        """
        Get an existing EndpointEventHub resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] dead_letter_storage_secret: The storage secret of the dead-lettering, whose format is `https://<storageAccountname>.blob.core.windows.net/<containerName>?<SASToken>`. When an endpoint can't deliver an event within a certain time period or after trying to deliver the event a certain number of times, it can send the undelivered event to a storage account.
        :param pulumi.Input[str] digital_twins_id: The resource ID of the Digital Twins Instance. Changing this forces a new Digital Twins Event Hub Endpoint to be created.
        :param pulumi.Input[str] eventhub_primary_connection_string: The primary connection string of the Event Hub Authorization Rule with a minimum of `send` permission.
        :param pulumi.Input[str] eventhub_secondary_connection_string: The secondary connection string of the Event Hub Authorization Rule with a minimum of `send` permission.
        :param pulumi.Input[str] name: The name which should be used for this Digital Twins Event Hub Endpoint. Changing this forces a new Digital Twins Event Hub Endpoint to be created.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _EndpointEventHubState.__new__(_EndpointEventHubState)

        __props__.__dict__["dead_letter_storage_secret"] = dead_letter_storage_secret
        __props__.__dict__["digital_twins_id"] = digital_twins_id
        __props__.__dict__["eventhub_primary_connection_string"] = eventhub_primary_connection_string
        __props__.__dict__["eventhub_secondary_connection_string"] = eventhub_secondary_connection_string
        __props__.__dict__["name"] = name
        return EndpointEventHub(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="deadLetterStorageSecret")
    def dead_letter_storage_secret(self) -> pulumi.Output[Optional[str]]:
        """
        The storage secret of the dead-lettering, whose format is `https://<storageAccountname>.blob.core.windows.net/<containerName>?<SASToken>`. When an endpoint can't deliver an event within a certain time period or after trying to deliver the event a certain number of times, it can send the undelivered event to a storage account.
        """
        return pulumi.get(self, "dead_letter_storage_secret")

    @property
    @pulumi.getter(name="digitalTwinsId")
    def digital_twins_id(self) -> pulumi.Output[str]:
        """
        The resource ID of the Digital Twins Instance. Changing this forces a new Digital Twins Event Hub Endpoint to be created.
        """
        return pulumi.get(self, "digital_twins_id")

    @property
    @pulumi.getter(name="eventhubPrimaryConnectionString")
    def eventhub_primary_connection_string(self) -> pulumi.Output[str]:
        """
        The primary connection string of the Event Hub Authorization Rule with a minimum of `send` permission.
        """
        return pulumi.get(self, "eventhub_primary_connection_string")

    @property
    @pulumi.getter(name="eventhubSecondaryConnectionString")
    def eventhub_secondary_connection_string(self) -> pulumi.Output[str]:
        """
        The secondary connection string of the Event Hub Authorization Rule with a minimum of `send` permission.
        """
        return pulumi.get(self, "eventhub_secondary_connection_string")

    @property
    @pulumi.getter
    def name(self) -> pulumi.Output[str]:
        """
        The name which should be used for this Digital Twins Event Hub Endpoint. Changing this forces a new Digital Twins Event Hub Endpoint to be created.
        """
        return pulumi.get(self, "name")

