# 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__ = [
    'GetMysqlUserResult',
    'AwaitableGetMysqlUserResult',
    'get_mysql_user',
    'get_mysql_user_output',
]

@pulumi.output_type
class GetMysqlUserResult:
    """
    A collection of values returned by getMysqlUser.
    """
    def __init__(__self__, access_cert=None, access_key=None, authentication=None, id=None, password=None, password_wo=None, password_wo_version=None, project=None, service_name=None, timeouts=None, type=None, username=None):
        if access_cert and not isinstance(access_cert, str):
            raise TypeError("Expected argument 'access_cert' to be a str")
        pulumi.set(__self__, "access_cert", access_cert)
        if access_key and not isinstance(access_key, str):
            raise TypeError("Expected argument 'access_key' to be a str")
        pulumi.set(__self__, "access_key", access_key)
        if authentication and not isinstance(authentication, str):
            raise TypeError("Expected argument 'authentication' to be a str")
        pulumi.set(__self__, "authentication", authentication)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if password and not isinstance(password, str):
            raise TypeError("Expected argument 'password' to be a str")
        pulumi.set(__self__, "password", password)
        if password_wo and not isinstance(password_wo, str):
            raise TypeError("Expected argument 'password_wo' to be a str")
        pulumi.set(__self__, "password_wo", password_wo)
        if password_wo_version and not isinstance(password_wo_version, int):
            raise TypeError("Expected argument 'password_wo_version' to be a int")
        pulumi.set(__self__, "password_wo_version", password_wo_version)
        if project and not isinstance(project, str):
            raise TypeError("Expected argument 'project' to be a str")
        pulumi.set(__self__, "project", project)
        if service_name and not isinstance(service_name, str):
            raise TypeError("Expected argument 'service_name' to be a str")
        pulumi.set(__self__, "service_name", service_name)
        if timeouts and not isinstance(timeouts, dict):
            raise TypeError("Expected argument 'timeouts' to be a dict")
        pulumi.set(__self__, "timeouts", timeouts)
        if type and not isinstance(type, str):
            raise TypeError("Expected argument 'type' to be a str")
        pulumi.set(__self__, "type", type)
        if username and not isinstance(username, str):
            raise TypeError("Expected argument 'username' to be a str")
        pulumi.set(__self__, "username", username)

    @_builtins.property
    @pulumi.getter(name="accessCert")
    def access_cert(self) -> _builtins.str:
        """
        Access certificate for TLS client authentication.
        """
        return pulumi.get(self, "access_cert")

    @_builtins.property
    @pulumi.getter(name="accessKey")
    def access_key(self) -> _builtins.str:
        """
        Access key for TLS client authentication.
        """
        return pulumi.get(self, "access_key")

    @_builtins.property
    @pulumi.getter
    def authentication(self) -> _builtins.str:
        """
        Service specific authentication details. Currently only used for MySQL where accepted options are 'mysql*native*password' and 'caching*sha2*password', latter being default when this is not explicitly set. The possible values are `caching_sha2_password` and `mysql_native_password`.
        """
        return pulumi.get(self, "authentication")

    @_builtins.property
    @pulumi.getter
    def id(self) -> _builtins.str:
        """
        Resource ID composed as: `project/service_name/username`.
        """
        return pulumi.get(self, "id")

    @_builtins.property
    @pulumi.getter
    def password(self) -> _builtins.str:
        """
        The password of the service user (auto-generated if not provided). The field conflicts with `password_wo`.
        """
        return pulumi.get(self, "password")

    @_builtins.property
    @pulumi.getter(name="passwordWo")
    def password_wo(self) -> _builtins.str:
        """
        The password of the service user (write-only, not stored in state). The field is required with `password_wo_version`. The field conflicts with `password`.
        """
        return pulumi.get(self, "password_wo")

    @_builtins.property
    @pulumi.getter(name="passwordWoVersion")
    def password_wo_version(self) -> _builtins.int:
        """
        Version number for `password_wo`. Increment this to rotate the password. The field is required with `password_wo`.
        """
        return pulumi.get(self, "password_wo_version")

    @_builtins.property
    @pulumi.getter
    def project(self) -> _builtins.str:
        """
        Project name.
        """
        return pulumi.get(self, "project")

    @_builtins.property
    @pulumi.getter(name="serviceName")
    def service_name(self) -> _builtins.str:
        """
        The name of the MySQL® service user.
        """
        return pulumi.get(self, "service_name")

    @_builtins.property
    @pulumi.getter
    def timeouts(self) -> Optional['outputs.GetMysqlUserTimeoutsResult']:
        return pulumi.get(self, "timeouts")

    @_builtins.property
    @pulumi.getter
    def type(self) -> _builtins.str:
        """
        User account type, such as primary or regular account.
        """
        return pulumi.get(self, "type")

    @_builtins.property
    @pulumi.getter
    def username(self) -> _builtins.str:
        """
        The name of the MySQL® service user.
        """
        return pulumi.get(self, "username")


class AwaitableGetMysqlUserResult(GetMysqlUserResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetMysqlUserResult(
            access_cert=self.access_cert,
            access_key=self.access_key,
            authentication=self.authentication,
            id=self.id,
            password=self.password,
            password_wo=self.password_wo,
            password_wo_version=self.password_wo_version,
            project=self.project,
            service_name=self.service_name,
            timeouts=self.timeouts,
            type=self.type,
            username=self.username)


def get_mysql_user(project: Optional[_builtins.str] = None,
                   service_name: Optional[_builtins.str] = None,
                   timeouts: Optional[Union['GetMysqlUserTimeoutsArgs', 'GetMysqlUserTimeoutsArgsDict']] = None,
                   username: Optional[_builtins.str] = None,
                   opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetMysqlUserResult:
    """
    Gets information about an Aiven for MySQL® service user.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_aiven as aiven

    example_mysql_user = aiven.get_mysql_user(service_name=example_mysql["serviceName"],
        project=example_project["project"],
        username="example-mysql-user")
    ```


    :param _builtins.str project: Project name.
    :param _builtins.str service_name: The name of the MySQL® service user.
    :param _builtins.str username: The name of the MySQL® service user.
    """
    __args__ = dict()
    __args__['project'] = project
    __args__['serviceName'] = service_name
    __args__['timeouts'] = timeouts
    __args__['username'] = username
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('aiven:index/getMysqlUser:getMysqlUser', __args__, opts=opts, typ=GetMysqlUserResult).value

    return AwaitableGetMysqlUserResult(
        access_cert=pulumi.get(__ret__, 'access_cert'),
        access_key=pulumi.get(__ret__, 'access_key'),
        authentication=pulumi.get(__ret__, 'authentication'),
        id=pulumi.get(__ret__, 'id'),
        password=pulumi.get(__ret__, 'password'),
        password_wo=pulumi.get(__ret__, 'password_wo'),
        password_wo_version=pulumi.get(__ret__, 'password_wo_version'),
        project=pulumi.get(__ret__, 'project'),
        service_name=pulumi.get(__ret__, 'service_name'),
        timeouts=pulumi.get(__ret__, 'timeouts'),
        type=pulumi.get(__ret__, 'type'),
        username=pulumi.get(__ret__, 'username'))
def get_mysql_user_output(project: Optional[pulumi.Input[_builtins.str]] = None,
                          service_name: Optional[pulumi.Input[_builtins.str]] = None,
                          timeouts: Optional[pulumi.Input[Optional[Union['GetMysqlUserTimeoutsArgs', 'GetMysqlUserTimeoutsArgsDict']]]] = None,
                          username: Optional[pulumi.Input[_builtins.str]] = None,
                          opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetMysqlUserResult]:
    """
    Gets information about an Aiven for MySQL® service user.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_aiven as aiven

    example_mysql_user = aiven.get_mysql_user(service_name=example_mysql["serviceName"],
        project=example_project["project"],
        username="example-mysql-user")
    ```


    :param _builtins.str project: Project name.
    :param _builtins.str service_name: The name of the MySQL® service user.
    :param _builtins.str username: The name of the MySQL® service user.
    """
    __args__ = dict()
    __args__['project'] = project
    __args__['serviceName'] = service_name
    __args__['timeouts'] = timeouts
    __args__['username'] = username
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('aiven:index/getMysqlUser:getMysqlUser', __args__, opts=opts, typ=GetMysqlUserResult)
    return __ret__.apply(lambda __response__: GetMysqlUserResult(
        access_cert=pulumi.get(__response__, 'access_cert'),
        access_key=pulumi.get(__response__, 'access_key'),
        authentication=pulumi.get(__response__, 'authentication'),
        id=pulumi.get(__response__, 'id'),
        password=pulumi.get(__response__, 'password'),
        password_wo=pulumi.get(__response__, 'password_wo'),
        password_wo_version=pulumi.get(__response__, 'password_wo_version'),
        project=pulumi.get(__response__, 'project'),
        service_name=pulumi.get(__response__, 'service_name'),
        timeouts=pulumi.get(__response__, 'timeouts'),
        type=pulumi.get(__response__, 'type'),
        username=pulumi.get(__response__, 'username')))
