# 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__ = ['MongoDbUserArgs', 'MongoDbUser']

@pulumi.input_type
class MongoDbUserArgs:
    def __init__(__self__, *,
                 cluster_id: pulumi.Input[builtins.str],
                 service_name: pulumi.Input[builtins.str],
                 name: Optional[pulumi.Input[builtins.str]] = None,
                 password_reset: Optional[pulumi.Input[builtins.str]] = None,
                 roles: Optional[pulumi.Input[Sequence[pulumi.Input[builtins.str]]]] = None):
        """
        The set of arguments for constructing a MongoDbUser resource.
        :param pulumi.Input[builtins.str] cluster_id: Cluster ID.
        :param pulumi.Input[builtins.str] service_name: The id of the public cloud project. If omitted, the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used.
        :param pulumi.Input[builtins.str] name: Name of the user. A user named "admin" is mapped with already created admin@admin user instead of creating a new user.
        :param pulumi.Input[builtins.str] password_reset: Arbitrary string to change to trigger a password update
        :param pulumi.Input[Sequence[pulumi.Input[builtins.str]]] roles: Roles the user belongs to. Since version 0.37.0, the authentication database must be indicated for all roles. Available roles:
               * `backup@admin`
               * `clusterAdmin@admin`
               * `clusterManager@admin`
               * `clusterMonitor@admin`
               * `dbAdmin@(defined db)`
               * `dbAdminAnyDatabase@admin`
               * `dbOwner@(defined db)`
               * `enableSharding@(defined db)`
               * `hostManager@admin`
               * `read@(defined db)`
               * `readAnyDatabase@admin`
               * `readWrite@(defined db)`
               * `readWriteAnyDatabase@admin`
               * `restore@admin`
               * `root@admin`
               * `userAdmin@(defined db)`
               * `userAdminAnyDatabase@admin`
        """
        pulumi.set(__self__, "cluster_id", cluster_id)
        pulumi.set(__self__, "service_name", service_name)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if password_reset is not None:
            pulumi.set(__self__, "password_reset", password_reset)
        if roles is not None:
            pulumi.set(__self__, "roles", roles)

    @property
    @pulumi.getter(name="clusterId")
    def cluster_id(self) -> pulumi.Input[builtins.str]:
        """
        Cluster ID.
        """
        return pulumi.get(self, "cluster_id")

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

    @property
    @pulumi.getter(name="serviceName")
    def service_name(self) -> pulumi.Input[builtins.str]:
        """
        The id of the public cloud project. If omitted, the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used.
        """
        return pulumi.get(self, "service_name")

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

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        Name of the user. A user named "admin" is mapped with already created admin@admin user instead of creating a new user.
        """
        return pulumi.get(self, "name")

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

    @property
    @pulumi.getter(name="passwordReset")
    def password_reset(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        Arbitrary string to change to trigger a password update
        """
        return pulumi.get(self, "password_reset")

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

    @property
    @pulumi.getter
    def roles(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[builtins.str]]]]:
        """
        Roles the user belongs to. Since version 0.37.0, the authentication database must be indicated for all roles. Available roles:
        * `backup@admin`
        * `clusterAdmin@admin`
        * `clusterManager@admin`
        * `clusterMonitor@admin`
        * `dbAdmin@(defined db)`
        * `dbAdminAnyDatabase@admin`
        * `dbOwner@(defined db)`
        * `enableSharding@(defined db)`
        * `hostManager@admin`
        * `read@(defined db)`
        * `readAnyDatabase@admin`
        * `readWrite@(defined db)`
        * `readWriteAnyDatabase@admin`
        * `restore@admin`
        * `root@admin`
        * `userAdmin@(defined db)`
        * `userAdminAnyDatabase@admin`
        """
        return pulumi.get(self, "roles")

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


@pulumi.input_type
class _MongoDbUserState:
    def __init__(__self__, *,
                 cluster_id: Optional[pulumi.Input[builtins.str]] = None,
                 created_at: Optional[pulumi.Input[builtins.str]] = None,
                 name: Optional[pulumi.Input[builtins.str]] = None,
                 password: Optional[pulumi.Input[builtins.str]] = None,
                 password_reset: Optional[pulumi.Input[builtins.str]] = None,
                 roles: Optional[pulumi.Input[Sequence[pulumi.Input[builtins.str]]]] = None,
                 service_name: Optional[pulumi.Input[builtins.str]] = None,
                 status: Optional[pulumi.Input[builtins.str]] = None):
        """
        Input properties used for looking up and filtering MongoDbUser resources.
        :param pulumi.Input[builtins.str] cluster_id: Cluster ID.
        :param pulumi.Input[builtins.str] created_at: Date of the creation of the user.
        :param pulumi.Input[builtins.str] name: Name of the user. A user named "admin" is mapped with already created admin@admin user instead of creating a new user.
        :param pulumi.Input[builtins.str] password: (Sensitive) Password of the user.
        :param pulumi.Input[builtins.str] password_reset: Arbitrary string to change to trigger a password update
        :param pulumi.Input[Sequence[pulumi.Input[builtins.str]]] roles: Roles the user belongs to. Since version 0.37.0, the authentication database must be indicated for all roles. Available roles:
               * `backup@admin`
               * `clusterAdmin@admin`
               * `clusterManager@admin`
               * `clusterMonitor@admin`
               * `dbAdmin@(defined db)`
               * `dbAdminAnyDatabase@admin`
               * `dbOwner@(defined db)`
               * `enableSharding@(defined db)`
               * `hostManager@admin`
               * `read@(defined db)`
               * `readAnyDatabase@admin`
               * `readWrite@(defined db)`
               * `readWriteAnyDatabase@admin`
               * `restore@admin`
               * `root@admin`
               * `userAdmin@(defined db)`
               * `userAdminAnyDatabase@admin`
        :param pulumi.Input[builtins.str] service_name: The id of the public cloud project. If omitted, the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used.
        :param pulumi.Input[builtins.str] status: Current status of the user.
        """
        if cluster_id is not None:
            pulumi.set(__self__, "cluster_id", cluster_id)
        if created_at is not None:
            pulumi.set(__self__, "created_at", created_at)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if password is not None:
            pulumi.set(__self__, "password", password)
        if password_reset is not None:
            pulumi.set(__self__, "password_reset", password_reset)
        if roles is not None:
            pulumi.set(__self__, "roles", roles)
        if service_name is not None:
            pulumi.set(__self__, "service_name", service_name)
        if status is not None:
            pulumi.set(__self__, "status", status)

    @property
    @pulumi.getter(name="clusterId")
    def cluster_id(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        Cluster ID.
        """
        return pulumi.get(self, "cluster_id")

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

    @property
    @pulumi.getter(name="createdAt")
    def created_at(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        Date of the creation of the user.
        """
        return pulumi.get(self, "created_at")

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

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        Name of the user. A user named "admin" is mapped with already created admin@admin user instead of creating a new user.
        """
        return pulumi.get(self, "name")

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

    @property
    @pulumi.getter
    def password(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        (Sensitive) Password of the user.
        """
        return pulumi.get(self, "password")

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

    @property
    @pulumi.getter(name="passwordReset")
    def password_reset(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        Arbitrary string to change to trigger a password update
        """
        return pulumi.get(self, "password_reset")

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

    @property
    @pulumi.getter
    def roles(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[builtins.str]]]]:
        """
        Roles the user belongs to. Since version 0.37.0, the authentication database must be indicated for all roles. Available roles:
        * `backup@admin`
        * `clusterAdmin@admin`
        * `clusterManager@admin`
        * `clusterMonitor@admin`
        * `dbAdmin@(defined db)`
        * `dbAdminAnyDatabase@admin`
        * `dbOwner@(defined db)`
        * `enableSharding@(defined db)`
        * `hostManager@admin`
        * `read@(defined db)`
        * `readAnyDatabase@admin`
        * `readWrite@(defined db)`
        * `readWriteAnyDatabase@admin`
        * `restore@admin`
        * `root@admin`
        * `userAdmin@(defined db)`
        * `userAdminAnyDatabase@admin`
        """
        return pulumi.get(self, "roles")

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

    @property
    @pulumi.getter(name="serviceName")
    def service_name(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        The id of the public cloud project. If omitted, the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used.
        """
        return pulumi.get(self, "service_name")

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

    @property
    @pulumi.getter
    def status(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        Current status of the user.
        """
        return pulumi.get(self, "status")

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


class MongoDbUser(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 cluster_id: Optional[pulumi.Input[builtins.str]] = None,
                 name: Optional[pulumi.Input[builtins.str]] = None,
                 password_reset: Optional[pulumi.Input[builtins.str]] = None,
                 roles: Optional[pulumi.Input[Sequence[pulumi.Input[builtins.str]]]] = None,
                 service_name: Optional[pulumi.Input[builtins.str]] = None,
                 __props__=None):
        """
        ## Import

        OVHcloud Managed MongoDB clusters users can be imported using the `service_name`, `cluster_id` and `id` of the user, separated by "/" E.g.,

        bash

        ```sh
        $ pulumi import ovh:CloudProjectDatabase/mongoDbUser:MongoDbUser my_user service_name/cluster_id/id
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[builtins.str] cluster_id: Cluster ID.
        :param pulumi.Input[builtins.str] name: Name of the user. A user named "admin" is mapped with already created admin@admin user instead of creating a new user.
        :param pulumi.Input[builtins.str] password_reset: Arbitrary string to change to trigger a password update
        :param pulumi.Input[Sequence[pulumi.Input[builtins.str]]] roles: Roles the user belongs to. Since version 0.37.0, the authentication database must be indicated for all roles. Available roles:
               * `backup@admin`
               * `clusterAdmin@admin`
               * `clusterManager@admin`
               * `clusterMonitor@admin`
               * `dbAdmin@(defined db)`
               * `dbAdminAnyDatabase@admin`
               * `dbOwner@(defined db)`
               * `enableSharding@(defined db)`
               * `hostManager@admin`
               * `read@(defined db)`
               * `readAnyDatabase@admin`
               * `readWrite@(defined db)`
               * `readWriteAnyDatabase@admin`
               * `restore@admin`
               * `root@admin`
               * `userAdmin@(defined db)`
               * `userAdminAnyDatabase@admin`
        :param pulumi.Input[builtins.str] service_name: The id of the public cloud project. If omitted, the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: MongoDbUserArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        ## Import

        OVHcloud Managed MongoDB clusters users can be imported using the `service_name`, `cluster_id` and `id` of the user, separated by "/" E.g.,

        bash

        ```sh
        $ pulumi import ovh:CloudProjectDatabase/mongoDbUser:MongoDbUser my_user service_name/cluster_id/id
        ```

        :param str resource_name: The name of the resource.
        :param MongoDbUserArgs 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(MongoDbUserArgs, 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,
                 cluster_id: Optional[pulumi.Input[builtins.str]] = None,
                 name: Optional[pulumi.Input[builtins.str]] = None,
                 password_reset: Optional[pulumi.Input[builtins.str]] = None,
                 roles: Optional[pulumi.Input[Sequence[pulumi.Input[builtins.str]]]] = None,
                 service_name: 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__ = MongoDbUserArgs.__new__(MongoDbUserArgs)

            if cluster_id is None and not opts.urn:
                raise TypeError("Missing required property 'cluster_id'")
            __props__.__dict__["cluster_id"] = cluster_id
            __props__.__dict__["name"] = name
            __props__.__dict__["password_reset"] = password_reset
            __props__.__dict__["roles"] = roles
            if service_name is None and not opts.urn:
                raise TypeError("Missing required property 'service_name'")
            __props__.__dict__["service_name"] = service_name
            __props__.__dict__["created_at"] = None
            __props__.__dict__["password"] = None
            __props__.__dict__["status"] = None
        secret_opts = pulumi.ResourceOptions(additional_secret_outputs=["password"])
        opts = pulumi.ResourceOptions.merge(opts, secret_opts)
        super(MongoDbUser, __self__).__init__(
            'ovh:CloudProjectDatabase/mongoDbUser:MongoDbUser',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            cluster_id: Optional[pulumi.Input[builtins.str]] = None,
            created_at: Optional[pulumi.Input[builtins.str]] = None,
            name: Optional[pulumi.Input[builtins.str]] = None,
            password: Optional[pulumi.Input[builtins.str]] = None,
            password_reset: Optional[pulumi.Input[builtins.str]] = None,
            roles: Optional[pulumi.Input[Sequence[pulumi.Input[builtins.str]]]] = None,
            service_name: Optional[pulumi.Input[builtins.str]] = None,
            status: Optional[pulumi.Input[builtins.str]] = None) -> 'MongoDbUser':
        """
        Get an existing MongoDbUser 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] cluster_id: Cluster ID.
        :param pulumi.Input[builtins.str] created_at: Date of the creation of the user.
        :param pulumi.Input[builtins.str] name: Name of the user. A user named "admin" is mapped with already created admin@admin user instead of creating a new user.
        :param pulumi.Input[builtins.str] password: (Sensitive) Password of the user.
        :param pulumi.Input[builtins.str] password_reset: Arbitrary string to change to trigger a password update
        :param pulumi.Input[Sequence[pulumi.Input[builtins.str]]] roles: Roles the user belongs to. Since version 0.37.0, the authentication database must be indicated for all roles. Available roles:
               * `backup@admin`
               * `clusterAdmin@admin`
               * `clusterManager@admin`
               * `clusterMonitor@admin`
               * `dbAdmin@(defined db)`
               * `dbAdminAnyDatabase@admin`
               * `dbOwner@(defined db)`
               * `enableSharding@(defined db)`
               * `hostManager@admin`
               * `read@(defined db)`
               * `readAnyDatabase@admin`
               * `readWrite@(defined db)`
               * `readWriteAnyDatabase@admin`
               * `restore@admin`
               * `root@admin`
               * `userAdmin@(defined db)`
               * `userAdminAnyDatabase@admin`
        :param pulumi.Input[builtins.str] service_name: The id of the public cloud project. If omitted, the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used.
        :param pulumi.Input[builtins.str] status: Current status of the user.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _MongoDbUserState.__new__(_MongoDbUserState)

        __props__.__dict__["cluster_id"] = cluster_id
        __props__.__dict__["created_at"] = created_at
        __props__.__dict__["name"] = name
        __props__.__dict__["password"] = password
        __props__.__dict__["password_reset"] = password_reset
        __props__.__dict__["roles"] = roles
        __props__.__dict__["service_name"] = service_name
        __props__.__dict__["status"] = status
        return MongoDbUser(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="clusterId")
    def cluster_id(self) -> pulumi.Output[builtins.str]:
        """
        Cluster ID.
        """
        return pulumi.get(self, "cluster_id")

    @property
    @pulumi.getter(name="createdAt")
    def created_at(self) -> pulumi.Output[builtins.str]:
        """
        Date of the creation of the user.
        """
        return pulumi.get(self, "created_at")

    @property
    @pulumi.getter
    def name(self) -> pulumi.Output[builtins.str]:
        """
        Name of the user. A user named "admin" is mapped with already created admin@admin user instead of creating a new user.
        """
        return pulumi.get(self, "name")

    @property
    @pulumi.getter
    def password(self) -> pulumi.Output[builtins.str]:
        """
        (Sensitive) Password of the user.
        """
        return pulumi.get(self, "password")

    @property
    @pulumi.getter(name="passwordReset")
    def password_reset(self) -> pulumi.Output[Optional[builtins.str]]:
        """
        Arbitrary string to change to trigger a password update
        """
        return pulumi.get(self, "password_reset")

    @property
    @pulumi.getter
    def roles(self) -> pulumi.Output[Optional[Sequence[builtins.str]]]:
        """
        Roles the user belongs to. Since version 0.37.0, the authentication database must be indicated for all roles. Available roles:
        * `backup@admin`
        * `clusterAdmin@admin`
        * `clusterManager@admin`
        * `clusterMonitor@admin`
        * `dbAdmin@(defined db)`
        * `dbAdminAnyDatabase@admin`
        * `dbOwner@(defined db)`
        * `enableSharding@(defined db)`
        * `hostManager@admin`
        * `read@(defined db)`
        * `readAnyDatabase@admin`
        * `readWrite@(defined db)`
        * `readWriteAnyDatabase@admin`
        * `restore@admin`
        * `root@admin`
        * `userAdmin@(defined db)`
        * `userAdminAnyDatabase@admin`
        """
        return pulumi.get(self, "roles")

    @property
    @pulumi.getter(name="serviceName")
    def service_name(self) -> pulumi.Output[builtins.str]:
        """
        The id of the public cloud project. If omitted, the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used.
        """
        return pulumi.get(self, "service_name")

    @property
    @pulumi.getter
    def status(self) -> pulumi.Output[builtins.str]:
        """
        Current status of the user.
        """
        return pulumi.get(self, "status")

