# 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 builtins
import copy
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__ = ['RoleUserAttachmentArgs', 'RoleUserAttachment']

@pulumi.input_type
class RoleUserAttachmentArgs:
    def __init__(__self__, *,
                 project_name: pulumi.Input[builtins.str],
                 role_name: pulumi.Input[builtins.str],
                 user: Optional[pulumi.Input[builtins.str]] = None):
        """
        The set of arguments for constructing a RoleUserAttachment resource.
        :param pulumi.Input[builtins.str] project_name: Project Name
        :param pulumi.Input[builtins.str] role_name: Role Name, Valid Values: super_administrator, admin, Custom Role
               
               > **NOTE:** -- super_administrator: the built-in management role of MaxCompute. The Super Administrator of the project has the permission to operate all resources in the project and the management permission. Project owners or users with the Super_Administrator role can assign the Super_Administrator role to other users. -- admin: the built-in management role of MaxCompute, which has the permission to operate all resources in the project and some basic management permissions. Project owners can assign the Admin role to other users. -- Custom role: a role that is not built-in to MaxCompute and needs to be customized. You can refer to the role (starting with role_) definition in DataWorks.
        :param pulumi.Input[builtins.str] user: Supported input: Alibaba Cloud account, RAM user, and RAM role
               
               > **NOTE:** -- Alibaba Cloud account: the account registered on the Alibaba Cloud official website. - RAM User: a user created by an Alibaba Cloud account to assist the Alibaba Cloud account to complete data processing. -- RAM role: a RAM role, like a RAM user, is a type of RAM identity. A RAM role is a virtual user that does not have a specific identity authentication key and needs to be played by a trusted entity user for normal use.
        """
        pulumi.set(__self__, "project_name", project_name)
        pulumi.set(__self__, "role_name", role_name)
        if user is not None:
            pulumi.set(__self__, "user", user)

    @property
    @pulumi.getter(name="projectName")
    def project_name(self) -> pulumi.Input[builtins.str]:
        """
        Project Name
        """
        return pulumi.get(self, "project_name")

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

    @property
    @pulumi.getter(name="roleName")
    def role_name(self) -> pulumi.Input[builtins.str]:
        """
        Role Name, Valid Values: super_administrator, admin, Custom Role

        > **NOTE:** -- super_administrator: the built-in management role of MaxCompute. The Super Administrator of the project has the permission to operate all resources in the project and the management permission. Project owners or users with the Super_Administrator role can assign the Super_Administrator role to other users. -- admin: the built-in management role of MaxCompute, which has the permission to operate all resources in the project and some basic management permissions. Project owners can assign the Admin role to other users. -- Custom role: a role that is not built-in to MaxCompute and needs to be customized. You can refer to the role (starting with role_) definition in DataWorks.
        """
        return pulumi.get(self, "role_name")

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

    @property
    @pulumi.getter
    def user(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        Supported input: Alibaba Cloud account, RAM user, and RAM role

        > **NOTE:** -- Alibaba Cloud account: the account registered on the Alibaba Cloud official website. - RAM User: a user created by an Alibaba Cloud account to assist the Alibaba Cloud account to complete data processing. -- RAM role: a RAM role, like a RAM user, is a type of RAM identity. A RAM role is a virtual user that does not have a specific identity authentication key and needs to be played by a trusted entity user for normal use.
        """
        return pulumi.get(self, "user")

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


@pulumi.input_type
class _RoleUserAttachmentState:
    def __init__(__self__, *,
                 project_name: Optional[pulumi.Input[builtins.str]] = None,
                 role_name: Optional[pulumi.Input[builtins.str]] = None,
                 user: Optional[pulumi.Input[builtins.str]] = None):
        """
        Input properties used for looking up and filtering RoleUserAttachment resources.
        :param pulumi.Input[builtins.str] project_name: Project Name
        :param pulumi.Input[builtins.str] role_name: Role Name, Valid Values: super_administrator, admin, Custom Role
               
               > **NOTE:** -- super_administrator: the built-in management role of MaxCompute. The Super Administrator of the project has the permission to operate all resources in the project and the management permission. Project owners or users with the Super_Administrator role can assign the Super_Administrator role to other users. -- admin: the built-in management role of MaxCompute, which has the permission to operate all resources in the project and some basic management permissions. Project owners can assign the Admin role to other users. -- Custom role: a role that is not built-in to MaxCompute and needs to be customized. You can refer to the role (starting with role_) definition in DataWorks.
        :param pulumi.Input[builtins.str] user: Supported input: Alibaba Cloud account, RAM user, and RAM role
               
               > **NOTE:** -- Alibaba Cloud account: the account registered on the Alibaba Cloud official website. - RAM User: a user created by an Alibaba Cloud account to assist the Alibaba Cloud account to complete data processing. -- RAM role: a RAM role, like a RAM user, is a type of RAM identity. A RAM role is a virtual user that does not have a specific identity authentication key and needs to be played by a trusted entity user for normal use.
        """
        if project_name is not None:
            pulumi.set(__self__, "project_name", project_name)
        if role_name is not None:
            pulumi.set(__self__, "role_name", role_name)
        if user is not None:
            pulumi.set(__self__, "user", user)

    @property
    @pulumi.getter(name="projectName")
    def project_name(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        Project Name
        """
        return pulumi.get(self, "project_name")

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

    @property
    @pulumi.getter(name="roleName")
    def role_name(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        Role Name, Valid Values: super_administrator, admin, Custom Role

        > **NOTE:** -- super_administrator: the built-in management role of MaxCompute. The Super Administrator of the project has the permission to operate all resources in the project and the management permission. Project owners or users with the Super_Administrator role can assign the Super_Administrator role to other users. -- admin: the built-in management role of MaxCompute, which has the permission to operate all resources in the project and some basic management permissions. Project owners can assign the Admin role to other users. -- Custom role: a role that is not built-in to MaxCompute and needs to be customized. You can refer to the role (starting with role_) definition in DataWorks.
        """
        return pulumi.get(self, "role_name")

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

    @property
    @pulumi.getter
    def user(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        Supported input: Alibaba Cloud account, RAM user, and RAM role

        > **NOTE:** -- Alibaba Cloud account: the account registered on the Alibaba Cloud official website. - RAM User: a user created by an Alibaba Cloud account to assist the Alibaba Cloud account to complete data processing. -- RAM role: a RAM role, like a RAM user, is a type of RAM identity. A RAM role is a virtual user that does not have a specific identity authentication key and needs to be played by a trusted entity user for normal use.
        """
        return pulumi.get(self, "user")

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


@pulumi.type_token("alicloud:maxcompute/roleUserAttachment:RoleUserAttachment")
class RoleUserAttachment(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 project_name: Optional[pulumi.Input[builtins.str]] = None,
                 role_name: Optional[pulumi.Input[builtins.str]] = None,
                 user: Optional[pulumi.Input[builtins.str]] = None,
                 __props__=None):
        """
        Provides a Max Compute Role User Attachment resource.

        Resources associated with a user and a project-level role.

        For information about Max Compute Role User Attachment and how to use it, see [What is Role User Attachment](https://www.alibabacloud.com/help/en/).

        > **NOTE:** Available since v1.242.0.

        ## Example Usage

        Basic Usage

        ```python
        import pulumi
        import pulumi_alicloud as alicloud

        config = pulumi.Config()
        name = config.get("name")
        if name is None:
            name = "terraform-example"
        aliyun_user = config.get("aliyunUser")
        if aliyun_user is None:
            aliyun_user = "ALIYUN$openapiautomation@test.aliyunid.com"
        ram_user = config.get("ramUser")
        if ram_user is None:
            ram_user = "RAM$openapiautomation@test.aliyunid.com:tf-example"
        ram_role = config.get("ramRole")
        if ram_role is None:
            ram_role = "RAM$openapiautomation@test.aliyunid.com:role/terraform-no-ak-assumerole-no-deleting"
        role_name = config.get("roleName")
        if role_name is None:
            role_name = "role_project_admin"
        project_name = config.get("projectName")
        if project_name is None:
            project_name = "default_project_669886c"
        default = alicloud.maxcompute.RoleUserAttachment("default",
            role_name=role_name,
            user=ram_role,
            project_name=project_name)
        ```

        ## Import

        Max Compute Role User Attachment can be imported using the id, e.g.

        ```sh
        $ pulumi import alicloud:maxcompute/roleUserAttachment:RoleUserAttachment example <project_name>-<role_name>-<user>
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[builtins.str] project_name: Project Name
        :param pulumi.Input[builtins.str] role_name: Role Name, Valid Values: super_administrator, admin, Custom Role
               
               > **NOTE:** -- super_administrator: the built-in management role of MaxCompute. The Super Administrator of the project has the permission to operate all resources in the project and the management permission. Project owners or users with the Super_Administrator role can assign the Super_Administrator role to other users. -- admin: the built-in management role of MaxCompute, which has the permission to operate all resources in the project and some basic management permissions. Project owners can assign the Admin role to other users. -- Custom role: a role that is not built-in to MaxCompute and needs to be customized. You can refer to the role (starting with role_) definition in DataWorks.
        :param pulumi.Input[builtins.str] user: Supported input: Alibaba Cloud account, RAM user, and RAM role
               
               > **NOTE:** -- Alibaba Cloud account: the account registered on the Alibaba Cloud official website. - RAM User: a user created by an Alibaba Cloud account to assist the Alibaba Cloud account to complete data processing. -- RAM role: a RAM role, like a RAM user, is a type of RAM identity. A RAM role is a virtual user that does not have a specific identity authentication key and needs to be played by a trusted entity user for normal use.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: RoleUserAttachmentArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Provides a Max Compute Role User Attachment resource.

        Resources associated with a user and a project-level role.

        For information about Max Compute Role User Attachment and how to use it, see [What is Role User Attachment](https://www.alibabacloud.com/help/en/).

        > **NOTE:** Available since v1.242.0.

        ## Example Usage

        Basic Usage

        ```python
        import pulumi
        import pulumi_alicloud as alicloud

        config = pulumi.Config()
        name = config.get("name")
        if name is None:
            name = "terraform-example"
        aliyun_user = config.get("aliyunUser")
        if aliyun_user is None:
            aliyun_user = "ALIYUN$openapiautomation@test.aliyunid.com"
        ram_user = config.get("ramUser")
        if ram_user is None:
            ram_user = "RAM$openapiautomation@test.aliyunid.com:tf-example"
        ram_role = config.get("ramRole")
        if ram_role is None:
            ram_role = "RAM$openapiautomation@test.aliyunid.com:role/terraform-no-ak-assumerole-no-deleting"
        role_name = config.get("roleName")
        if role_name is None:
            role_name = "role_project_admin"
        project_name = config.get("projectName")
        if project_name is None:
            project_name = "default_project_669886c"
        default = alicloud.maxcompute.RoleUserAttachment("default",
            role_name=role_name,
            user=ram_role,
            project_name=project_name)
        ```

        ## Import

        Max Compute Role User Attachment can be imported using the id, e.g.

        ```sh
        $ pulumi import alicloud:maxcompute/roleUserAttachment:RoleUserAttachment example <project_name>-<role_name>-<user>
        ```

        :param str resource_name: The name of the resource.
        :param RoleUserAttachmentArgs 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(RoleUserAttachmentArgs, 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,
                 project_name: Optional[pulumi.Input[builtins.str]] = None,
                 role_name: Optional[pulumi.Input[builtins.str]] = None,
                 user: 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__ = RoleUserAttachmentArgs.__new__(RoleUserAttachmentArgs)

            if project_name is None and not opts.urn:
                raise TypeError("Missing required property 'project_name'")
            __props__.__dict__["project_name"] = project_name
            if role_name is None and not opts.urn:
                raise TypeError("Missing required property 'role_name'")
            __props__.__dict__["role_name"] = role_name
            __props__.__dict__["user"] = user
        super(RoleUserAttachment, __self__).__init__(
            'alicloud:maxcompute/roleUserAttachment:RoleUserAttachment',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            project_name: Optional[pulumi.Input[builtins.str]] = None,
            role_name: Optional[pulumi.Input[builtins.str]] = None,
            user: Optional[pulumi.Input[builtins.str]] = None) -> 'RoleUserAttachment':
        """
        Get an existing RoleUserAttachment 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] project_name: Project Name
        :param pulumi.Input[builtins.str] role_name: Role Name, Valid Values: super_administrator, admin, Custom Role
               
               > **NOTE:** -- super_administrator: the built-in management role of MaxCompute. The Super Administrator of the project has the permission to operate all resources in the project and the management permission. Project owners or users with the Super_Administrator role can assign the Super_Administrator role to other users. -- admin: the built-in management role of MaxCompute, which has the permission to operate all resources in the project and some basic management permissions. Project owners can assign the Admin role to other users. -- Custom role: a role that is not built-in to MaxCompute and needs to be customized. You can refer to the role (starting with role_) definition in DataWorks.
        :param pulumi.Input[builtins.str] user: Supported input: Alibaba Cloud account, RAM user, and RAM role
               
               > **NOTE:** -- Alibaba Cloud account: the account registered on the Alibaba Cloud official website. - RAM User: a user created by an Alibaba Cloud account to assist the Alibaba Cloud account to complete data processing. -- RAM role: a RAM role, like a RAM user, is a type of RAM identity. A RAM role is a virtual user that does not have a specific identity authentication key and needs to be played by a trusted entity user for normal use.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _RoleUserAttachmentState.__new__(_RoleUserAttachmentState)

        __props__.__dict__["project_name"] = project_name
        __props__.__dict__["role_name"] = role_name
        __props__.__dict__["user"] = user
        return RoleUserAttachment(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="projectName")
    def project_name(self) -> pulumi.Output[builtins.str]:
        """
        Project Name
        """
        return pulumi.get(self, "project_name")

    @property
    @pulumi.getter(name="roleName")
    def role_name(self) -> pulumi.Output[builtins.str]:
        """
        Role Name, Valid Values: super_administrator, admin, Custom Role

        > **NOTE:** -- super_administrator: the built-in management role of MaxCompute. The Super Administrator of the project has the permission to operate all resources in the project and the management permission. Project owners or users with the Super_Administrator role can assign the Super_Administrator role to other users. -- admin: the built-in management role of MaxCompute, which has the permission to operate all resources in the project and some basic management permissions. Project owners can assign the Admin role to other users. -- Custom role: a role that is not built-in to MaxCompute and needs to be customized. You can refer to the role (starting with role_) definition in DataWorks.
        """
        return pulumi.get(self, "role_name")

    @property
    @pulumi.getter
    def user(self) -> pulumi.Output[builtins.str]:
        """
        Supported input: Alibaba Cloud account, RAM user, and RAM role

        > **NOTE:** -- Alibaba Cloud account: the account registered on the Alibaba Cloud official website. - RAM User: a user created by an Alibaba Cloud account to assist the Alibaba Cloud account to complete data processing. -- RAM role: a RAM role, like a RAM user, is a type of RAM identity. A RAM role is a virtual user that does not have a specific identity authentication key and needs to be played by a trusted entity user for normal use.
        """
        return pulumi.get(self, "user")

