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

__all__ = ['UserArgs', 'User']

@pulumi.input_type
class UserArgs:
    def __init__(__self__, *,
                 identity_provider_type: pulumi.Input[_builtins.str],
                 mongo_cluster_id: pulumi.Input[_builtins.str],
                 object_id: pulumi.Input[_builtins.str],
                 principal_type: pulumi.Input[_builtins.str],
                 roles: pulumi.Input[Sequence[pulumi.Input['UserRoleArgs']]]):
        """
        The set of arguments for constructing a User resource.

        :param pulumi.Input[_builtins.str] identity_provider_type: The identity provider type for the Mongo Cluster User. The only possible value is `MicrosoftEntraID`. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] mongo_cluster_id: The ID of the Mongo Cluster where the User should exist. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] object_id: The Object ID of the Entra ID User or Service Principal. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] principal_type: The principal type for the Mongo Cluster User. Possible values are `user` and `servicePrincipal`. Changing this forces a new resource to be created.
        :param pulumi.Input[Sequence[pulumi.Input['UserRoleArgs']]] roles: One or more `role` blocks as defined below. Changing this forces a new resource to be created.
        """
        pulumi.set(__self__, "identity_provider_type", identity_provider_type)
        pulumi.set(__self__, "mongo_cluster_id", mongo_cluster_id)
        pulumi.set(__self__, "object_id", object_id)
        pulumi.set(__self__, "principal_type", principal_type)
        pulumi.set(__self__, "roles", roles)

    @_builtins.property
    @pulumi.getter(name="identityProviderType")
    def identity_provider_type(self) -> pulumi.Input[_builtins.str]:
        """
        The identity provider type for the Mongo Cluster User. The only possible value is `MicrosoftEntraID`. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "identity_provider_type")

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

    @_builtins.property
    @pulumi.getter(name="mongoClusterId")
    def mongo_cluster_id(self) -> pulumi.Input[_builtins.str]:
        """
        The ID of the Mongo Cluster where the User should exist. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "mongo_cluster_id")

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

    @_builtins.property
    @pulumi.getter(name="objectId")
    def object_id(self) -> pulumi.Input[_builtins.str]:
        """
        The Object ID of the Entra ID User or Service Principal. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "object_id")

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

    @_builtins.property
    @pulumi.getter(name="principalType")
    def principal_type(self) -> pulumi.Input[_builtins.str]:
        """
        The principal type for the Mongo Cluster User. Possible values are `user` and `servicePrincipal`. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "principal_type")

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

    @_builtins.property
    @pulumi.getter
    def roles(self) -> pulumi.Input[Sequence[pulumi.Input['UserRoleArgs']]]:
        """
        One or more `role` blocks as defined below. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "roles")

    @roles.setter
    def roles(self, value: pulumi.Input[Sequence[pulumi.Input['UserRoleArgs']]]):
        pulumi.set(self, "roles", value)


@pulumi.input_type
class _UserState:
    def __init__(__self__, *,
                 identity_provider_type: Optional[pulumi.Input[_builtins.str]] = None,
                 mongo_cluster_id: Optional[pulumi.Input[_builtins.str]] = None,
                 object_id: Optional[pulumi.Input[_builtins.str]] = None,
                 principal_type: Optional[pulumi.Input[_builtins.str]] = None,
                 roles: Optional[pulumi.Input[Sequence[pulumi.Input['UserRoleArgs']]]] = None):
        """
        Input properties used for looking up and filtering User resources.

        :param pulumi.Input[_builtins.str] identity_provider_type: The identity provider type for the Mongo Cluster User. The only possible value is `MicrosoftEntraID`. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] mongo_cluster_id: The ID of the Mongo Cluster where the User should exist. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] object_id: The Object ID of the Entra ID User or Service Principal. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] principal_type: The principal type for the Mongo Cluster User. Possible values are `user` and `servicePrincipal`. Changing this forces a new resource to be created.
        :param pulumi.Input[Sequence[pulumi.Input['UserRoleArgs']]] roles: One or more `role` blocks as defined below. Changing this forces a new resource to be created.
        """
        if identity_provider_type is not None:
            pulumi.set(__self__, "identity_provider_type", identity_provider_type)
        if mongo_cluster_id is not None:
            pulumi.set(__self__, "mongo_cluster_id", mongo_cluster_id)
        if object_id is not None:
            pulumi.set(__self__, "object_id", object_id)
        if principal_type is not None:
            pulumi.set(__self__, "principal_type", principal_type)
        if roles is not None:
            pulumi.set(__self__, "roles", roles)

    @_builtins.property
    @pulumi.getter(name="identityProviderType")
    def identity_provider_type(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The identity provider type for the Mongo Cluster User. The only possible value is `MicrosoftEntraID`. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "identity_provider_type")

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

    @_builtins.property
    @pulumi.getter(name="mongoClusterId")
    def mongo_cluster_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The ID of the Mongo Cluster where the User should exist. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "mongo_cluster_id")

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

    @_builtins.property
    @pulumi.getter(name="objectId")
    def object_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The Object ID of the Entra ID User or Service Principal. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "object_id")

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

    @_builtins.property
    @pulumi.getter(name="principalType")
    def principal_type(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The principal type for the Mongo Cluster User. Possible values are `user` and `servicePrincipal`. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "principal_type")

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

    @_builtins.property
    @pulumi.getter
    def roles(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['UserRoleArgs']]]]:
        """
        One or more `role` blocks as defined below. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "roles")

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


@pulumi.type_token("azure:mongocluster/user:User")
class User(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 identity_provider_type: Optional[pulumi.Input[_builtins.str]] = None,
                 mongo_cluster_id: Optional[pulumi.Input[_builtins.str]] = None,
                 object_id: Optional[pulumi.Input[_builtins.str]] = None,
                 principal_type: Optional[pulumi.Input[_builtins.str]] = None,
                 roles: Optional[pulumi.Input[Sequence[pulumi.Input[Union['UserRoleArgs', 'UserRoleArgsDict']]]]] = None,
                 __props__=None):
        """
        Manages a Mongo Cluster User.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure

        current = azure.core.get_client_config()
        example = azure.core.ResourceGroup("example",
            name="example-resources",
            location="West Europe")
        example_mongo_cluster = azure.mongocluster.MongoCluster("example",
            name="example-mc",
            resource_group_name=example.name,
            location=example.location,
            administrator_username="adminTerraform",
            administrator_password="QAZwsx123",
            shard_count=1,
            compute_tier="M30",
            high_availability_mode="Disabled",
            storage_size_in_gb=32,
            version="8.0",
            authentication_methods=[
                "NativeAuth",
                "MicrosoftEntraID",
            ])
        example_user = azure.mongocluster.User("example",
            object_id=current.object_id,
            mongo_cluster_id=example_mongo_cluster.id,
            identity_provider_type="MicrosoftEntraID",
            principal_type="servicePrincipal",
            roles=[{
                "database": "admin",
                "name": "root",
            }])
        ```

        ## API Providers

        <!-- This section is generated, changes will be overwritten -->
        This resource uses the following Azure API Providers:

        * `Microsoft.DocumentDB` - 2025-09-01

        ## Import

        Mongo Cluster Users can be imported using the `resource id`, e.g.

        ```sh
        $ pulumi import azure:mongocluster/user:User example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DocumentDB/mongoClusters/cluster1/users/user1
        ```


        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.str] identity_provider_type: The identity provider type for the Mongo Cluster User. The only possible value is `MicrosoftEntraID`. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] mongo_cluster_id: The ID of the Mongo Cluster where the User should exist. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] object_id: The Object ID of the Entra ID User or Service Principal. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] principal_type: The principal type for the Mongo Cluster User. Possible values are `user` and `servicePrincipal`. Changing this forces a new resource to be created.
        :param pulumi.Input[Sequence[pulumi.Input[Union['UserRoleArgs', 'UserRoleArgsDict']]]] roles: One or more `role` blocks as defined below. Changing this forces a new resource to be created.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: UserArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Manages a Mongo Cluster User.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure

        current = azure.core.get_client_config()
        example = azure.core.ResourceGroup("example",
            name="example-resources",
            location="West Europe")
        example_mongo_cluster = azure.mongocluster.MongoCluster("example",
            name="example-mc",
            resource_group_name=example.name,
            location=example.location,
            administrator_username="adminTerraform",
            administrator_password="QAZwsx123",
            shard_count=1,
            compute_tier="M30",
            high_availability_mode="Disabled",
            storage_size_in_gb=32,
            version="8.0",
            authentication_methods=[
                "NativeAuth",
                "MicrosoftEntraID",
            ])
        example_user = azure.mongocluster.User("example",
            object_id=current.object_id,
            mongo_cluster_id=example_mongo_cluster.id,
            identity_provider_type="MicrosoftEntraID",
            principal_type="servicePrincipal",
            roles=[{
                "database": "admin",
                "name": "root",
            }])
        ```

        ## API Providers

        <!-- This section is generated, changes will be overwritten -->
        This resource uses the following Azure API Providers:

        * `Microsoft.DocumentDB` - 2025-09-01

        ## Import

        Mongo Cluster Users can be imported using the `resource id`, e.g.

        ```sh
        $ pulumi import azure:mongocluster/user:User example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DocumentDB/mongoClusters/cluster1/users/user1
        ```


        :param str resource_name: The name of the resource.
        :param UserArgs 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(UserArgs, 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,
                 identity_provider_type: Optional[pulumi.Input[_builtins.str]] = None,
                 mongo_cluster_id: Optional[pulumi.Input[_builtins.str]] = None,
                 object_id: Optional[pulumi.Input[_builtins.str]] = None,
                 principal_type: Optional[pulumi.Input[_builtins.str]] = None,
                 roles: Optional[pulumi.Input[Sequence[pulumi.Input[Union['UserRoleArgs', 'UserRoleArgsDict']]]]] = 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__ = UserArgs.__new__(UserArgs)

            if identity_provider_type is None and not opts.urn:
                raise TypeError("Missing required property 'identity_provider_type'")
            __props__.__dict__["identity_provider_type"] = identity_provider_type
            if mongo_cluster_id is None and not opts.urn:
                raise TypeError("Missing required property 'mongo_cluster_id'")
            __props__.__dict__["mongo_cluster_id"] = mongo_cluster_id
            if object_id is None and not opts.urn:
                raise TypeError("Missing required property 'object_id'")
            __props__.__dict__["object_id"] = object_id
            if principal_type is None and not opts.urn:
                raise TypeError("Missing required property 'principal_type'")
            __props__.__dict__["principal_type"] = principal_type
            if roles is None and not opts.urn:
                raise TypeError("Missing required property 'roles'")
            __props__.__dict__["roles"] = roles
        super(User, __self__).__init__(
            'azure:mongocluster/user:User',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            identity_provider_type: Optional[pulumi.Input[_builtins.str]] = None,
            mongo_cluster_id: Optional[pulumi.Input[_builtins.str]] = None,
            object_id: Optional[pulumi.Input[_builtins.str]] = None,
            principal_type: Optional[pulumi.Input[_builtins.str]] = None,
            roles: Optional[pulumi.Input[Sequence[pulumi.Input[Union['UserRoleArgs', 'UserRoleArgsDict']]]]] = None) -> 'User':
        """
        Get an existing User 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] identity_provider_type: The identity provider type for the Mongo Cluster User. The only possible value is `MicrosoftEntraID`. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] mongo_cluster_id: The ID of the Mongo Cluster where the User should exist. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] object_id: The Object ID of the Entra ID User or Service Principal. Changing this forces a new resource to be created.
        :param pulumi.Input[_builtins.str] principal_type: The principal type for the Mongo Cluster User. Possible values are `user` and `servicePrincipal`. Changing this forces a new resource to be created.
        :param pulumi.Input[Sequence[pulumi.Input[Union['UserRoleArgs', 'UserRoleArgsDict']]]] roles: One or more `role` blocks as defined below. Changing this forces a new resource to be created.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _UserState.__new__(_UserState)

        __props__.__dict__["identity_provider_type"] = identity_provider_type
        __props__.__dict__["mongo_cluster_id"] = mongo_cluster_id
        __props__.__dict__["object_id"] = object_id
        __props__.__dict__["principal_type"] = principal_type
        __props__.__dict__["roles"] = roles
        return User(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter(name="identityProviderType")
    def identity_provider_type(self) -> pulumi.Output[_builtins.str]:
        """
        The identity provider type for the Mongo Cluster User. The only possible value is `MicrosoftEntraID`. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "identity_provider_type")

    @_builtins.property
    @pulumi.getter(name="mongoClusterId")
    def mongo_cluster_id(self) -> pulumi.Output[_builtins.str]:
        """
        The ID of the Mongo Cluster where the User should exist. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "mongo_cluster_id")

    @_builtins.property
    @pulumi.getter(name="objectId")
    def object_id(self) -> pulumi.Output[_builtins.str]:
        """
        The Object ID of the Entra ID User or Service Principal. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "object_id")

    @_builtins.property
    @pulumi.getter(name="principalType")
    def principal_type(self) -> pulumi.Output[_builtins.str]:
        """
        The principal type for the Mongo Cluster User. Possible values are `user` and `servicePrincipal`. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "principal_type")

    @_builtins.property
    @pulumi.getter
    def roles(self) -> pulumi.Output[Sequence['outputs.UserRole']]:
        """
        One or more `role` blocks as defined below. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "roles")

