# 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 warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables

__all__ = ['CertificateBinding']


class CertificateBinding(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 certificate_id: Optional[pulumi.Input[str]] = None,
                 hostname_binding_id: Optional[pulumi.Input[str]] = None,
                 ssl_state: Optional[pulumi.Input[str]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        Manages an App Service Certificate Binding.

        ## Import

        App Service Certificate Bindings can be imported using the `resource id`, e.g.

        ```sh
         $ pulumi import azure:appservice/certificateBinding:CertificateBinding example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Web/sites/instance1/hostNameBindings/mywebsite.com
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] certificate_id: The ID of the certificate to bind to the custom domain. Changing this forces a new App Service Certificate Binding to be created.
        :param pulumi.Input[str] hostname_binding_id: The ID of the Custom Domain/Hostname Binding. Changing this forces a new App Service Certificate Binding to be created.
        :param pulumi.Input[str] ssl_state: The type of certificate binding. Allowed values are `IpBasedEnabled` or `SniEnabled`. Changing this forces a new App Service Certificate Binding to be created.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = _utilities.get_version()
        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__ = dict()

            if certificate_id is None and not opts.urn:
                raise TypeError("Missing required property 'certificate_id'")
            __props__['certificate_id'] = certificate_id
            if hostname_binding_id is None and not opts.urn:
                raise TypeError("Missing required property 'hostname_binding_id'")
            __props__['hostname_binding_id'] = hostname_binding_id
            if ssl_state is None and not opts.urn:
                raise TypeError("Missing required property 'ssl_state'")
            __props__['ssl_state'] = ssl_state
            __props__['app_service_name'] = None
            __props__['hostname'] = None
            __props__['thumbprint'] = None
        super(CertificateBinding, __self__).__init__(
            'azure:appservice/certificateBinding:CertificateBinding',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            app_service_name: Optional[pulumi.Input[str]] = None,
            certificate_id: Optional[pulumi.Input[str]] = None,
            hostname: Optional[pulumi.Input[str]] = None,
            hostname_binding_id: Optional[pulumi.Input[str]] = None,
            ssl_state: Optional[pulumi.Input[str]] = None,
            thumbprint: Optional[pulumi.Input[str]] = None) -> 'CertificateBinding':
        """
        Get an existing CertificateBinding 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] app_service_name: The name of the App Service to which the certificate was bound.
        :param pulumi.Input[str] certificate_id: The ID of the certificate to bind to the custom domain. Changing this forces a new App Service Certificate Binding to be created.
        :param pulumi.Input[str] hostname: The hostname of the bound certificate.
        :param pulumi.Input[str] hostname_binding_id: The ID of the Custom Domain/Hostname Binding. Changing this forces a new App Service Certificate Binding to be created.
        :param pulumi.Input[str] ssl_state: The type of certificate binding. Allowed values are `IpBasedEnabled` or `SniEnabled`. Changing this forces a new App Service Certificate Binding to be created.
        :param pulumi.Input[str] thumbprint: The certificate thumbprint.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["app_service_name"] = app_service_name
        __props__["certificate_id"] = certificate_id
        __props__["hostname"] = hostname
        __props__["hostname_binding_id"] = hostname_binding_id
        __props__["ssl_state"] = ssl_state
        __props__["thumbprint"] = thumbprint
        return CertificateBinding(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="appServiceName")
    def app_service_name(self) -> pulumi.Output[str]:
        """
        The name of the App Service to which the certificate was bound.
        """
        return pulumi.get(self, "app_service_name")

    @property
    @pulumi.getter(name="certificateId")
    def certificate_id(self) -> pulumi.Output[str]:
        """
        The ID of the certificate to bind to the custom domain. Changing this forces a new App Service Certificate Binding to be created.
        """
        return pulumi.get(self, "certificate_id")

    @property
    @pulumi.getter
    def hostname(self) -> pulumi.Output[str]:
        """
        The hostname of the bound certificate.
        """
        return pulumi.get(self, "hostname")

    @property
    @pulumi.getter(name="hostnameBindingId")
    def hostname_binding_id(self) -> pulumi.Output[str]:
        """
        The ID of the Custom Domain/Hostname Binding. Changing this forces a new App Service Certificate Binding to be created.
        """
        return pulumi.get(self, "hostname_binding_id")

    @property
    @pulumi.getter(name="sslState")
    def ssl_state(self) -> pulumi.Output[str]:
        """
        The type of certificate binding. Allowed values are `IpBasedEnabled` or `SniEnabled`. Changing this forces a new App Service Certificate Binding to be created.
        """
        return pulumi.get(self, "ssl_state")

    @property
    @pulumi.getter
    def thumbprint(self) -> pulumi.Output[str]:
        """
        The certificate thumbprint.
        """
        return pulumi.get(self, "thumbprint")

    def translate_output_property(self, prop):
        return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

