# 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__ = [
    'GetDatabaseBackupsResult',
    'AwaitableGetDatabaseBackupsResult',
    'get_database_backups',
    'get_database_backups_output',
]

@pulumi.output_type
class GetDatabaseBackupsResult:
    """
    A collection of values returned by getDatabaseBackups.
    """
    def __init__(__self__, backups=None, database_id=None, database_type=None, filters=None, id=None, latest=None, order=None, order_by=None):
        if backups and not isinstance(backups, list):
            raise TypeError("Expected argument 'backups' to be a list")
        pulumi.set(__self__, "backups", backups)
        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 database_type and not isinstance(database_type, str):
            raise TypeError("Expected argument 'database_type' to be a str")
        pulumi.set(__self__, "database_type", database_type)
        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, int):
            raise TypeError("Expected argument 'id' to be a int")
        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)

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

    @_builtins.property
    @pulumi.getter(name="databaseId")
    def database_id(self) -> _builtins.int:
        return pulumi.get(self, "database_id")

    @_builtins.property
    @pulumi.getter(name="databaseType")
    def database_type(self) -> _builtins.str:
        return pulumi.get(self, "database_type")

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

    @_builtins.property
    @pulumi.getter
    def id(self) -> _builtins.int:
        """
        The ID of the database backup object.
        """
        return pulumi.get(self, "id")

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

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

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


class AwaitableGetDatabaseBackupsResult(GetDatabaseBackupsResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetDatabaseBackupsResult(
            backups=self.backups,
            database_id=self.database_id,
            database_type=self.database_type,
            filters=self.filters,
            id=self.id,
            latest=self.latest,
            order=self.order,
            order_by=self.order_by)


def get_database_backups(backups: Optional[Sequence[Union['GetDatabaseBackupsBackupArgs', 'GetDatabaseBackupsBackupArgsDict']]] = None,
                         database_id: Optional[_builtins.int] = None,
                         database_type: Optional[_builtins.str] = None,
                         filters: Optional[Sequence[Union['GetDatabaseBackupsFilterArgs', 'GetDatabaseBackupsFilterArgsDict']]] = None,
                         latest: Optional[_builtins.bool] = None,
                         order: Optional[_builtins.str] = None,
                         order_by: Optional[_builtins.str] = None,
                         opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetDatabaseBackupsResult:
    """
    > **DEPRECATION NOTICE:** This data source has been deprecated.

    Provides information about Linode Database Backups that match a set of filters.
    For more information, see the Linode APIv4 docs for [MySQL](https://techdocs.akamai.com/linode-api/reference/get-databases-mysql-instance-backups) and [PostgreSQL](https://techdocs.akamai.com/linode-api/reference/get-databases-postgre-sql-instance-backups).

    ## Example Usage

    Get information about all backups for a MySQL database:

    ```python
    import pulumi
    import pulumi_linode as linode

    all_backups = linode.get_database_backups(database_id=12345,
        database_type="mysql")
    ```

    Get information about all automatic PostgreSQL Database Backups:

    ```python
    import pulumi
    import pulumi_linode as linode

    auto_backups = linode.get_database_backups(database_id=12345,
        database_type="postgresql",
        filters=[{
            "name": "type",
            "values": ["auto"],
        }])
    ```


    :param _builtins.int database_id: The ID of the database to retrieve backups for.
    :param _builtins.str database_type: The type of the database to retrieve backups for. (`mysql`, `postgresql`)
    :param _builtins.bool latest: If true, only the latest backup will be returned.
           
           * `filter` - (Optional) A set of filters used to select database backups that meet certain requirements.
    :param _builtins.str order: The order in which results should be returned. (`asc`, `desc`; default `asc`)
    :param _builtins.str order_by: The attribute to order the results by. (`created`)
    """
    __args__ = dict()
    __args__['backups'] = backups
    __args__['databaseId'] = database_id
    __args__['databaseType'] = database_type
    __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/getDatabaseBackups:getDatabaseBackups', __args__, opts=opts, typ=GetDatabaseBackupsResult).value

    return AwaitableGetDatabaseBackupsResult(
        backups=pulumi.get(__ret__, 'backups'),
        database_id=pulumi.get(__ret__, 'database_id'),
        database_type=pulumi.get(__ret__, 'database_type'),
        filters=pulumi.get(__ret__, 'filters'),
        id=pulumi.get(__ret__, 'id'),
        latest=pulumi.get(__ret__, 'latest'),
        order=pulumi.get(__ret__, 'order'),
        order_by=pulumi.get(__ret__, 'order_by'))
def get_database_backups_output(backups: Optional[pulumi.Input[Optional[Sequence[Union['GetDatabaseBackupsBackupArgs', 'GetDatabaseBackupsBackupArgsDict']]]]] = None,
                                database_id: Optional[pulumi.Input[_builtins.int]] = None,
                                database_type: Optional[pulumi.Input[_builtins.str]] = None,
                                filters: Optional[pulumi.Input[Optional[Sequence[Union['GetDatabaseBackupsFilterArgs', 'GetDatabaseBackupsFilterArgsDict']]]]] = None,
                                latest: Optional[pulumi.Input[Optional[_builtins.bool]]] = None,
                                order: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                                order_by: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                                opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetDatabaseBackupsResult]:
    """
    > **DEPRECATION NOTICE:** This data source has been deprecated.

    Provides information about Linode Database Backups that match a set of filters.
    For more information, see the Linode APIv4 docs for [MySQL](https://techdocs.akamai.com/linode-api/reference/get-databases-mysql-instance-backups) and [PostgreSQL](https://techdocs.akamai.com/linode-api/reference/get-databases-postgre-sql-instance-backups).

    ## Example Usage

    Get information about all backups for a MySQL database:

    ```python
    import pulumi
    import pulumi_linode as linode

    all_backups = linode.get_database_backups(database_id=12345,
        database_type="mysql")
    ```

    Get information about all automatic PostgreSQL Database Backups:

    ```python
    import pulumi
    import pulumi_linode as linode

    auto_backups = linode.get_database_backups(database_id=12345,
        database_type="postgresql",
        filters=[{
            "name": "type",
            "values": ["auto"],
        }])
    ```


    :param _builtins.int database_id: The ID of the database to retrieve backups for.
    :param _builtins.str database_type: The type of the database to retrieve backups for. (`mysql`, `postgresql`)
    :param _builtins.bool latest: If true, only the latest backup will be returned.
           
           * `filter` - (Optional) A set of filters used to select database backups that meet certain requirements.
    :param _builtins.str order: The order in which results should be returned. (`asc`, `desc`; default `asc`)
    :param _builtins.str order_by: The attribute to order the results by. (`created`)
    """
    __args__ = dict()
    __args__['backups'] = backups
    __args__['databaseId'] = database_id
    __args__['databaseType'] = database_type
    __args__['filters'] = filters
    __args__['latest'] = latest
    __args__['order'] = order
    __args__['orderBy'] = order_by
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('linode:index/getDatabaseBackups:getDatabaseBackups', __args__, opts=opts, typ=GetDatabaseBackupsResult)
    return __ret__.apply(lambda __response__: GetDatabaseBackupsResult(
        backups=pulumi.get(__response__, 'backups'),
        database_id=pulumi.get(__response__, 'database_id'),
        database_type=pulumi.get(__response__, 'database_type'),
        filters=pulumi.get(__response__, 'filters'),
        id=pulumi.get(__response__, 'id'),
        latest=pulumi.get(__response__, 'latest'),
        order=pulumi.get(__response__, 'order'),
        order_by=pulumi.get(__response__, 'order_by')))
