# 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
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
from . import outputs

__all__ = [
    'GetDatabaseResult',
    'AwaitableGetDatabaseResult',
    'get_database',
    'get_database_output',
]

@pulumi.output_type
class GetDatabaseResult:
    """
    A collection of values returned by getDatabase.
    """
    def __init__(__self__, advanced_configuration=None, backup_regions=None, backup_time=None, created_at=None, description=None, disk_size=None, disk_type=None, endpoints=None, engine=None, flavor=None, id=None, ip_restrictions=None, kafka_rest_api=None, kafka_schema_registry=None, maintenance_time=None, network_type=None, nodes=None, opensearch_acls_enabled=None, plan=None, service_name=None, status=None, version=None):
        if advanced_configuration and not isinstance(advanced_configuration, dict):
            raise TypeError("Expected argument 'advanced_configuration' to be a dict")
        pulumi.set(__self__, "advanced_configuration", advanced_configuration)
        if backup_regions and not isinstance(backup_regions, list):
            raise TypeError("Expected argument 'backup_regions' to be a list")
        pulumi.set(__self__, "backup_regions", backup_regions)
        if backup_time and not isinstance(backup_time, str):
            raise TypeError("Expected argument 'backup_time' to be a str")
        pulumi.set(__self__, "backup_time", backup_time)
        if created_at and not isinstance(created_at, str):
            raise TypeError("Expected argument 'created_at' to be a str")
        pulumi.set(__self__, "created_at", created_at)
        if description and not isinstance(description, str):
            raise TypeError("Expected argument 'description' to be a str")
        pulumi.set(__self__, "description", description)
        if disk_size and not isinstance(disk_size, int):
            raise TypeError("Expected argument 'disk_size' to be a int")
        pulumi.set(__self__, "disk_size", disk_size)
        if disk_type and not isinstance(disk_type, str):
            raise TypeError("Expected argument 'disk_type' to be a str")
        pulumi.set(__self__, "disk_type", disk_type)
        if endpoints and not isinstance(endpoints, list):
            raise TypeError("Expected argument 'endpoints' to be a list")
        pulumi.set(__self__, "endpoints", endpoints)
        if engine and not isinstance(engine, str):
            raise TypeError("Expected argument 'engine' to be a str")
        pulumi.set(__self__, "engine", engine)
        if flavor and not isinstance(flavor, str):
            raise TypeError("Expected argument 'flavor' to be a str")
        pulumi.set(__self__, "flavor", flavor)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if ip_restrictions and not isinstance(ip_restrictions, list):
            raise TypeError("Expected argument 'ip_restrictions' to be a list")
        pulumi.set(__self__, "ip_restrictions", ip_restrictions)
        if kafka_rest_api and not isinstance(kafka_rest_api, bool):
            raise TypeError("Expected argument 'kafka_rest_api' to be a bool")
        pulumi.set(__self__, "kafka_rest_api", kafka_rest_api)
        if kafka_schema_registry and not isinstance(kafka_schema_registry, bool):
            raise TypeError("Expected argument 'kafka_schema_registry' to be a bool")
        pulumi.set(__self__, "kafka_schema_registry", kafka_schema_registry)
        if maintenance_time and not isinstance(maintenance_time, str):
            raise TypeError("Expected argument 'maintenance_time' to be a str")
        pulumi.set(__self__, "maintenance_time", maintenance_time)
        if network_type and not isinstance(network_type, str):
            raise TypeError("Expected argument 'network_type' to be a str")
        pulumi.set(__self__, "network_type", network_type)
        if nodes and not isinstance(nodes, list):
            raise TypeError("Expected argument 'nodes' to be a list")
        pulumi.set(__self__, "nodes", nodes)
        if opensearch_acls_enabled and not isinstance(opensearch_acls_enabled, bool):
            raise TypeError("Expected argument 'opensearch_acls_enabled' to be a bool")
        pulumi.set(__self__, "opensearch_acls_enabled", opensearch_acls_enabled)
        if plan and not isinstance(plan, str):
            raise TypeError("Expected argument 'plan' to be a str")
        pulumi.set(__self__, "plan", plan)
        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 status and not isinstance(status, str):
            raise TypeError("Expected argument 'status' to be a str")
        pulumi.set(__self__, "status", status)
        if version and not isinstance(version, str):
            raise TypeError("Expected argument 'version' to be a str")
        pulumi.set(__self__, "version", version)

    @property
    @pulumi.getter(name="advancedConfiguration")
    def advanced_configuration(self) -> Mapping[str, builtins.str]:
        """
        Advanced configuration key / value.
        """
        return pulumi.get(self, "advanced_configuration")

    @property
    @pulumi.getter(name="backupRegions")
    def backup_regions(self) -> Sequence[builtins.str]:
        """
        List of region where backups are pushed.
        """
        return pulumi.get(self, "backup_regions")

    @property
    @pulumi.getter(name="backupTime")
    def backup_time(self) -> builtins.str:
        """
        Time on which backups start every day.
        """
        return pulumi.get(self, "backup_time")

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

    @property
    @pulumi.getter
    def description(self) -> builtins.str:
        """
        Description of the IP restriction
        """
        return pulumi.get(self, "description")

    @property
    @pulumi.getter(name="diskSize")
    def disk_size(self) -> builtins.int:
        """
        The disk size (in GB) of the database service.
        """
        return pulumi.get(self, "disk_size")

    @property
    @pulumi.getter(name="diskType")
    def disk_type(self) -> builtins.str:
        """
        The disk type of the database service.
        """
        return pulumi.get(self, "disk_type")

    @property
    @pulumi.getter
    def endpoints(self) -> Sequence['outputs.GetDatabaseEndpointResult']:
        """
        List of all endpoints objects of the service.
        """
        return pulumi.get(self, "endpoints")

    @property
    @pulumi.getter
    def engine(self) -> builtins.str:
        """
        See Argument Reference above.
        """
        return pulumi.get(self, "engine")

    @property
    @pulumi.getter
    def flavor(self) -> builtins.str:
        """
        A valid OVHcloud public cloud database flavor name in which the nodes will be started.
        """
        return pulumi.get(self, "flavor")

    @property
    @pulumi.getter
    def id(self) -> builtins.str:
        """
        See Argument Reference above.
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter(name="ipRestrictions")
    def ip_restrictions(self) -> Sequence['outputs.GetDatabaseIpRestrictionResult']:
        """
        IP Blocks authorized to access to the cluster.
        """
        return pulumi.get(self, "ip_restrictions")

    @property
    @pulumi.getter(name="kafkaRestApi")
    def kafka_rest_api(self) -> builtins.bool:
        """
        Defines whether the REST API is enabled on a kafka cluster.
        """
        return pulumi.get(self, "kafka_rest_api")

    @property
    @pulumi.getter(name="kafkaSchemaRegistry")
    def kafka_schema_registry(self) -> builtins.bool:
        """
        Defines whether the schema registry is enabled on a Kafka cluster
        """
        return pulumi.get(self, "kafka_schema_registry")

    @property
    @pulumi.getter(name="maintenanceTime")
    def maintenance_time(self) -> builtins.str:
        """
        Time on which maintenances can start every day.
        """
        return pulumi.get(self, "maintenance_time")

    @property
    @pulumi.getter(name="networkType")
    def network_type(self) -> builtins.str:
        """
        Type of network of the cluster.
        """
        return pulumi.get(self, "network_type")

    @property
    @pulumi.getter
    def nodes(self) -> Sequence['outputs.GetDatabaseNodeResult']:
        """
        List of nodes object.
        """
        return pulumi.get(self, "nodes")

    @property
    @pulumi.getter(name="opensearchAclsEnabled")
    def opensearch_acls_enabled(self) -> builtins.bool:
        return pulumi.get(self, "opensearch_acls_enabled")

    @property
    @pulumi.getter
    def plan(self) -> builtins.str:
        """
        Plan of the cluster.
        """
        return pulumi.get(self, "plan")

    @property
    @pulumi.getter(name="serviceName")
    def service_name(self) -> builtins.str:
        """
        See Argument Reference above.
        """
        return pulumi.get(self, "service_name")

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

    @property
    @pulumi.getter
    def version(self) -> builtins.str:
        """
        The version of the engine in which the service should be deployed
        """
        return pulumi.get(self, "version")


class AwaitableGetDatabaseResult(GetDatabaseResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetDatabaseResult(
            advanced_configuration=self.advanced_configuration,
            backup_regions=self.backup_regions,
            backup_time=self.backup_time,
            created_at=self.created_at,
            description=self.description,
            disk_size=self.disk_size,
            disk_type=self.disk_type,
            endpoints=self.endpoints,
            engine=self.engine,
            flavor=self.flavor,
            id=self.id,
            ip_restrictions=self.ip_restrictions,
            kafka_rest_api=self.kafka_rest_api,
            kafka_schema_registry=self.kafka_schema_registry,
            maintenance_time=self.maintenance_time,
            network_type=self.network_type,
            nodes=self.nodes,
            opensearch_acls_enabled=self.opensearch_acls_enabled,
            plan=self.plan,
            service_name=self.service_name,
            status=self.status,
            version=self.version)


def get_database(engine: Optional[builtins.str] = None,
                 id: Optional[builtins.str] = None,
                 service_name: Optional[builtins.str] = None,
                 opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetDatabaseResult:
    """
    Use this data source to get the managed database of a public cloud project.

    ## Example Usage

    To get information of a database cluster service:

    ```python
    import pulumi
    import pulumi_ovh as ovh

    db = ovh.CloudProjectDatabase.get_database(service_name="XXXXXX",
        engine="YYYY",
        id="ZZZZ")
    pulumi.export("clusterId", db.id)
    ```


    :param builtins.str engine: The database engine you want to get information. To get a full list of available engine visit: [public documentation](https://docs.ovh.com/gb/en/publiccloud/databases).
    :param builtins.str id: Cluster ID
    :param builtins.str service_name: The id of the public cloud project. If omitted, the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used.
    """
    __args__ = dict()
    __args__['engine'] = engine
    __args__['id'] = id
    __args__['serviceName'] = service_name
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('ovh:CloudProjectDatabase/getDatabase:getDatabase', __args__, opts=opts, typ=GetDatabaseResult).value

    return AwaitableGetDatabaseResult(
        advanced_configuration=pulumi.get(__ret__, 'advanced_configuration'),
        backup_regions=pulumi.get(__ret__, 'backup_regions'),
        backup_time=pulumi.get(__ret__, 'backup_time'),
        created_at=pulumi.get(__ret__, 'created_at'),
        description=pulumi.get(__ret__, 'description'),
        disk_size=pulumi.get(__ret__, 'disk_size'),
        disk_type=pulumi.get(__ret__, 'disk_type'),
        endpoints=pulumi.get(__ret__, 'endpoints'),
        engine=pulumi.get(__ret__, 'engine'),
        flavor=pulumi.get(__ret__, 'flavor'),
        id=pulumi.get(__ret__, 'id'),
        ip_restrictions=pulumi.get(__ret__, 'ip_restrictions'),
        kafka_rest_api=pulumi.get(__ret__, 'kafka_rest_api'),
        kafka_schema_registry=pulumi.get(__ret__, 'kafka_schema_registry'),
        maintenance_time=pulumi.get(__ret__, 'maintenance_time'),
        network_type=pulumi.get(__ret__, 'network_type'),
        nodes=pulumi.get(__ret__, 'nodes'),
        opensearch_acls_enabled=pulumi.get(__ret__, 'opensearch_acls_enabled'),
        plan=pulumi.get(__ret__, 'plan'),
        service_name=pulumi.get(__ret__, 'service_name'),
        status=pulumi.get(__ret__, 'status'),
        version=pulumi.get(__ret__, 'version'))
def get_database_output(engine: Optional[pulumi.Input[builtins.str]] = None,
                        id: Optional[pulumi.Input[builtins.str]] = None,
                        service_name: Optional[pulumi.Input[builtins.str]] = None,
                        opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetDatabaseResult]:
    """
    Use this data source to get the managed database of a public cloud project.

    ## Example Usage

    To get information of a database cluster service:

    ```python
    import pulumi
    import pulumi_ovh as ovh

    db = ovh.CloudProjectDatabase.get_database(service_name="XXXXXX",
        engine="YYYY",
        id="ZZZZ")
    pulumi.export("clusterId", db.id)
    ```


    :param builtins.str engine: The database engine you want to get information. To get a full list of available engine visit: [public documentation](https://docs.ovh.com/gb/en/publiccloud/databases).
    :param builtins.str id: Cluster ID
    :param builtins.str service_name: The id of the public cloud project. If omitted, the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used.
    """
    __args__ = dict()
    __args__['engine'] = engine
    __args__['id'] = id
    __args__['serviceName'] = service_name
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('ovh:CloudProjectDatabase/getDatabase:getDatabase', __args__, opts=opts, typ=GetDatabaseResult)
    return __ret__.apply(lambda __response__: GetDatabaseResult(
        advanced_configuration=pulumi.get(__response__, 'advanced_configuration'),
        backup_regions=pulumi.get(__response__, 'backup_regions'),
        backup_time=pulumi.get(__response__, 'backup_time'),
        created_at=pulumi.get(__response__, 'created_at'),
        description=pulumi.get(__response__, 'description'),
        disk_size=pulumi.get(__response__, 'disk_size'),
        disk_type=pulumi.get(__response__, 'disk_type'),
        endpoints=pulumi.get(__response__, 'endpoints'),
        engine=pulumi.get(__response__, 'engine'),
        flavor=pulumi.get(__response__, 'flavor'),
        id=pulumi.get(__response__, 'id'),
        ip_restrictions=pulumi.get(__response__, 'ip_restrictions'),
        kafka_rest_api=pulumi.get(__response__, 'kafka_rest_api'),
        kafka_schema_registry=pulumi.get(__response__, 'kafka_schema_registry'),
        maintenance_time=pulumi.get(__response__, 'maintenance_time'),
        network_type=pulumi.get(__response__, 'network_type'),
        nodes=pulumi.get(__response__, 'nodes'),
        opensearch_acls_enabled=pulumi.get(__response__, 'opensearch_acls_enabled'),
        plan=pulumi.get(__response__, 'plan'),
        service_name=pulumi.get(__response__, 'service_name'),
        status=pulumi.get(__response__, 'status'),
        version=pulumi.get(__response__, 'version')))
