# 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

__all__ = [
    'GetDatabaseMysqlResult',
    'AwaitableGetDatabaseMysqlResult',
    'get_database_mysql',
    'get_database_mysql_output',
]

@pulumi.output_type
class GetDatabaseMysqlResult:
    """
    A collection of values returned by getDatabaseMysql.
    """
    def __init__(__self__, allow_lists=None, ca_cert=None, cluster_size=None, created=None, database_id=None, encrypted=None, engine=None, engine_id=None, host_primary=None, host_secondary=None, id=None, label=None, region=None, replication_type=None, root_password=None, root_username=None, ssl_connection=None, status=None, type=None, updated=None, updates=None, version=None):
        if allow_lists and not isinstance(allow_lists, list):
            raise TypeError("Expected argument 'allow_lists' to be a list")
        pulumi.set(__self__, "allow_lists", allow_lists)
        if ca_cert and not isinstance(ca_cert, str):
            raise TypeError("Expected argument 'ca_cert' to be a str")
        pulumi.set(__self__, "ca_cert", ca_cert)
        if cluster_size and not isinstance(cluster_size, int):
            raise TypeError("Expected argument 'cluster_size' to be a int")
        pulumi.set(__self__, "cluster_size", cluster_size)
        if created and not isinstance(created, str):
            raise TypeError("Expected argument 'created' to be a str")
        pulumi.set(__self__, "created", created)
        if database_id and not isinstance(database_id, int):
            raise TypeError("Expected argument 'database_id' to be a int")
        pulumi.set(__self__, "database_id", database_id)
        if encrypted and not isinstance(encrypted, bool):
            raise TypeError("Expected argument 'encrypted' to be a bool")
        pulumi.set(__self__, "encrypted", encrypted)
        if engine and not isinstance(engine, str):
            raise TypeError("Expected argument 'engine' to be a str")
        pulumi.set(__self__, "engine", engine)
        if engine_id and not isinstance(engine_id, str):
            raise TypeError("Expected argument 'engine_id' to be a str")
        pulumi.set(__self__, "engine_id", engine_id)
        if host_primary and not isinstance(host_primary, str):
            raise TypeError("Expected argument 'host_primary' to be a str")
        pulumi.set(__self__, "host_primary", host_primary)
        if host_secondary and not isinstance(host_secondary, str):
            raise TypeError("Expected argument 'host_secondary' to be a str")
        pulumi.set(__self__, "host_secondary", host_secondary)
        if id and not isinstance(id, int):
            raise TypeError("Expected argument 'id' to be a int")
        pulumi.set(__self__, "id", id)
        if label and not isinstance(label, str):
            raise TypeError("Expected argument 'label' to be a str")
        pulumi.set(__self__, "label", label)
        if region and not isinstance(region, str):
            raise TypeError("Expected argument 'region' to be a str")
        pulumi.set(__self__, "region", region)
        if replication_type and not isinstance(replication_type, str):
            raise TypeError("Expected argument 'replication_type' to be a str")
        pulumi.set(__self__, "replication_type", replication_type)
        if root_password and not isinstance(root_password, str):
            raise TypeError("Expected argument 'root_password' to be a str")
        pulumi.set(__self__, "root_password", root_password)
        if root_username and not isinstance(root_username, str):
            raise TypeError("Expected argument 'root_username' to be a str")
        pulumi.set(__self__, "root_username", root_username)
        if ssl_connection and not isinstance(ssl_connection, bool):
            raise TypeError("Expected argument 'ssl_connection' to be a bool")
        pulumi.set(__self__, "ssl_connection", ssl_connection)
        if status and not isinstance(status, str):
            raise TypeError("Expected argument 'status' to be a str")
        pulumi.set(__self__, "status", status)
        if type and not isinstance(type, str):
            raise TypeError("Expected argument 'type' to be a str")
        pulumi.set(__self__, "type", type)
        if updated and not isinstance(updated, str):
            raise TypeError("Expected argument 'updated' to be a str")
        pulumi.set(__self__, "updated", updated)
        if updates and not isinstance(updates, list):
            raise TypeError("Expected argument 'updates' to be a list")
        pulumi.set(__self__, "updates", updates)
        if version and not isinstance(version, str):
            raise TypeError("Expected argument 'version' to be a str")
        pulumi.set(__self__, "version", version)

    @_builtins.property
    @pulumi.getter(name="allowLists")
    def allow_lists(self) -> Sequence[_builtins.str]:
        """
        A list of IP addresses that can access the Managed Database. Each item can be a single IP address or a range in CIDR format.
        """
        return pulumi.get(self, "allow_lists")

    @_builtins.property
    @pulumi.getter(name="caCert")
    def ca_cert(self) -> _builtins.str:
        """
        The base64-encoded SSL CA certificate for the Managed Database instance.
        """
        return pulumi.get(self, "ca_cert")

    @_builtins.property
    @pulumi.getter(name="clusterSize")
    def cluster_size(self) -> _builtins.int:
        """
        The number of Linode Instance nodes deployed to the Managed Database.
        """
        return pulumi.get(self, "cluster_size")

    @_builtins.property
    @pulumi.getter
    def created(self) -> _builtins.str:
        """
        When this Managed Database was created.
        """
        return pulumi.get(self, "created")

    @_builtins.property
    @pulumi.getter(name="databaseId")
    @_utilities.deprecated("""Configure `id` instead. This attribute will be removed in the next major version of the provider.""")
    def database_id(self) -> Optional[_builtins.int]:
        return pulumi.get(self, "database_id")

    @_builtins.property
    @pulumi.getter
    def encrypted(self) -> _builtins.bool:
        """
        Whether the Managed Databases is encrypted.
        """
        return pulumi.get(self, "encrypted")

    @_builtins.property
    @pulumi.getter
    def engine(self) -> _builtins.str:
        """
        The Managed Database engine. (e.g. `mysql`)
        """
        return pulumi.get(self, "engine")

    @_builtins.property
    @pulumi.getter(name="engineId")
    def engine_id(self) -> _builtins.str:
        """
        The Managed Database engine in engine/version format. (e.g. `mysql/8.0.30`)
        """
        return pulumi.get(self, "engine_id")

    @_builtins.property
    @pulumi.getter(name="hostPrimary")
    def host_primary(self) -> _builtins.str:
        """
        The primary host for the Managed Database.
        """
        return pulumi.get(self, "host_primary")

    @_builtins.property
    @pulumi.getter(name="hostSecondary")
    def host_secondary(self) -> _builtins.str:
        """
        The secondary/private network host for the Managed Database.
        """
        return pulumi.get(self, "host_secondary")

    @_builtins.property
    @pulumi.getter
    def id(self) -> Optional[_builtins.int]:
        return pulumi.get(self, "id")

    @_builtins.property
    @pulumi.getter
    def label(self) -> _builtins.str:
        """
        A unique, user-defined string referring to the Managed Database.
        """
        return pulumi.get(self, "label")

    @_builtins.property
    @pulumi.getter
    def region(self) -> _builtins.str:
        """
        The region that hosts this Linode Managed Database.
        """
        return pulumi.get(self, "region")

    @_builtins.property
    @pulumi.getter(name="replicationType")
    def replication_type(self) -> _builtins.str:
        """
        The replication method used for the Managed Database. (`none`, `asynch`, `semi_synch`)
        """
        return pulumi.get(self, "replication_type")

    @_builtins.property
    @pulumi.getter(name="rootPassword")
    def root_password(self) -> _builtins.str:
        """
        The randomly-generated root password for the Managed Database instance.
        """
        return pulumi.get(self, "root_password")

    @_builtins.property
    @pulumi.getter(name="rootUsername")
    def root_username(self) -> _builtins.str:
        """
        The root username for the Managed Database instance.
        """
        return pulumi.get(self, "root_username")

    @_builtins.property
    @pulumi.getter(name="sslConnection")
    def ssl_connection(self) -> _builtins.bool:
        """
        Whether to require SSL credentials to establish a connection to the Managed Database.
        """
        return pulumi.get(self, "ssl_connection")

    @_builtins.property
    @pulumi.getter
    def status(self) -> _builtins.str:
        """
        The operating status of the Managed Database.
        """
        return pulumi.get(self, "status")

    @_builtins.property
    @pulumi.getter
    def type(self) -> _builtins.str:
        """
        The Linode Instance type used for the nodes of the  Managed Database instance.
        """
        return pulumi.get(self, "type")

    @_builtins.property
    @pulumi.getter
    def updated(self) -> _builtins.str:
        """
        When this Managed Database was last updated.
        """
        return pulumi.get(self, "updated")

    @_builtins.property
    @pulumi.getter
    def updates(self) -> Sequence['outputs.GetDatabaseMysqlUpdateResult']:
        return pulumi.get(self, "updates")

    @_builtins.property
    @pulumi.getter
    def version(self) -> _builtins.str:
        """
        The Managed Database engine version. (e.g. `v8.0.26`)
        """
        return pulumi.get(self, "version")


class AwaitableGetDatabaseMysqlResult(GetDatabaseMysqlResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetDatabaseMysqlResult(
            allow_lists=self.allow_lists,
            ca_cert=self.ca_cert,
            cluster_size=self.cluster_size,
            created=self.created,
            database_id=self.database_id,
            encrypted=self.encrypted,
            engine=self.engine,
            engine_id=self.engine_id,
            host_primary=self.host_primary,
            host_secondary=self.host_secondary,
            id=self.id,
            label=self.label,
            region=self.region,
            replication_type=self.replication_type,
            root_password=self.root_password,
            root_username=self.root_username,
            ssl_connection=self.ssl_connection,
            status=self.status,
            type=self.type,
            updated=self.updated,
            updates=self.updates,
            version=self.version)


def get_database_mysql(database_id: Optional[_builtins.int] = None,
                       id: Optional[_builtins.int] = None,
                       opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetDatabaseMysqlResult:
    """
    > **DEPRECATION NOTICE:** This data source has been deprecated. Please use DatabaseMysqlV2 for all future implementations.

    Provides information about a Linode MySQL Database.
    For more information, see the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/get-databases-instances).

    ## Example Usage

    Get information about a MySQL database:

    ```python
    import pulumi
    import pulumi_linode as linode

    my_db = linode.get_database_mysql(id=12345)
    ```

    ## updates

    The following arguments are exported by the `updates` specification block:

    * `day_of_week` - The day to perform maintenance. (`monday`, `tuesday`, ...)

    * `duration` - The maximum maintenance window time in hours. (`1`..`3`)

    * `frequency` - Whether maintenance occurs on a weekly or monthly basis. (`weekly`, `monthly`)

    * `hour_of_day` - The hour to begin maintenance based in UTC time. (`0`..`23`)

    * `week_of_month` - The week of the month to perform monthly frequency updates. Required for `monthly` frequency updates. (`1`..`4`)


    :param _builtins.int database_id: The ID of the MySQL database. Deprecated: Use id instead.
    :param _builtins.int id: The ID of the MySQL database. Mutually exclusive with `database_id`.
    """
    __args__ = dict()
    __args__['databaseId'] = database_id
    __args__['id'] = id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('linode:index/getDatabaseMysql:getDatabaseMysql', __args__, opts=opts, typ=GetDatabaseMysqlResult).value

    return AwaitableGetDatabaseMysqlResult(
        allow_lists=pulumi.get(__ret__, 'allow_lists'),
        ca_cert=pulumi.get(__ret__, 'ca_cert'),
        cluster_size=pulumi.get(__ret__, 'cluster_size'),
        created=pulumi.get(__ret__, 'created'),
        database_id=pulumi.get(__ret__, 'database_id'),
        encrypted=pulumi.get(__ret__, 'encrypted'),
        engine=pulumi.get(__ret__, 'engine'),
        engine_id=pulumi.get(__ret__, 'engine_id'),
        host_primary=pulumi.get(__ret__, 'host_primary'),
        host_secondary=pulumi.get(__ret__, 'host_secondary'),
        id=pulumi.get(__ret__, 'id'),
        label=pulumi.get(__ret__, 'label'),
        region=pulumi.get(__ret__, 'region'),
        replication_type=pulumi.get(__ret__, 'replication_type'),
        root_password=pulumi.get(__ret__, 'root_password'),
        root_username=pulumi.get(__ret__, 'root_username'),
        ssl_connection=pulumi.get(__ret__, 'ssl_connection'),
        status=pulumi.get(__ret__, 'status'),
        type=pulumi.get(__ret__, 'type'),
        updated=pulumi.get(__ret__, 'updated'),
        updates=pulumi.get(__ret__, 'updates'),
        version=pulumi.get(__ret__, 'version'))
def get_database_mysql_output(database_id: Optional[pulumi.Input[Optional[_builtins.int]]] = None,
                              id: Optional[pulumi.Input[Optional[_builtins.int]]] = None,
                              opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetDatabaseMysqlResult]:
    """
    > **DEPRECATION NOTICE:** This data source has been deprecated. Please use DatabaseMysqlV2 for all future implementations.

    Provides information about a Linode MySQL Database.
    For more information, see the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/get-databases-instances).

    ## Example Usage

    Get information about a MySQL database:

    ```python
    import pulumi
    import pulumi_linode as linode

    my_db = linode.get_database_mysql(id=12345)
    ```

    ## updates

    The following arguments are exported by the `updates` specification block:

    * `day_of_week` - The day to perform maintenance. (`monday`, `tuesday`, ...)

    * `duration` - The maximum maintenance window time in hours. (`1`..`3`)

    * `frequency` - Whether maintenance occurs on a weekly or monthly basis. (`weekly`, `monthly`)

    * `hour_of_day` - The hour to begin maintenance based in UTC time. (`0`..`23`)

    * `week_of_month` - The week of the month to perform monthly frequency updates. Required for `monthly` frequency updates. (`1`..`4`)


    :param _builtins.int database_id: The ID of the MySQL database. Deprecated: Use id instead.
    :param _builtins.int id: The ID of the MySQL database. Mutually exclusive with `database_id`.
    """
    __args__ = dict()
    __args__['databaseId'] = database_id
    __args__['id'] = id
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('linode:index/getDatabaseMysql:getDatabaseMysql', __args__, opts=opts, typ=GetDatabaseMysqlResult)
    return __ret__.apply(lambda __response__: GetDatabaseMysqlResult(
        allow_lists=pulumi.get(__response__, 'allow_lists'),
        ca_cert=pulumi.get(__response__, 'ca_cert'),
        cluster_size=pulumi.get(__response__, 'cluster_size'),
        created=pulumi.get(__response__, 'created'),
        database_id=pulumi.get(__response__, 'database_id'),
        encrypted=pulumi.get(__response__, 'encrypted'),
        engine=pulumi.get(__response__, 'engine'),
        engine_id=pulumi.get(__response__, 'engine_id'),
        host_primary=pulumi.get(__response__, 'host_primary'),
        host_secondary=pulumi.get(__response__, 'host_secondary'),
        id=pulumi.get(__response__, 'id'),
        label=pulumi.get(__response__, 'label'),
        region=pulumi.get(__response__, 'region'),
        replication_type=pulumi.get(__response__, 'replication_type'),
        root_password=pulumi.get(__response__, 'root_password'),
        root_username=pulumi.get(__response__, 'root_username'),
        ssl_connection=pulumi.get(__response__, 'ssl_connection'),
        status=pulumi.get(__response__, 'status'),
        type=pulumi.get(__response__, 'type'),
        updated=pulumi.get(__response__, 'updated'),
        updates=pulumi.get(__response__, 'updates'),
        version=pulumi.get(__response__, 'version')))
