# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import builtins as _builtins
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__ = ['ApplicationFlexibleFederatedIdentityCredentialArgs', 'ApplicationFlexibleFederatedIdentityCredential']

@pulumi.input_type
class ApplicationFlexibleFederatedIdentityCredentialArgs:
    def __init__(__self__, *,
                 application_id: pulumi.Input[_builtins.str],
                 audience: pulumi.Input[_builtins.str],
                 claims_matching_expression: pulumi.Input[_builtins.str],
                 display_name: pulumi.Input[_builtins.str],
                 issuer: pulumi.Input[_builtins.str],
                 description: Optional[pulumi.Input[_builtins.str]] = None):
        """
        The set of arguments for constructing a ApplicationFlexibleFederatedIdentityCredential resource.
        :param pulumi.Input[_builtins.str] application_id: The resource ID of the application for which this federated identity credential should be created. Changing this field forces a new resource to be created.
        :param pulumi.Input[_builtins.str] audience: The audience that can appear in the external token. This specifies what should be accepted in the `aud` claim of incoming tokens.
        :param pulumi.Input[_builtins.str] claims_matching_expression: The expression to match for claims. See the Preview Documentation for more information.
        :param pulumi.Input[_builtins.str] display_name: A unique display name for the federated identity credential. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] issuer: The URL of the external identity provider, which must match the issuer claim of the external token being exchanged.
        :param pulumi.Input[_builtins.str] description: A description for the federated identity credential.
        """
        pulumi.set(__self__, "application_id", application_id)
        pulumi.set(__self__, "audience", audience)
        pulumi.set(__self__, "claims_matching_expression", claims_matching_expression)
        pulumi.set(__self__, "display_name", display_name)
        pulumi.set(__self__, "issuer", issuer)
        if description is not None:
            pulumi.set(__self__, "description", description)

    @_builtins.property
    @pulumi.getter(name="applicationId")
    def application_id(self) -> pulumi.Input[_builtins.str]:
        """
        The resource ID of the application for which this federated identity credential should be created. Changing this field forces a new resource to be created.
        """
        return pulumi.get(self, "application_id")

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

    @_builtins.property
    @pulumi.getter
    def audience(self) -> pulumi.Input[_builtins.str]:
        """
        The audience that can appear in the external token. This specifies what should be accepted in the `aud` claim of incoming tokens.
        """
        return pulumi.get(self, "audience")

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

    @_builtins.property
    @pulumi.getter(name="claimsMatchingExpression")
    def claims_matching_expression(self) -> pulumi.Input[_builtins.str]:
        """
        The expression to match for claims. See the Preview Documentation for more information.
        """
        return pulumi.get(self, "claims_matching_expression")

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

    @_builtins.property
    @pulumi.getter(name="displayName")
    def display_name(self) -> pulumi.Input[_builtins.str]:
        """
        A unique display name for the federated identity credential. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "display_name")

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

    @_builtins.property
    @pulumi.getter
    def issuer(self) -> pulumi.Input[_builtins.str]:
        """
        The URL of the external identity provider, which must match the issuer claim of the external token being exchanged.
        """
        return pulumi.get(self, "issuer")

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

    @_builtins.property
    @pulumi.getter
    def description(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        A description for the federated identity credential.
        """
        return pulumi.get(self, "description")

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


@pulumi.input_type
class _ApplicationFlexibleFederatedIdentityCredentialState:
    def __init__(__self__, *,
                 application_id: Optional[pulumi.Input[_builtins.str]] = None,
                 audience: Optional[pulumi.Input[_builtins.str]] = None,
                 claims_matching_expression: Optional[pulumi.Input[_builtins.str]] = None,
                 credential_id: Optional[pulumi.Input[_builtins.str]] = None,
                 description: Optional[pulumi.Input[_builtins.str]] = None,
                 display_name: Optional[pulumi.Input[_builtins.str]] = None,
                 issuer: Optional[pulumi.Input[_builtins.str]] = None):
        """
        Input properties used for looking up and filtering ApplicationFlexibleFederatedIdentityCredential resources.
        :param pulumi.Input[_builtins.str] application_id: The resource ID of the application for which this federated identity credential should be created. Changing this field forces a new resource to be created.
        :param pulumi.Input[_builtins.str] audience: The audience that can appear in the external token. This specifies what should be accepted in the `aud` claim of incoming tokens.
        :param pulumi.Input[_builtins.str] claims_matching_expression: The expression to match for claims. See the Preview Documentation for more information.
        :param pulumi.Input[_builtins.str] credential_id: A UUID used to uniquely identify this federated identity credential.
        :param pulumi.Input[_builtins.str] description: A description for the federated identity credential.
        :param pulumi.Input[_builtins.str] display_name: A unique display name for the federated identity credential. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] issuer: The URL of the external identity provider, which must match the issuer claim of the external token being exchanged.
        """
        if application_id is not None:
            pulumi.set(__self__, "application_id", application_id)
        if audience is not None:
            pulumi.set(__self__, "audience", audience)
        if claims_matching_expression is not None:
            pulumi.set(__self__, "claims_matching_expression", claims_matching_expression)
        if credential_id is not None:
            pulumi.set(__self__, "credential_id", credential_id)
        if description is not None:
            pulumi.set(__self__, "description", description)
        if display_name is not None:
            pulumi.set(__self__, "display_name", display_name)
        if issuer is not None:
            pulumi.set(__self__, "issuer", issuer)

    @_builtins.property
    @pulumi.getter(name="applicationId")
    def application_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The resource ID of the application for which this federated identity credential should be created. Changing this field forces a new resource to be created.
        """
        return pulumi.get(self, "application_id")

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

    @_builtins.property
    @pulumi.getter
    def audience(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The audience that can appear in the external token. This specifies what should be accepted in the `aud` claim of incoming tokens.
        """
        return pulumi.get(self, "audience")

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

    @_builtins.property
    @pulumi.getter(name="claimsMatchingExpression")
    def claims_matching_expression(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The expression to match for claims. See the Preview Documentation for more information.
        """
        return pulumi.get(self, "claims_matching_expression")

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

    @_builtins.property
    @pulumi.getter(name="credentialId")
    def credential_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        A UUID used to uniquely identify this federated identity credential.
        """
        return pulumi.get(self, "credential_id")

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

    @_builtins.property
    @pulumi.getter
    def description(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        A description for the federated identity credential.
        """
        return pulumi.get(self, "description")

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

    @_builtins.property
    @pulumi.getter(name="displayName")
    def display_name(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        A unique display name for the federated identity credential. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "display_name")

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

    @_builtins.property
    @pulumi.getter
    def issuer(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The URL of the external identity provider, which must match the issuer claim of the external token being exchanged.
        """
        return pulumi.get(self, "issuer")

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


@pulumi.type_token("azuread:index/applicationFlexibleFederatedIdentityCredential:ApplicationFlexibleFederatedIdentityCredential")
class ApplicationFlexibleFederatedIdentityCredential(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 application_id: Optional[pulumi.Input[_builtins.str]] = None,
                 audience: Optional[pulumi.Input[_builtins.str]] = None,
                 claims_matching_expression: Optional[pulumi.Input[_builtins.str]] = None,
                 description: Optional[pulumi.Input[_builtins.str]] = None,
                 display_name: Optional[pulumi.Input[_builtins.str]] = None,
                 issuer: Optional[pulumi.Input[_builtins.str]] = None,
                 __props__=None):
        """
        ## Example Usage

        ```python
        import pulumi
        import pulumi_azuread as azuread

        example = azuread.ApplicationRegistration("example", display_name="example")
        example_application_flexible_federated_identity_credential = azuread.ApplicationFlexibleFederatedIdentityCredential("example",
            application_id=example.id,
            claims_matching_expression="claims['sub'] matches 'repo:contoso/contoso-repo:ref:refs/heads/*' and claims['job_workflow_ref'] matches 'contoso/contoso-prod/.github/workflows/*.yml@refs/heads/main'",
            display_name="my-repo-deploy",
            description="Deployments for my-repo",
            audience="api://AzureADTokenExchange",
            issuer="https://token.actions.githubusercontent.com")
        ```

        ## Import

        Flexible Federated Identity Credentials can be imported using the object ID of the associated application and the ID of the flexible federated identity credential, e.g.

        ```sh
        $ pulumi import azuread:index/applicationFlexibleFederatedIdentityCredential:ApplicationFlexibleFederatedIdentityCredential example 00000000-0000-0000-0000-000000000000/federatedIdentityCredential/11111111-1111-1111-1111-111111111111
        ```

        -> This ID format is unique to Terraform and is composed of the application's object ID, the string "federatedIdentityCredential" and the credential ID in the format `{ObjectId}/federatedIdentityCredential/{CredentialId}`.

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.str] application_id: The resource ID of the application for which this federated identity credential should be created. Changing this field forces a new resource to be created.
        :param pulumi.Input[_builtins.str] audience: The audience that can appear in the external token. This specifies what should be accepted in the `aud` claim of incoming tokens.
        :param pulumi.Input[_builtins.str] claims_matching_expression: The expression to match for claims. See the Preview Documentation for more information.
        :param pulumi.Input[_builtins.str] description: A description for the federated identity credential.
        :param pulumi.Input[_builtins.str] display_name: A unique display name for the federated identity credential. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] issuer: The URL of the external identity provider, which must match the issuer claim of the external token being exchanged.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: ApplicationFlexibleFederatedIdentityCredentialArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        ## Example Usage

        ```python
        import pulumi
        import pulumi_azuread as azuread

        example = azuread.ApplicationRegistration("example", display_name="example")
        example_application_flexible_federated_identity_credential = azuread.ApplicationFlexibleFederatedIdentityCredential("example",
            application_id=example.id,
            claims_matching_expression="claims['sub'] matches 'repo:contoso/contoso-repo:ref:refs/heads/*' and claims['job_workflow_ref'] matches 'contoso/contoso-prod/.github/workflows/*.yml@refs/heads/main'",
            display_name="my-repo-deploy",
            description="Deployments for my-repo",
            audience="api://AzureADTokenExchange",
            issuer="https://token.actions.githubusercontent.com")
        ```

        ## Import

        Flexible Federated Identity Credentials can be imported using the object ID of the associated application and the ID of the flexible federated identity credential, e.g.

        ```sh
        $ pulumi import azuread:index/applicationFlexibleFederatedIdentityCredential:ApplicationFlexibleFederatedIdentityCredential example 00000000-0000-0000-0000-000000000000/federatedIdentityCredential/11111111-1111-1111-1111-111111111111
        ```

        -> This ID format is unique to Terraform and is composed of the application's object ID, the string "federatedIdentityCredential" and the credential ID in the format `{ObjectId}/federatedIdentityCredential/{CredentialId}`.

        :param str resource_name: The name of the resource.
        :param ApplicationFlexibleFederatedIdentityCredentialArgs 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(ApplicationFlexibleFederatedIdentityCredentialArgs, 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,
                 application_id: Optional[pulumi.Input[_builtins.str]] = None,
                 audience: Optional[pulumi.Input[_builtins.str]] = None,
                 claims_matching_expression: Optional[pulumi.Input[_builtins.str]] = None,
                 description: Optional[pulumi.Input[_builtins.str]] = None,
                 display_name: Optional[pulumi.Input[_builtins.str]] = None,
                 issuer: Optional[pulumi.Input[_builtins.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__ = ApplicationFlexibleFederatedIdentityCredentialArgs.__new__(ApplicationFlexibleFederatedIdentityCredentialArgs)

            if application_id is None and not opts.urn:
                raise TypeError("Missing required property 'application_id'")
            __props__.__dict__["application_id"] = application_id
            if audience is None and not opts.urn:
                raise TypeError("Missing required property 'audience'")
            __props__.__dict__["audience"] = audience
            if claims_matching_expression is None and not opts.urn:
                raise TypeError("Missing required property 'claims_matching_expression'")
            __props__.__dict__["claims_matching_expression"] = claims_matching_expression
            __props__.__dict__["description"] = description
            if display_name is None and not opts.urn:
                raise TypeError("Missing required property 'display_name'")
            __props__.__dict__["display_name"] = display_name
            if issuer is None and not opts.urn:
                raise TypeError("Missing required property 'issuer'")
            __props__.__dict__["issuer"] = issuer
            __props__.__dict__["credential_id"] = None
        super(ApplicationFlexibleFederatedIdentityCredential, __self__).__init__(
            'azuread:index/applicationFlexibleFederatedIdentityCredential:ApplicationFlexibleFederatedIdentityCredential',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            application_id: Optional[pulumi.Input[_builtins.str]] = None,
            audience: Optional[pulumi.Input[_builtins.str]] = None,
            claims_matching_expression: Optional[pulumi.Input[_builtins.str]] = None,
            credential_id: Optional[pulumi.Input[_builtins.str]] = None,
            description: Optional[pulumi.Input[_builtins.str]] = None,
            display_name: Optional[pulumi.Input[_builtins.str]] = None,
            issuer: Optional[pulumi.Input[_builtins.str]] = None) -> 'ApplicationFlexibleFederatedIdentityCredential':
        """
        Get an existing ApplicationFlexibleFederatedIdentityCredential 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[_builtins.str] application_id: The resource ID of the application for which this federated identity credential should be created. Changing this field forces a new resource to be created.
        :param pulumi.Input[_builtins.str] audience: The audience that can appear in the external token. This specifies what should be accepted in the `aud` claim of incoming tokens.
        :param pulumi.Input[_builtins.str] claims_matching_expression: The expression to match for claims. See the Preview Documentation for more information.
        :param pulumi.Input[_builtins.str] credential_id: A UUID used to uniquely identify this federated identity credential.
        :param pulumi.Input[_builtins.str] description: A description for the federated identity credential.
        :param pulumi.Input[_builtins.str] display_name: A unique display name for the federated identity credential. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] issuer: The URL of the external identity provider, which must match the issuer claim of the external token being exchanged.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _ApplicationFlexibleFederatedIdentityCredentialState.__new__(_ApplicationFlexibleFederatedIdentityCredentialState)

        __props__.__dict__["application_id"] = application_id
        __props__.__dict__["audience"] = audience
        __props__.__dict__["claims_matching_expression"] = claims_matching_expression
        __props__.__dict__["credential_id"] = credential_id
        __props__.__dict__["description"] = description
        __props__.__dict__["display_name"] = display_name
        __props__.__dict__["issuer"] = issuer
        return ApplicationFlexibleFederatedIdentityCredential(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter(name="applicationId")
    def application_id(self) -> pulumi.Output[_builtins.str]:
        """
        The resource ID of the application for which this federated identity credential should be created. Changing this field forces a new resource to be created.
        """
        return pulumi.get(self, "application_id")

    @_builtins.property
    @pulumi.getter
    def audience(self) -> pulumi.Output[_builtins.str]:
        """
        The audience that can appear in the external token. This specifies what should be accepted in the `aud` claim of incoming tokens.
        """
        return pulumi.get(self, "audience")

    @_builtins.property
    @pulumi.getter(name="claimsMatchingExpression")
    def claims_matching_expression(self) -> pulumi.Output[_builtins.str]:
        """
        The expression to match for claims. See the Preview Documentation for more information.
        """
        return pulumi.get(self, "claims_matching_expression")

    @_builtins.property
    @pulumi.getter(name="credentialId")
    def credential_id(self) -> pulumi.Output[_builtins.str]:
        """
        A UUID used to uniquely identify this federated identity credential.
        """
        return pulumi.get(self, "credential_id")

    @_builtins.property
    @pulumi.getter
    def description(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        A description for the federated identity credential.
        """
        return pulumi.get(self, "description")

    @_builtins.property
    @pulumi.getter(name="displayName")
    def display_name(self) -> pulumi.Output[_builtins.str]:
        """
        A unique display name for the federated identity credential. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "display_name")

    @_builtins.property
    @pulumi.getter
    def issuer(self) -> pulumi.Output[_builtins.str]:
        """
        The URL of the external identity provider, which must match the issuer claim of the external token being exchanged.
        """
        return pulumi.get(self, "issuer")

