# 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 pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
from . import outputs
from ._inputs import *

__all__ = ['ApiOidcConfigArgs', 'ApiOidcConfig']

@pulumi.input_type
class ApiOidcConfigArgs:
    def __init__(__self__, *,
                 audience: pulumi.Input[str],
                 issuer: pulumi.Input[str],
                 jwks: pulumi.Input[str],
                 claim: Optional[pulumi.Input[str]] = None,
                 identity_maps: Optional[pulumi.Input[Sequence[pulumi.Input['ApiOidcConfigIdentityMapArgs']]]] = None):
        """
        The set of arguments for constructing a ApiOidcConfig resource.
        :param pulumi.Input[str] audience: The audience that CC API should accept for this API OIDC Configuration.
        :param pulumi.Input[str] issuer: The issuer of tokens for the API OIDC Configuration. Usually this is a url.
        :param pulumi.Input[str] jwks: The JSON Web Key Set used to check the signature of the JWTs.
        :param pulumi.Input[str] claim: The JWT claim that should be used as the user identifier. Defaults to the subject.
        :param pulumi.Input[Sequence[pulumi.Input['ApiOidcConfigIdentityMapArgs']]] identity_maps: The mapping rules to convert token user identifiers into a new form.
        """
        pulumi.set(__self__, "audience", audience)
        pulumi.set(__self__, "issuer", issuer)
        pulumi.set(__self__, "jwks", jwks)
        if claim is not None:
            pulumi.set(__self__, "claim", claim)
        if identity_maps is not None:
            pulumi.set(__self__, "identity_maps", identity_maps)

    @property
    @pulumi.getter
    def audience(self) -> pulumi.Input[str]:
        """
        The audience that CC API should accept for this API OIDC Configuration.
        """
        return pulumi.get(self, "audience")

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

    @property
    @pulumi.getter
    def issuer(self) -> pulumi.Input[str]:
        """
        The issuer of tokens for the API OIDC Configuration. Usually this is a url.
        """
        return pulumi.get(self, "issuer")

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

    @property
    @pulumi.getter
    def jwks(self) -> pulumi.Input[str]:
        """
        The JSON Web Key Set used to check the signature of the JWTs.
        """
        return pulumi.get(self, "jwks")

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

    @property
    @pulumi.getter
    def claim(self) -> Optional[pulumi.Input[str]]:
        """
        The JWT claim that should be used as the user identifier. Defaults to the subject.
        """
        return pulumi.get(self, "claim")

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

    @property
    @pulumi.getter(name="identityMaps")
    def identity_maps(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ApiOidcConfigIdentityMapArgs']]]]:
        """
        The mapping rules to convert token user identifiers into a new form.
        """
        return pulumi.get(self, "identity_maps")

    @identity_maps.setter
    def identity_maps(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ApiOidcConfigIdentityMapArgs']]]]):
        pulumi.set(self, "identity_maps", value)


@pulumi.input_type
class _ApiOidcConfigState:
    def __init__(__self__, *,
                 audience: Optional[pulumi.Input[str]] = None,
                 claim: Optional[pulumi.Input[str]] = None,
                 identity_maps: Optional[pulumi.Input[Sequence[pulumi.Input['ApiOidcConfigIdentityMapArgs']]]] = None,
                 issuer: Optional[pulumi.Input[str]] = None,
                 jwks: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering ApiOidcConfig resources.
        :param pulumi.Input[str] audience: The audience that CC API should accept for this API OIDC Configuration.
        :param pulumi.Input[str] claim: The JWT claim that should be used as the user identifier. Defaults to the subject.
        :param pulumi.Input[Sequence[pulumi.Input['ApiOidcConfigIdentityMapArgs']]] identity_maps: The mapping rules to convert token user identifiers into a new form.
        :param pulumi.Input[str] issuer: The issuer of tokens for the API OIDC Configuration. Usually this is a url.
        :param pulumi.Input[str] jwks: The JSON Web Key Set used to check the signature of the JWTs.
        """
        if audience is not None:
            pulumi.set(__self__, "audience", audience)
        if claim is not None:
            pulumi.set(__self__, "claim", claim)
        if identity_maps is not None:
            pulumi.set(__self__, "identity_maps", identity_maps)
        if issuer is not None:
            pulumi.set(__self__, "issuer", issuer)
        if jwks is not None:
            pulumi.set(__self__, "jwks", jwks)

    @property
    @pulumi.getter
    def audience(self) -> Optional[pulumi.Input[str]]:
        """
        The audience that CC API should accept for this API OIDC Configuration.
        """
        return pulumi.get(self, "audience")

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

    @property
    @pulumi.getter
    def claim(self) -> Optional[pulumi.Input[str]]:
        """
        The JWT claim that should be used as the user identifier. Defaults to the subject.
        """
        return pulumi.get(self, "claim")

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

    @property
    @pulumi.getter(name="identityMaps")
    def identity_maps(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ApiOidcConfigIdentityMapArgs']]]]:
        """
        The mapping rules to convert token user identifiers into a new form.
        """
        return pulumi.get(self, "identity_maps")

    @identity_maps.setter
    def identity_maps(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ApiOidcConfigIdentityMapArgs']]]]):
        pulumi.set(self, "identity_maps", value)

    @property
    @pulumi.getter
    def issuer(self) -> Optional[pulumi.Input[str]]:
        """
        The issuer of tokens for the API OIDC Configuration. Usually this is a url.
        """
        return pulumi.get(self, "issuer")

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

    @property
    @pulumi.getter
    def jwks(self) -> Optional[pulumi.Input[str]]:
        """
        The JSON Web Key Set used to check the signature of the JWTs.
        """
        return pulumi.get(self, "jwks")

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


class ApiOidcConfig(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 audience: Optional[pulumi.Input[str]] = None,
                 claim: Optional[pulumi.Input[str]] = None,
                 identity_maps: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ApiOidcConfigIdentityMapArgs']]]]] = None,
                 issuer: Optional[pulumi.Input[str]] = None,
                 jwks: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Configuration to allow external OIDC providers to issue tokens for use with CC API.

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] audience: The audience that CC API should accept for this API OIDC Configuration.
        :param pulumi.Input[str] claim: The JWT claim that should be used as the user identifier. Defaults to the subject.
        :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ApiOidcConfigIdentityMapArgs']]]] identity_maps: The mapping rules to convert token user identifiers into a new form.
        :param pulumi.Input[str] issuer: The issuer of tokens for the API OIDC Configuration. Usually this is a url.
        :param pulumi.Input[str] jwks: The JSON Web Key Set used to check the signature of the JWTs.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: ApiOidcConfigArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Configuration to allow external OIDC providers to issue tokens for use with CC API.

        :param str resource_name: The name of the resource.
        :param ApiOidcConfigArgs 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(ApiOidcConfigArgs, 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,
                 audience: Optional[pulumi.Input[str]] = None,
                 claim: Optional[pulumi.Input[str]] = None,
                 identity_maps: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ApiOidcConfigIdentityMapArgs']]]]] = None,
                 issuer: Optional[pulumi.Input[str]] = None,
                 jwks: 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__ = ApiOidcConfigArgs.__new__(ApiOidcConfigArgs)

            if audience is None and not opts.urn:
                raise TypeError("Missing required property 'audience'")
            __props__.__dict__["audience"] = audience
            __props__.__dict__["claim"] = claim
            __props__.__dict__["identity_maps"] = identity_maps
            if issuer is None and not opts.urn:
                raise TypeError("Missing required property 'issuer'")
            __props__.__dict__["issuer"] = issuer
            if jwks is None and not opts.urn:
                raise TypeError("Missing required property 'jwks'")
            __props__.__dict__["jwks"] = jwks
        super(ApiOidcConfig, __self__).__init__(
            'cockroach:index/apiOidcConfig:ApiOidcConfig',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            audience: Optional[pulumi.Input[str]] = None,
            claim: Optional[pulumi.Input[str]] = None,
            identity_maps: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ApiOidcConfigIdentityMapArgs']]]]] = None,
            issuer: Optional[pulumi.Input[str]] = None,
            jwks: Optional[pulumi.Input[str]] = None) -> 'ApiOidcConfig':
        """
        Get an existing ApiOidcConfig 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] audience: The audience that CC API should accept for this API OIDC Configuration.
        :param pulumi.Input[str] claim: The JWT claim that should be used as the user identifier. Defaults to the subject.
        :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ApiOidcConfigIdentityMapArgs']]]] identity_maps: The mapping rules to convert token user identifiers into a new form.
        :param pulumi.Input[str] issuer: The issuer of tokens for the API OIDC Configuration. Usually this is a url.
        :param pulumi.Input[str] jwks: The JSON Web Key Set used to check the signature of the JWTs.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _ApiOidcConfigState.__new__(_ApiOidcConfigState)

        __props__.__dict__["audience"] = audience
        __props__.__dict__["claim"] = claim
        __props__.__dict__["identity_maps"] = identity_maps
        __props__.__dict__["issuer"] = issuer
        __props__.__dict__["jwks"] = jwks
        return ApiOidcConfig(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter
    def audience(self) -> pulumi.Output[str]:
        """
        The audience that CC API should accept for this API OIDC Configuration.
        """
        return pulumi.get(self, "audience")

    @property
    @pulumi.getter
    def claim(self) -> pulumi.Output[str]:
        """
        The JWT claim that should be used as the user identifier. Defaults to the subject.
        """
        return pulumi.get(self, "claim")

    @property
    @pulumi.getter(name="identityMaps")
    def identity_maps(self) -> pulumi.Output[Sequence['outputs.ApiOidcConfigIdentityMap']]:
        """
        The mapping rules to convert token user identifiers into a new form.
        """
        return pulumi.get(self, "identity_maps")

    @property
    @pulumi.getter
    def issuer(self) -> pulumi.Output[str]:
        """
        The issuer of tokens for the API OIDC Configuration. Usually this is a url.
        """
        return pulumi.get(self, "issuer")

    @property
    @pulumi.getter
    def jwks(self) -> pulumi.Output[str]:
        """
        The JSON Web Key Set used to check the signature of the JWTs.
        """
        return pulumi.get(self, "jwks")

