# 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 copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
from . import outputs
from ._inputs import *

__all__ = [
    'GetDatabasesResult',
    'AwaitableGetDatabasesResult',
    'get_databases',
    'get_databases_output',
]

@pulumi.output_type
class GetDatabasesResult:
    """
    A collection of values returned by getDatabases.
    """
    def __init__(__self__, databases=None, filters=None, id=None, latest=None, order=None, order_by=None):
        if databases and not isinstance(databases, list):
            raise TypeError("Expected argument 'databases' to be a list")
        pulumi.set(__self__, "databases", databases)
        if filters and not isinstance(filters, list):
            raise TypeError("Expected argument 'filters' to be a list")
        pulumi.set(__self__, "filters", filters)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if latest and not isinstance(latest, bool):
            raise TypeError("Expected argument 'latest' to be a bool")
        pulumi.set(__self__, "latest", latest)
        if order and not isinstance(order, str):
            raise TypeError("Expected argument 'order' to be a str")
        pulumi.set(__self__, "order", order)
        if order_by and not isinstance(order_by, str):
            raise TypeError("Expected argument 'order_by' to be a str")
        pulumi.set(__self__, "order_by", order_by)

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

    @property
    @pulumi.getter
    def filters(self) -> Optional[Sequence['outputs.GetDatabasesFilterResult']]:
        return pulumi.get(self, "filters")

    @property
    @pulumi.getter
    def id(self) -> str:
        """
        The provider-assigned unique ID for this managed resource.
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter
    def latest(self) -> Optional[bool]:
        return pulumi.get(self, "latest")

    @property
    @pulumi.getter
    def order(self) -> Optional[str]:
        return pulumi.get(self, "order")

    @property
    @pulumi.getter(name="orderBy")
    def order_by(self) -> Optional[str]:
        return pulumi.get(self, "order_by")


class AwaitableGetDatabasesResult(GetDatabasesResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetDatabasesResult(
            databases=self.databases,
            filters=self.filters,
            id=self.id,
            latest=self.latest,
            order=self.order,
            order_by=self.order_by)


def get_databases(filters: Optional[Sequence[pulumi.InputType['GetDatabasesFilterArgs']]] = None,
                  latest: Optional[bool] = None,
                  order: Optional[str] = None,
                  order_by: Optional[str] = None,
                  opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetDatabasesResult:
    """
    Provides information about Linode Managed Databases that match a set of filters.

    ## Example Usage

    Get information about all Linode Managed Databases:

    ```python
    import pulumi
    import pulumi_linode as linode

    all = linode.get_databases()
    ```

    Get information about all Linode MySQL Databases:

    ```python
    import pulumi
    import pulumi_linode as linode

    mysql = linode.get_databases(filters=[linode.GetDatabasesFilterArgs(
        name="engine",
        values=["mysql"],
    )])
    ```
    ## Attributes

    Each engine will be stored in the `databases` attribute and will export the following attributes:

    * `allow_list` - A list of IP addresses that can access the Managed Database.

    * `cluster_size` - The number of Linode Instance nodes deployed to the Managed Database.

    * `created` - When this Managed Database was created.

    * `encrypted` - Whether the Managed Databases is encrypted.

    * `engine` - The Managed Database engine.

    * `host_primary` - The primary host for the Managed Database.

    * `host_secondary` - The secondary/private network host for the Managed Database.

    * `id` - The ID of the Managed Database.

    * `label` - A unique, user-defined string referring to the Managed Database.

    * `region` - The region to use for the Managed Database.

    * `replication_type` - The replication method used for the Managed Database.

    * `ssl_connection` - Whether to require SSL credentials to establish a connection to the Managed Database.

    * `status` - The operating status of the Managed Database.

    * `type` - The Linode Instance type used for the nodes of the  Managed Database instance.

    * `updated` - When this Managed Database was last updated.

    * `version` - The Managed Database engine version.


    :param bool latest: If true, only the latest create database will be returned.
    :param str order: The order in which results should be returned. (`asc`, `desc`; default `asc`)
    :param str order_by: The attribute to order the results by. (`version`)
    """
    __args__ = dict()
    __args__['filters'] = filters
    __args__['latest'] = latest
    __args__['order'] = order
    __args__['orderBy'] = order_by
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('linode:index/getDatabases:getDatabases', __args__, opts=opts, typ=GetDatabasesResult).value

    return AwaitableGetDatabasesResult(
        databases=__ret__.databases,
        filters=__ret__.filters,
        id=__ret__.id,
        latest=__ret__.latest,
        order=__ret__.order,
        order_by=__ret__.order_by)


@_utilities.lift_output_func(get_databases)
def get_databases_output(filters: Optional[pulumi.Input[Optional[Sequence[pulumi.InputType['GetDatabasesFilterArgs']]]]] = None,
                         latest: Optional[pulumi.Input[Optional[bool]]] = None,
                         order: Optional[pulumi.Input[Optional[str]]] = None,
                         order_by: Optional[pulumi.Input[Optional[str]]] = None,
                         opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetDatabasesResult]:
    """
    Provides information about Linode Managed Databases that match a set of filters.

    ## Example Usage

    Get information about all Linode Managed Databases:

    ```python
    import pulumi
    import pulumi_linode as linode

    all = linode.get_databases()
    ```

    Get information about all Linode MySQL Databases:

    ```python
    import pulumi
    import pulumi_linode as linode

    mysql = linode.get_databases(filters=[linode.GetDatabasesFilterArgs(
        name="engine",
        values=["mysql"],
    )])
    ```
    ## Attributes

    Each engine will be stored in the `databases` attribute and will export the following attributes:

    * `allow_list` - A list of IP addresses that can access the Managed Database.

    * `cluster_size` - The number of Linode Instance nodes deployed to the Managed Database.

    * `created` - When this Managed Database was created.

    * `encrypted` - Whether the Managed Databases is encrypted.

    * `engine` - The Managed Database engine.

    * `host_primary` - The primary host for the Managed Database.

    * `host_secondary` - The secondary/private network host for the Managed Database.

    * `id` - The ID of the Managed Database.

    * `label` - A unique, user-defined string referring to the Managed Database.

    * `region` - The region to use for the Managed Database.

    * `replication_type` - The replication method used for the Managed Database.

    * `ssl_connection` - Whether to require SSL credentials to establish a connection to the Managed Database.

    * `status` - The operating status of the Managed Database.

    * `type` - The Linode Instance type used for the nodes of the  Managed Database instance.

    * `updated` - When this Managed Database was last updated.

    * `version` - The Managed Database engine version.


    :param bool latest: If true, only the latest create database will be returned.
    :param str order: The order in which results should be returned. (`asc`, `desc`; default `asc`)
    :param str order_by: The attribute to order the results by. (`version`)
    """
    ...
