# 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
from . import outputs

__all__ = [
    'GetOrganizationResult',
    'AwaitableGetOrganizationResult',
    'get_organization',
    'get_organization_output',
]

@pulumi.output_type
class GetOrganizationResult:
    """
    A collection of values returned by getOrganization.
    """
    def __init__(__self__, alias=None, attributes=None, description=None, domains=None, enabled=None, id=None, name=None, realm=None, redirect_url=None):
        if alias and not isinstance(alias, str):
            raise TypeError("Expected argument 'alias' to be a str")
        pulumi.set(__self__, "alias", alias)
        if attributes and not isinstance(attributes, dict):
            raise TypeError("Expected argument 'attributes' to be a dict")
        pulumi.set(__self__, "attributes", attributes)
        if description and not isinstance(description, str):
            raise TypeError("Expected argument 'description' to be a str")
        pulumi.set(__self__, "description", description)
        if domains and not isinstance(domains, list):
            raise TypeError("Expected argument 'domains' to be a list")
        pulumi.set(__self__, "domains", domains)
        if enabled and not isinstance(enabled, bool):
            raise TypeError("Expected argument 'enabled' to be a bool")
        pulumi.set(__self__, "enabled", enabled)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if name and not isinstance(name, str):
            raise TypeError("Expected argument 'name' to be a str")
        pulumi.set(__self__, "name", name)
        if realm and not isinstance(realm, str):
            raise TypeError("Expected argument 'realm' to be a str")
        pulumi.set(__self__, "realm", realm)
        if redirect_url and not isinstance(redirect_url, str):
            raise TypeError("Expected argument 'redirect_url' to be a str")
        pulumi.set(__self__, "redirect_url", redirect_url)

    @_builtins.property
    @pulumi.getter
    def alias(self) -> _builtins.str:
        return pulumi.get(self, "alias")

    @_builtins.property
    @pulumi.getter
    def attributes(self) -> Mapping[str, _builtins.str]:
        return pulumi.get(self, "attributes")

    @_builtins.property
    @pulumi.getter
    def description(self) -> _builtins.str:
        return pulumi.get(self, "description")

    @_builtins.property
    @pulumi.getter
    def domains(self) -> Sequence['outputs.GetOrganizationDomainResult']:
        return pulumi.get(self, "domains")

    @_builtins.property
    @pulumi.getter
    def enabled(self) -> _builtins.bool:
        return pulumi.get(self, "enabled")

    @_builtins.property
    @pulumi.getter
    def id(self) -> _builtins.str:
        """
        The provider-assigned unique ID for this managed resource.
        """
        return pulumi.get(self, "id")

    @_builtins.property
    @pulumi.getter
    def name(self) -> _builtins.str:
        return pulumi.get(self, "name")

    @_builtins.property
    @pulumi.getter
    def realm(self) -> _builtins.str:
        return pulumi.get(self, "realm")

    @_builtins.property
    @pulumi.getter(name="redirectUrl")
    def redirect_url(self) -> _builtins.str:
        return pulumi.get(self, "redirect_url")


class AwaitableGetOrganizationResult(GetOrganizationResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetOrganizationResult(
            alias=self.alias,
            attributes=self.attributes,
            description=self.description,
            domains=self.domains,
            enabled=self.enabled,
            id=self.id,
            name=self.name,
            realm=self.realm,
            redirect_url=self.redirect_url)


def get_organization(name: Optional[_builtins.str] = None,
                     realm: Optional[_builtins.str] = None,
                     opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetOrganizationResult:
    """
    This data source can be used to fetch properties of a Keycloak organization for
    usage with other resources.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_keycloak as keycloak

    realm = keycloak.get_realm(realm="my-realm")
    organization = keycloak.get_organization(realm=realm.id,
        name="my-org")
    # use the data source
    realm_identity_provider = keycloak.oidc.IdentityProvider("realm_identity_provider",
        realm=realm.id,
        alias="my-idp",
        authorization_url="https://authorizationurl.com",
        client_id="clientID",
        client_secret="clientSecret",
        token_url="https://tokenurl.com",
        organization_id=organization.id)
    ```


    :param _builtins.str name: The organization name.
    :param _builtins.str realm: The name of the realm this organization exists within.
    """
    __args__ = dict()
    __args__['name'] = name
    __args__['realm'] = realm
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('keycloak:index/getOrganization:getOrganization', __args__, opts=opts, typ=GetOrganizationResult).value

    return AwaitableGetOrganizationResult(
        alias=pulumi.get(__ret__, 'alias'),
        attributes=pulumi.get(__ret__, 'attributes'),
        description=pulumi.get(__ret__, 'description'),
        domains=pulumi.get(__ret__, 'domains'),
        enabled=pulumi.get(__ret__, 'enabled'),
        id=pulumi.get(__ret__, 'id'),
        name=pulumi.get(__ret__, 'name'),
        realm=pulumi.get(__ret__, 'realm'),
        redirect_url=pulumi.get(__ret__, 'redirect_url'))
def get_organization_output(name: Optional[pulumi.Input[_builtins.str]] = None,
                            realm: Optional[pulumi.Input[_builtins.str]] = None,
                            opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetOrganizationResult]:
    """
    This data source can be used to fetch properties of a Keycloak organization for
    usage with other resources.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_keycloak as keycloak

    realm = keycloak.get_realm(realm="my-realm")
    organization = keycloak.get_organization(realm=realm.id,
        name="my-org")
    # use the data source
    realm_identity_provider = keycloak.oidc.IdentityProvider("realm_identity_provider",
        realm=realm.id,
        alias="my-idp",
        authorization_url="https://authorizationurl.com",
        client_id="clientID",
        client_secret="clientSecret",
        token_url="https://tokenurl.com",
        organization_id=organization.id)
    ```


    :param _builtins.str name: The organization name.
    :param _builtins.str realm: The name of the realm this organization exists within.
    """
    __args__ = dict()
    __args__['name'] = name
    __args__['realm'] = realm
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('keycloak:index/getOrganization:getOrganization', __args__, opts=opts, typ=GetOrganizationResult)
    return __ret__.apply(lambda __response__: GetOrganizationResult(
        alias=pulumi.get(__response__, 'alias'),
        attributes=pulumi.get(__response__, 'attributes'),
        description=pulumi.get(__response__, 'description'),
        domains=pulumi.get(__response__, 'domains'),
        enabled=pulumi.get(__response__, 'enabled'),
        id=pulumi.get(__response__, 'id'),
        name=pulumi.get(__response__, 'name'),
        realm=pulumi.get(__response__, 'realm'),
        redirect_url=pulumi.get(__response__, 'redirect_url')))
