# 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 json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from . import utilities, tables

class GetApplicationResult:
    """
    A collection of values returned by getApplication.
    """
    def __init__(__self__, app_roles=None, application_id=None, available_to_other_tenants=None, group_membership_claims=None, homepage=None, identifier_uris=None, name=None, oauth2_allow_implicit_flow=None, oauth2_permissions=None, object_id=None, reply_urls=None, required_resource_accesses=None, type=None, id=None):
        if app_roles and not isinstance(app_roles, list):
            raise TypeError("Expected argument 'app_roles' to be a list")
        __self__.app_roles = app_roles
        """
        A collection of `app_role` blocks as documented below. For more information https://docs.microsoft.com/en-us/azure/architecture/multitenant-identity/app-roles
        """
        if application_id and not isinstance(application_id, str):
            raise TypeError("Expected argument 'application_id' to be a str")
        __self__.application_id = application_id
        """
        the Application ID of the Azure Active Directory Application.
        """
        if available_to_other_tenants and not isinstance(available_to_other_tenants, bool):
            raise TypeError("Expected argument 'available_to_other_tenants' to be a bool")
        __self__.available_to_other_tenants = available_to_other_tenants
        """
        Is this Azure AD Application available to other tenants?
        """
        if group_membership_claims and not isinstance(group_membership_claims, str):
            raise TypeError("Expected argument 'group_membership_claims' to be a str")
        __self__.group_membership_claims = group_membership_claims
        """
        The `groups` claim issued in a user or OAuth 2.0 access token that the app expects.
        """
        if homepage and not isinstance(homepage, str):
            raise TypeError("Expected argument 'homepage' to be a str")
        __self__.homepage = homepage
        if identifier_uris and not isinstance(identifier_uris, list):
            raise TypeError("Expected argument 'identifier_uris' to be a list")
        __self__.identifier_uris = identifier_uris
        """
        A list of user-defined URI(s) that uniquely identify a Web application within it's Azure AD tenant, or within a verified custom domain if the application is multi-tenant.
        """
        if name and not isinstance(name, str):
            raise TypeError("Expected argument 'name' to be a str")
        __self__.name = name
        if oauth2_allow_implicit_flow and not isinstance(oauth2_allow_implicit_flow, bool):
            raise TypeError("Expected argument 'oauth2_allow_implicit_flow' to be a bool")
        __self__.oauth2_allow_implicit_flow = oauth2_allow_implicit_flow
        """
        Does this Azure AD Application allow OAuth2.0 implicit flow tokens?
        """
        if oauth2_permissions and not isinstance(oauth2_permissions, list):
            raise TypeError("Expected argument 'oauth2_permissions' to be a list")
        __self__.oauth2_permissions = oauth2_permissions
        """
        A collection of OAuth 2.0 permission scopes that the web API (resource) app exposes to client apps. Each permission is covered by a `oauth2_permission` block as documented below.
        """
        if object_id and not isinstance(object_id, str):
            raise TypeError("Expected argument 'object_id' to be a str")
        __self__.object_id = object_id
        """
        the Object ID of the Azure Active Directory Application.
        """
        if reply_urls and not isinstance(reply_urls, list):
            raise TypeError("Expected argument 'reply_urls' to be a list")
        __self__.reply_urls = reply_urls
        """
        A list of URLs that user tokens are sent to for sign in, or the redirect URIs that OAuth 2.0 authorization codes and access tokens are sent to.
        """
        if required_resource_accesses and not isinstance(required_resource_accesses, list):
            raise TypeError("Expected argument 'required_resource_accesses' to be a list")
        __self__.required_resource_accesses = required_resource_accesses
        """
        A collection of `required_resource_access` blocks as documented below.
        """
        if type and not isinstance(type, str):
            raise TypeError("Expected argument 'type' to be a str")
        __self__.type = type
        """
        The type of the permission
        """
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        __self__.id = id
        """
        id is the provider-assigned unique ID for this managed resource.
        """
class AwaitableGetApplicationResult(GetApplicationResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetApplicationResult(
            app_roles=self.app_roles,
            application_id=self.application_id,
            available_to_other_tenants=self.available_to_other_tenants,
            group_membership_claims=self.group_membership_claims,
            homepage=self.homepage,
            identifier_uris=self.identifier_uris,
            name=self.name,
            oauth2_allow_implicit_flow=self.oauth2_allow_implicit_flow,
            oauth2_permissions=self.oauth2_permissions,
            object_id=self.object_id,
            reply_urls=self.reply_urls,
            required_resource_accesses=self.required_resource_accesses,
            type=self.type,
            id=self.id)

def get_application(app_roles=None,name=None,oauth2_permissions=None,object_id=None,opts=None):
    """
    Use this data source to access information about an existing Application within Azure Active Directory.
    
    > **NOTE:** If you're authenticating using a Service Principal then it must have permissions to both `Read and write all (or owned by) applications` and `Sign in and read user profile` within the `Windows Azure Active Directory` API.
    
    :param str name: Specifies the name of the Application within Azure Active Directory.
    :param str object_id: Specifies the Object ID of the Application within Azure Active Directory.
    
    The **app_roles** object supports the following:
    
      * `allowedMemberTypes` (`list`) - Specifies whether this app role definition can be assigned to users and groups, or to other applications (that are accessing this application in daemon service scenarios). Possible values are: `User` and `Application`, or both.
      * `description` (`str`) - Permission help text that appears in the admin app assignment and consent experiences.
      * `display_name` (`str`) - Display name for the permission that appears in the admin consent and app assignment experiences.
      * `id` (`str`) - The unique identifier of the `app_role`.
      * `isEnabled` (`bool`) - Determines if the app role is enabled.
      * `value` (`str`) - Specifies the value of the roles claim that the application should expect in the authentication and access tokens.
    
    The **oauth2_permissions** object supports the following:
    
      * `adminConsentDescription` (`str`) - The description of the admin consent
      * `adminConsentDisplayName` (`str`) - The display name of the admin consent
      * `id` (`str`) - The unique identifier of the `app_role`.
      * `isEnabled` (`bool`) - Determines if the app role is enabled.
      * `type` (`str`) - The type of the permission
      * `userConsentDescription` (`str`) - The description of the user consent
      * `userConsentDisplayName` (`str`) - The display name of the user consent
      * `value` (`str`) - Specifies the value of the roles claim that the application should expect in the authentication and access tokens.

    > This content is derived from https://github.com/terraform-providers/terraform-provider-azuread/blob/master/website/docs/d/application.html.markdown.
    """
    __args__ = dict()

    __args__['appRoles'] = app_roles
    __args__['name'] = name
    __args__['oauth2Permissions'] = oauth2_permissions
    __args__['objectId'] = object_id
    if opts is None:
        opts = pulumi.InvokeOptions()
    if opts.version is None:
        opts.version = utilities.get_version()
    __ret__ = pulumi.runtime.invoke('azuread:index/getApplication:getApplication', __args__, opts=opts).value

    return AwaitableGetApplicationResult(
        app_roles=__ret__.get('appRoles'),
        application_id=__ret__.get('applicationId'),
        available_to_other_tenants=__ret__.get('availableToOtherTenants'),
        group_membership_claims=__ret__.get('groupMembershipClaims'),
        homepage=__ret__.get('homepage'),
        identifier_uris=__ret__.get('identifierUris'),
        name=__ret__.get('name'),
        oauth2_allow_implicit_flow=__ret__.get('oauth2AllowImplicitFlow'),
        oauth2_permissions=__ret__.get('oauth2Permissions'),
        object_id=__ret__.get('objectId'),
        reply_urls=__ret__.get('replyUrls'),
        required_resource_accesses=__ret__.get('requiredResourceAccesses'),
        type=__ret__.get('type'),
        id=__ret__.get('id'))
