# 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, overload
from .. import _utilities

__all__ = ['SpringCloudCertificateArgs', 'SpringCloudCertificate']

@pulumi.input_type
class SpringCloudCertificateArgs:
    def __init__(__self__, *,
                 resource_group_name: pulumi.Input[str],
                 service_name: pulumi.Input[str],
                 certificate_content: Optional[pulumi.Input[str]] = None,
                 key_vault_certificate_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None):
        """
        The set of arguments for constructing a SpringCloudCertificate resource.
        :param pulumi.Input[str] resource_group_name: Specifies the name of the resource group in which to create the Spring Cloud Certificate. Changing this forces a new resource to be created.
        :param pulumi.Input[str] service_name: Specifies the name of the Spring Cloud Service resource. Changing this forces a new resource to be created.
        :param pulumi.Input[str] certificate_content: The content of uploaded certificate. Changing this forces a new resource to be created.
        :param pulumi.Input[str] key_vault_certificate_id: Specifies the ID of the Key Vault Certificate resource. Changing this forces a new resource to be created.
        :param pulumi.Input[str] name: Specifies the name of the Spring Cloud Certificate. Changing this forces a new resource to be created.
        """
        pulumi.set(__self__, "resource_group_name", resource_group_name)
        pulumi.set(__self__, "service_name", service_name)
        if certificate_content is not None:
            pulumi.set(__self__, "certificate_content", certificate_content)
        if key_vault_certificate_id is not None:
            pulumi.set(__self__, "key_vault_certificate_id", key_vault_certificate_id)
        if name is not None:
            pulumi.set(__self__, "name", name)

    @property
    @pulumi.getter(name="resourceGroupName")
    def resource_group_name(self) -> pulumi.Input[str]:
        """
        Specifies the name of the resource group in which to create the Spring Cloud Certificate. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "resource_group_name")

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

    @property
    @pulumi.getter(name="serviceName")
    def service_name(self) -> pulumi.Input[str]:
        """
        Specifies the name of the Spring Cloud Service resource. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "service_name")

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

    @property
    @pulumi.getter(name="certificateContent")
    def certificate_content(self) -> Optional[pulumi.Input[str]]:
        """
        The content of uploaded certificate. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "certificate_content")

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

    @property
    @pulumi.getter(name="keyVaultCertificateId")
    def key_vault_certificate_id(self) -> Optional[pulumi.Input[str]]:
        """
        Specifies the ID of the Key Vault Certificate resource. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "key_vault_certificate_id")

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

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[str]]:
        """
        Specifies the name of the Spring Cloud Certificate. Changing this forces a new resource 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 _SpringCloudCertificateState:
    def __init__(__self__, *,
                 certificate_content: Optional[pulumi.Input[str]] = None,
                 key_vault_certificate_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 resource_group_name: Optional[pulumi.Input[str]] = None,
                 service_name: Optional[pulumi.Input[str]] = None,
                 thumbprint: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering SpringCloudCertificate resources.
        :param pulumi.Input[str] certificate_content: The content of uploaded certificate. Changing this forces a new resource to be created.
        :param pulumi.Input[str] key_vault_certificate_id: Specifies the ID of the Key Vault Certificate resource. Changing this forces a new resource to be created.
        :param pulumi.Input[str] name: Specifies the name of the Spring Cloud Certificate. Changing this forces a new resource to be created.
        :param pulumi.Input[str] resource_group_name: Specifies the name of the resource group in which to create the Spring Cloud Certificate. Changing this forces a new resource to be created.
        :param pulumi.Input[str] service_name: Specifies the name of the Spring Cloud Service resource. Changing this forces a new resource to be created.
        :param pulumi.Input[str] thumbprint: The thumbprint of the Spring Cloud certificate.
        """
        if certificate_content is not None:
            pulumi.set(__self__, "certificate_content", certificate_content)
        if key_vault_certificate_id is not None:
            pulumi.set(__self__, "key_vault_certificate_id", key_vault_certificate_id)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if resource_group_name is not None:
            pulumi.set(__self__, "resource_group_name", resource_group_name)
        if service_name is not None:
            pulumi.set(__self__, "service_name", service_name)
        if thumbprint is not None:
            pulumi.set(__self__, "thumbprint", thumbprint)

    @property
    @pulumi.getter(name="certificateContent")
    def certificate_content(self) -> Optional[pulumi.Input[str]]:
        """
        The content of uploaded certificate. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "certificate_content")

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

    @property
    @pulumi.getter(name="keyVaultCertificateId")
    def key_vault_certificate_id(self) -> Optional[pulumi.Input[str]]:
        """
        Specifies the ID of the Key Vault Certificate resource. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "key_vault_certificate_id")

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

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[str]]:
        """
        Specifies the name of the Spring Cloud Certificate. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "name")

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

    @property
    @pulumi.getter(name="resourceGroupName")
    def resource_group_name(self) -> Optional[pulumi.Input[str]]:
        """
        Specifies the name of the resource group in which to create the Spring Cloud Certificate. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "resource_group_name")

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

    @property
    @pulumi.getter(name="serviceName")
    def service_name(self) -> Optional[pulumi.Input[str]]:
        """
        Specifies the name of the Spring Cloud Service resource. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "service_name")

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

    @property
    @pulumi.getter
    def thumbprint(self) -> Optional[pulumi.Input[str]]:
        """
        The thumbprint of the Spring Cloud certificate.
        """
        return pulumi.get(self, "thumbprint")

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


class SpringCloudCertificate(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 certificate_content: Optional[pulumi.Input[str]] = None,
                 key_vault_certificate_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 resource_group_name: Optional[pulumi.Input[str]] = None,
                 service_name: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Manages an Azure Spring Cloud Certificate.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure
        import pulumi_azuread as azuread

        example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
        current = azure.core.get_client_config()
        example_service_principal = azuread.get_service_principal(display_name="Azure Spring Cloud Domain-Management")
        example_key_vault = azure.keyvault.KeyVault("exampleKeyVault",
            location=example_resource_group.location,
            resource_group_name=example_resource_group.name,
            tenant_id=current.tenant_id,
            sku_name="standard",
            access_policies=[
                azure.keyvault.KeyVaultAccessPolicyArgs(
                    tenant_id=current.tenant_id,
                    object_id=current.object_id,
                    secret_permissions=["set"],
                    certificate_permissions=[
                        "create",
                        "delete",
                        "get",
                        "update",
                    ],
                ),
                azure.keyvault.KeyVaultAccessPolicyArgs(
                    tenant_id=current.tenant_id,
                    object_id=example_service_principal.object_id,
                    secret_permissions=[
                        "get",
                        "list",
                    ],
                    certificate_permissions=[
                        "get",
                        "list",
                    ],
                ),
            ])
        example_certificate = azure.keyvault.Certificate("exampleCertificate",
            key_vault_id=example_key_vault.id,
            certificate_policy=azure.keyvault.CertificateCertificatePolicyArgs(
                issuer_parameters=azure.keyvault.CertificateCertificatePolicyIssuerParametersArgs(
                    name="Self",
                ),
                key_properties=azure.keyvault.CertificateCertificatePolicyKeyPropertiesArgs(
                    exportable=True,
                    key_size=2048,
                    key_type="RSA",
                    reuse_key=True,
                ),
                lifetime_actions=[azure.keyvault.CertificateCertificatePolicyLifetimeActionArgs(
                    action=azure.keyvault.CertificateCertificatePolicyLifetimeActionActionArgs(
                        action_type="AutoRenew",
                    ),
                    trigger=azure.keyvault.CertificateCertificatePolicyLifetimeActionTriggerArgs(
                        days_before_expiry=30,
                    ),
                )],
                secret_properties=azure.keyvault.CertificateCertificatePolicySecretPropertiesArgs(
                    content_type="application/x-pkcs12",
                ),
                x509_certificate_properties=azure.keyvault.CertificateCertificatePolicyX509CertificatePropertiesArgs(
                    key_usages=[
                        "cRLSign",
                        "dataEncipherment",
                        "digitalSignature",
                        "keyAgreement",
                        "keyCertSign",
                        "keyEncipherment",
                    ],
                    subject="CN=contoso.com",
                    validity_in_months=12,
                ),
            ))
        example_spring_cloud_service = azure.appplatform.SpringCloudService("exampleSpringCloudService",
            resource_group_name=example_resource_group.name,
            location=example_resource_group.location)
        example_spring_cloud_certificate = azure.appplatform.SpringCloudCertificate("exampleSpringCloudCertificate",
            resource_group_name=example_spring_cloud_service.resource_group_name,
            service_name=example_spring_cloud_service.name,
            key_vault_certificate_id=example_certificate.id)
        ```

        ## Import

        Spring Cloud Certificate can be imported using the `resource id`, e.g.

        ```sh
         $ pulumi import azure:appplatform/springCloudCertificate:SpringCloudCertificate example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup1/providers/Microsoft.AppPlatform/Spring/spring1/certificates/cert1
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] certificate_content: The content of uploaded certificate. Changing this forces a new resource to be created.
        :param pulumi.Input[str] key_vault_certificate_id: Specifies the ID of the Key Vault Certificate resource. Changing this forces a new resource to be created.
        :param pulumi.Input[str] name: Specifies the name of the Spring Cloud Certificate. Changing this forces a new resource to be created.
        :param pulumi.Input[str] resource_group_name: Specifies the name of the resource group in which to create the Spring Cloud Certificate. Changing this forces a new resource to be created.
        :param pulumi.Input[str] service_name: Specifies the name of the Spring Cloud Service resource. Changing this forces a new resource to be created.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: SpringCloudCertificateArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Manages an Azure Spring Cloud Certificate.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure
        import pulumi_azuread as azuread

        example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
        current = azure.core.get_client_config()
        example_service_principal = azuread.get_service_principal(display_name="Azure Spring Cloud Domain-Management")
        example_key_vault = azure.keyvault.KeyVault("exampleKeyVault",
            location=example_resource_group.location,
            resource_group_name=example_resource_group.name,
            tenant_id=current.tenant_id,
            sku_name="standard",
            access_policies=[
                azure.keyvault.KeyVaultAccessPolicyArgs(
                    tenant_id=current.tenant_id,
                    object_id=current.object_id,
                    secret_permissions=["set"],
                    certificate_permissions=[
                        "create",
                        "delete",
                        "get",
                        "update",
                    ],
                ),
                azure.keyvault.KeyVaultAccessPolicyArgs(
                    tenant_id=current.tenant_id,
                    object_id=example_service_principal.object_id,
                    secret_permissions=[
                        "get",
                        "list",
                    ],
                    certificate_permissions=[
                        "get",
                        "list",
                    ],
                ),
            ])
        example_certificate = azure.keyvault.Certificate("exampleCertificate",
            key_vault_id=example_key_vault.id,
            certificate_policy=azure.keyvault.CertificateCertificatePolicyArgs(
                issuer_parameters=azure.keyvault.CertificateCertificatePolicyIssuerParametersArgs(
                    name="Self",
                ),
                key_properties=azure.keyvault.CertificateCertificatePolicyKeyPropertiesArgs(
                    exportable=True,
                    key_size=2048,
                    key_type="RSA",
                    reuse_key=True,
                ),
                lifetime_actions=[azure.keyvault.CertificateCertificatePolicyLifetimeActionArgs(
                    action=azure.keyvault.CertificateCertificatePolicyLifetimeActionActionArgs(
                        action_type="AutoRenew",
                    ),
                    trigger=azure.keyvault.CertificateCertificatePolicyLifetimeActionTriggerArgs(
                        days_before_expiry=30,
                    ),
                )],
                secret_properties=azure.keyvault.CertificateCertificatePolicySecretPropertiesArgs(
                    content_type="application/x-pkcs12",
                ),
                x509_certificate_properties=azure.keyvault.CertificateCertificatePolicyX509CertificatePropertiesArgs(
                    key_usages=[
                        "cRLSign",
                        "dataEncipherment",
                        "digitalSignature",
                        "keyAgreement",
                        "keyCertSign",
                        "keyEncipherment",
                    ],
                    subject="CN=contoso.com",
                    validity_in_months=12,
                ),
            ))
        example_spring_cloud_service = azure.appplatform.SpringCloudService("exampleSpringCloudService",
            resource_group_name=example_resource_group.name,
            location=example_resource_group.location)
        example_spring_cloud_certificate = azure.appplatform.SpringCloudCertificate("exampleSpringCloudCertificate",
            resource_group_name=example_spring_cloud_service.resource_group_name,
            service_name=example_spring_cloud_service.name,
            key_vault_certificate_id=example_certificate.id)
        ```

        ## Import

        Spring Cloud Certificate can be imported using the `resource id`, e.g.

        ```sh
         $ pulumi import azure:appplatform/springCloudCertificate:SpringCloudCertificate example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup1/providers/Microsoft.AppPlatform/Spring/spring1/certificates/cert1
        ```

        :param str resource_name: The name of the resource.
        :param SpringCloudCertificateArgs 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(SpringCloudCertificateArgs, 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,
                 certificate_content: Optional[pulumi.Input[str]] = None,
                 key_vault_certificate_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 resource_group_name: Optional[pulumi.Input[str]] = None,
                 service_name: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        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__ = SpringCloudCertificateArgs.__new__(SpringCloudCertificateArgs)

            __props__.__dict__["certificate_content"] = certificate_content
            __props__.__dict__["key_vault_certificate_id"] = key_vault_certificate_id
            __props__.__dict__["name"] = name
            if resource_group_name is None and not opts.urn:
                raise TypeError("Missing required property 'resource_group_name'")
            __props__.__dict__["resource_group_name"] = resource_group_name
            if service_name is None and not opts.urn:
                raise TypeError("Missing required property 'service_name'")
            __props__.__dict__["service_name"] = service_name
            __props__.__dict__["thumbprint"] = None
        super(SpringCloudCertificate, __self__).__init__(
            'azure:appplatform/springCloudCertificate:SpringCloudCertificate',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            certificate_content: Optional[pulumi.Input[str]] = None,
            key_vault_certificate_id: Optional[pulumi.Input[str]] = None,
            name: Optional[pulumi.Input[str]] = None,
            resource_group_name: Optional[pulumi.Input[str]] = None,
            service_name: Optional[pulumi.Input[str]] = None,
            thumbprint: Optional[pulumi.Input[str]] = None) -> 'SpringCloudCertificate':
        """
        Get an existing SpringCloudCertificate 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] certificate_content: The content of uploaded certificate. Changing this forces a new resource to be created.
        :param pulumi.Input[str] key_vault_certificate_id: Specifies the ID of the Key Vault Certificate resource. Changing this forces a new resource to be created.
        :param pulumi.Input[str] name: Specifies the name of the Spring Cloud Certificate. Changing this forces a new resource to be created.
        :param pulumi.Input[str] resource_group_name: Specifies the name of the resource group in which to create the Spring Cloud Certificate. Changing this forces a new resource to be created.
        :param pulumi.Input[str] service_name: Specifies the name of the Spring Cloud Service resource. Changing this forces a new resource to be created.
        :param pulumi.Input[str] thumbprint: The thumbprint of the Spring Cloud certificate.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _SpringCloudCertificateState.__new__(_SpringCloudCertificateState)

        __props__.__dict__["certificate_content"] = certificate_content
        __props__.__dict__["key_vault_certificate_id"] = key_vault_certificate_id
        __props__.__dict__["name"] = name
        __props__.__dict__["resource_group_name"] = resource_group_name
        __props__.__dict__["service_name"] = service_name
        __props__.__dict__["thumbprint"] = thumbprint
        return SpringCloudCertificate(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="certificateContent")
    def certificate_content(self) -> pulumi.Output[Optional[str]]:
        """
        The content of uploaded certificate. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "certificate_content")

    @property
    @pulumi.getter(name="keyVaultCertificateId")
    def key_vault_certificate_id(self) -> pulumi.Output[Optional[str]]:
        """
        Specifies the ID of the Key Vault Certificate resource. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "key_vault_certificate_id")

    @property
    @pulumi.getter
    def name(self) -> pulumi.Output[str]:
        """
        Specifies the name of the Spring Cloud Certificate. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "name")

    @property
    @pulumi.getter(name="resourceGroupName")
    def resource_group_name(self) -> pulumi.Output[str]:
        """
        Specifies the name of the resource group in which to create the Spring Cloud Certificate. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "resource_group_name")

    @property
    @pulumi.getter(name="serviceName")
    def service_name(self) -> pulumi.Output[str]:
        """
        Specifies the name of the Spring Cloud Service resource. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "service_name")

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

