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

__all__ = ['ApplicationAppRole']


class ApplicationAppRole(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 allowed_member_types: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 application_object_id: Optional[pulumi.Input[str]] = None,
                 description: Optional[pulumi.Input[str]] = None,
                 display_name: Optional[pulumi.Input[str]] = None,
                 is_enabled: Optional[pulumi.Input[bool]] = None,
                 role_id: Optional[pulumi.Input[str]] = None,
                 value: Optional[pulumi.Input[str]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        Manages an App Role associated with an 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 applications` and `Sign in and read user profile` within the `Windows Azure Active Directory` API.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azuread as azuread

        example_application = azuread.Application("exampleApplication")
        example_application_app_role = azuread.ApplicationAppRole("exampleApplicationAppRole",
            application_object_id=example_application.id,
            allowed_member_types=["User"],
            description="Admins can manage roles and perform all task actions",
            display_name="Admin",
            is_enabled=True,
            value="administer")
        ```

        ## Import

        App Roles can be imported using the `object id` of an Application and the `id` of the App Role, e.g.

        ```sh
         $ pulumi import azuread:index/applicationAppRole:ApplicationAppRole test 00000000-0000-0000-0000-000000000000/role/11111111-1111-1111-1111-111111111111
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[Sequence[pulumi.Input[str]]] allowed_member_types: Specifies whether this app role definition can be assigned to users and groups by setting to `User`, or to other applications (that are accessing this application in daemon service scenarios) by setting to `Application`, or to both.
        :param pulumi.Input[str] application_object_id: The Object ID of the Application for which this App Role should be created. Changing this field forces a new resource to be created.
        :param pulumi.Input[str] description: Permission help text that appears in the admin app assignment and consent experiences.
        :param pulumi.Input[str] display_name: Display name for the permission that appears in the admin consent and app assignment experiences.
        :param pulumi.Input[bool] is_enabled: Determines if the app role is enabled. Defaults to `true`.
        :param pulumi.Input[str] role_id: Specifies a custom UUID for the app role. If omitted, a random UUID will be automatically generated. Changing this field forces a new resource to be created.
        :param pulumi.Input[str] value: Specifies the value of the roles claim that the application should expect in the authentication and access tokens.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        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__ = dict()

            if allowed_member_types is None and not opts.urn:
                raise TypeError("Missing required property 'allowed_member_types'")
            __props__['allowed_member_types'] = allowed_member_types
            if application_object_id is None and not opts.urn:
                raise TypeError("Missing required property 'application_object_id'")
            __props__['application_object_id'] = application_object_id
            if description is None and not opts.urn:
                raise TypeError("Missing required property 'description'")
            __props__['description'] = description
            if display_name is None and not opts.urn:
                raise TypeError("Missing required property 'display_name'")
            __props__['display_name'] = display_name
            __props__['is_enabled'] = is_enabled
            __props__['role_id'] = role_id
            __props__['value'] = value
        super(ApplicationAppRole, __self__).__init__(
            'azuread:index/applicationAppRole:ApplicationAppRole',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            allowed_member_types: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
            application_object_id: Optional[pulumi.Input[str]] = None,
            description: Optional[pulumi.Input[str]] = None,
            display_name: Optional[pulumi.Input[str]] = None,
            is_enabled: Optional[pulumi.Input[bool]] = None,
            role_id: Optional[pulumi.Input[str]] = None,
            value: Optional[pulumi.Input[str]] = None) -> 'ApplicationAppRole':
        """
        Get an existing ApplicationAppRole 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[Sequence[pulumi.Input[str]]] allowed_member_types: Specifies whether this app role definition can be assigned to users and groups by setting to `User`, or to other applications (that are accessing this application in daemon service scenarios) by setting to `Application`, or to both.
        :param pulumi.Input[str] application_object_id: The Object ID of the Application for which this App Role should be created. Changing this field forces a new resource to be created.
        :param pulumi.Input[str] description: Permission help text that appears in the admin app assignment and consent experiences.
        :param pulumi.Input[str] display_name: Display name for the permission that appears in the admin consent and app assignment experiences.
        :param pulumi.Input[bool] is_enabled: Determines if the app role is enabled. Defaults to `true`.
        :param pulumi.Input[str] role_id: Specifies a custom UUID for the app role. If omitted, a random UUID will be automatically generated. Changing this field forces a new resource to be created.
        :param pulumi.Input[str] value: Specifies the value of the roles claim that the application should expect in the authentication and access tokens.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["allowed_member_types"] = allowed_member_types
        __props__["application_object_id"] = application_object_id
        __props__["description"] = description
        __props__["display_name"] = display_name
        __props__["is_enabled"] = is_enabled
        __props__["role_id"] = role_id
        __props__["value"] = value
        return ApplicationAppRole(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="allowedMemberTypes")
    def allowed_member_types(self) -> pulumi.Output[Sequence[str]]:
        """
        Specifies whether this app role definition can be assigned to users and groups by setting to `User`, or to other applications (that are accessing this application in daemon service scenarios) by setting to `Application`, or to both.
        """
        return pulumi.get(self, "allowed_member_types")

    @property
    @pulumi.getter(name="applicationObjectId")
    def application_object_id(self) -> pulumi.Output[str]:
        """
        The Object ID of the Application for which this App Role should be created. Changing this field forces a new resource to be created.
        """
        return pulumi.get(self, "application_object_id")

    @property
    @pulumi.getter
    def description(self) -> pulumi.Output[str]:
        """
        Permission help text that appears in the admin app assignment and consent experiences.
        """
        return pulumi.get(self, "description")

    @property
    @pulumi.getter(name="displayName")
    def display_name(self) -> pulumi.Output[str]:
        """
        Display name for the permission that appears in the admin consent and app assignment experiences.
        """
        return pulumi.get(self, "display_name")

    @property
    @pulumi.getter(name="isEnabled")
    def is_enabled(self) -> pulumi.Output[Optional[bool]]:
        """
        Determines if the app role is enabled. Defaults to `true`.
        """
        return pulumi.get(self, "is_enabled")

    @property
    @pulumi.getter(name="roleId")
    def role_id(self) -> pulumi.Output[str]:
        """
        Specifies a custom UUID for the app role. If omitted, a random UUID will be automatically generated. Changing this field forces a new resource to be created.
        """
        return pulumi.get(self, "role_id")

    @property
    @pulumi.getter
    def value(self) -> pulumi.Output[Optional[str]]:
        """
        Specifies the value of the roles claim that the application should expect in the authentication and access tokens.
        """
        return pulumi.get(self, "value")

    def translate_output_property(self, prop):
        return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

