# 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__ = [
    'GetInstanceResult',
    'AwaitableGetInstanceResult',
    'get_instance',
    'get_instance_output',
]

@pulumi.output_type
class GetInstanceResult:
    """
    A collection of values returned by getInstance.
    """
    def __init__(__self__, backup_same_region=None, backup_schedule_frequency=None, backup_schedule_retention=None, certificate=None, disable_backup=None, encryption_at_rest=None, endpoint_ip=None, endpoint_port=None, engine=None, id=None, init_settings=None, instance_id=None, is_ha_cluster=None, load_balancers=None, logs_policies=None, name=None, node_type=None, organization_id=None, password=None, private_ips=None, private_networks=None, project_id=None, read_replicas=None, region=None, settings=None, snapshot_id=None, tags=None, upgradable_versions=None, user_name=None, volume_size_in_gb=None, volume_type=None):
        if backup_same_region and not isinstance(backup_same_region, bool):
            raise TypeError("Expected argument 'backup_same_region' to be a bool")
        pulumi.set(__self__, "backup_same_region", backup_same_region)
        if backup_schedule_frequency and not isinstance(backup_schedule_frequency, int):
            raise TypeError("Expected argument 'backup_schedule_frequency' to be a int")
        pulumi.set(__self__, "backup_schedule_frequency", backup_schedule_frequency)
        if backup_schedule_retention and not isinstance(backup_schedule_retention, int):
            raise TypeError("Expected argument 'backup_schedule_retention' to be a int")
        pulumi.set(__self__, "backup_schedule_retention", backup_schedule_retention)
        if certificate and not isinstance(certificate, str):
            raise TypeError("Expected argument 'certificate' to be a str")
        pulumi.set(__self__, "certificate", certificate)
        if disable_backup and not isinstance(disable_backup, bool):
            raise TypeError("Expected argument 'disable_backup' to be a bool")
        pulumi.set(__self__, "disable_backup", disable_backup)
        if encryption_at_rest and not isinstance(encryption_at_rest, bool):
            raise TypeError("Expected argument 'encryption_at_rest' to be a bool")
        pulumi.set(__self__, "encryption_at_rest", encryption_at_rest)
        if endpoint_ip and not isinstance(endpoint_ip, str):
            raise TypeError("Expected argument 'endpoint_ip' to be a str")
        pulumi.set(__self__, "endpoint_ip", endpoint_ip)
        if endpoint_port and not isinstance(endpoint_port, int):
            raise TypeError("Expected argument 'endpoint_port' to be a int")
        pulumi.set(__self__, "endpoint_port", endpoint_port)
        if engine and not isinstance(engine, str):
            raise TypeError("Expected argument 'engine' to be a str")
        pulumi.set(__self__, "engine", engine)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if init_settings and not isinstance(init_settings, dict):
            raise TypeError("Expected argument 'init_settings' to be a dict")
        pulumi.set(__self__, "init_settings", init_settings)
        if instance_id and not isinstance(instance_id, str):
            raise TypeError("Expected argument 'instance_id' to be a str")
        pulumi.set(__self__, "instance_id", instance_id)
        if is_ha_cluster and not isinstance(is_ha_cluster, bool):
            raise TypeError("Expected argument 'is_ha_cluster' to be a bool")
        pulumi.set(__self__, "is_ha_cluster", is_ha_cluster)
        if load_balancers and not isinstance(load_balancers, list):
            raise TypeError("Expected argument 'load_balancers' to be a list")
        pulumi.set(__self__, "load_balancers", load_balancers)
        if logs_policies and not isinstance(logs_policies, list):
            raise TypeError("Expected argument 'logs_policies' to be a list")
        pulumi.set(__self__, "logs_policies", logs_policies)
        if name and not isinstance(name, str):
            raise TypeError("Expected argument 'name' to be a str")
        pulumi.set(__self__, "name", name)
        if node_type and not isinstance(node_type, str):
            raise TypeError("Expected argument 'node_type' to be a str")
        pulumi.set(__self__, "node_type", node_type)
        if organization_id and not isinstance(organization_id, str):
            raise TypeError("Expected argument 'organization_id' to be a str")
        pulumi.set(__self__, "organization_id", organization_id)
        if password and not isinstance(password, str):
            raise TypeError("Expected argument 'password' to be a str")
        pulumi.set(__self__, "password", password)
        if private_ips and not isinstance(private_ips, list):
            raise TypeError("Expected argument 'private_ips' to be a list")
        pulumi.set(__self__, "private_ips", private_ips)
        if private_networks and not isinstance(private_networks, list):
            raise TypeError("Expected argument 'private_networks' to be a list")
        pulumi.set(__self__, "private_networks", private_networks)
        if project_id and not isinstance(project_id, str):
            raise TypeError("Expected argument 'project_id' to be a str")
        pulumi.set(__self__, "project_id", project_id)
        if read_replicas and not isinstance(read_replicas, list):
            raise TypeError("Expected argument 'read_replicas' to be a list")
        pulumi.set(__self__, "read_replicas", read_replicas)
        if region and not isinstance(region, str):
            raise TypeError("Expected argument 'region' to be a str")
        pulumi.set(__self__, "region", region)
        if settings and not isinstance(settings, dict):
            raise TypeError("Expected argument 'settings' to be a dict")
        pulumi.set(__self__, "settings", settings)
        if snapshot_id and not isinstance(snapshot_id, str):
            raise TypeError("Expected argument 'snapshot_id' to be a str")
        pulumi.set(__self__, "snapshot_id", snapshot_id)
        if tags and not isinstance(tags, list):
            raise TypeError("Expected argument 'tags' to be a list")
        pulumi.set(__self__, "tags", tags)
        if upgradable_versions and not isinstance(upgradable_versions, list):
            raise TypeError("Expected argument 'upgradable_versions' to be a list")
        pulumi.set(__self__, "upgradable_versions", upgradable_versions)
        if user_name and not isinstance(user_name, str):
            raise TypeError("Expected argument 'user_name' to be a str")
        pulumi.set(__self__, "user_name", user_name)
        if volume_size_in_gb and not isinstance(volume_size_in_gb, int):
            raise TypeError("Expected argument 'volume_size_in_gb' to be a int")
        pulumi.set(__self__, "volume_size_in_gb", volume_size_in_gb)
        if volume_type and not isinstance(volume_type, str):
            raise TypeError("Expected argument 'volume_type' to be a str")
        pulumi.set(__self__, "volume_type", volume_type)

    @_builtins.property
    @pulumi.getter(name="backupSameRegion")
    def backup_same_region(self) -> _builtins.bool:
        return pulumi.get(self, "backup_same_region")

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

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

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

    @_builtins.property
    @pulumi.getter(name="disableBackup")
    def disable_backup(self) -> _builtins.bool:
        return pulumi.get(self, "disable_backup")

    @_builtins.property
    @pulumi.getter(name="encryptionAtRest")
    def encryption_at_rest(self) -> _builtins.bool:
        return pulumi.get(self, "encryption_at_rest")

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

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

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

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

    @_builtins.property
    @pulumi.getter(name="initSettings")
    def init_settings(self) -> Mapping[str, _builtins.str]:
        return pulumi.get(self, "init_settings")

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

    @_builtins.property
    @pulumi.getter(name="isHaCluster")
    def is_ha_cluster(self) -> _builtins.bool:
        return pulumi.get(self, "is_ha_cluster")

    @_builtins.property
    @pulumi.getter(name="loadBalancers")
    def load_balancers(self) -> Sequence['outputs.GetInstanceLoadBalancerResult']:
        return pulumi.get(self, "load_balancers")

    @_builtins.property
    @pulumi.getter(name="logsPolicies")
    def logs_policies(self) -> Sequence['outputs.GetInstanceLogsPolicyResult']:
        return pulumi.get(self, "logs_policies")

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

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

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

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

    @_builtins.property
    @pulumi.getter(name="privateIps")
    def private_ips(self) -> Sequence['outputs.GetInstancePrivateIpResult']:
        return pulumi.get(self, "private_ips")

    @_builtins.property
    @pulumi.getter(name="privateNetworks")
    def private_networks(self) -> Sequence['outputs.GetInstancePrivateNetworkResult']:
        return pulumi.get(self, "private_networks")

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

    @_builtins.property
    @pulumi.getter(name="readReplicas")
    def read_replicas(self) -> Sequence['outputs.GetInstanceReadReplicaResult']:
        return pulumi.get(self, "read_replicas")

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

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

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

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

    @_builtins.property
    @pulumi.getter(name="upgradableVersions")
    def upgradable_versions(self) -> Sequence['outputs.GetInstanceUpgradableVersionResult']:
        return pulumi.get(self, "upgradable_versions")

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

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

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


class AwaitableGetInstanceResult(GetInstanceResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetInstanceResult(
            backup_same_region=self.backup_same_region,
            backup_schedule_frequency=self.backup_schedule_frequency,
            backup_schedule_retention=self.backup_schedule_retention,
            certificate=self.certificate,
            disable_backup=self.disable_backup,
            encryption_at_rest=self.encryption_at_rest,
            endpoint_ip=self.endpoint_ip,
            endpoint_port=self.endpoint_port,
            engine=self.engine,
            id=self.id,
            init_settings=self.init_settings,
            instance_id=self.instance_id,
            is_ha_cluster=self.is_ha_cluster,
            load_balancers=self.load_balancers,
            logs_policies=self.logs_policies,
            name=self.name,
            node_type=self.node_type,
            organization_id=self.organization_id,
            password=self.password,
            private_ips=self.private_ips,
            private_networks=self.private_networks,
            project_id=self.project_id,
            read_replicas=self.read_replicas,
            region=self.region,
            settings=self.settings,
            snapshot_id=self.snapshot_id,
            tags=self.tags,
            upgradable_versions=self.upgradable_versions,
            user_name=self.user_name,
            volume_size_in_gb=self.volume_size_in_gb,
            volume_type=self.volume_type)


def get_instance(instance_id: Optional[_builtins.str] = None,
                 name: Optional[_builtins.str] = None,
                 project_id: Optional[_builtins.str] = None,
                 region: Optional[_builtins.str] = None,
                 opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetInstanceResult:
    """
    Gets information about an Database Instance.

    For further information refer the Managed Databases for PostgreSQL and MySQL [API documentation](https://developers.scaleway.com/en/products/rdb/api/#database-instance)


    :param _builtins.str instance_id: The RDB instance ID.
           
           > **Note** You must specify at least one: `name` and/or `instance_id`.
    :param _builtins.str name: The name of the RDB instance.
    :param _builtins.str project_id: The ID of the project the Database Instance is in. Can be used to filter instances when using `name`.
    :param _builtins.str region: `region`) The region in which the Database Instance exists.
    """
    __args__ = dict()
    __args__['instanceId'] = instance_id
    __args__['name'] = name
    __args__['projectId'] = project_id
    __args__['region'] = region
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('scaleway:databases/getInstance:getInstance', __args__, opts=opts, typ=GetInstanceResult).value

    return AwaitableGetInstanceResult(
        backup_same_region=pulumi.get(__ret__, 'backup_same_region'),
        backup_schedule_frequency=pulumi.get(__ret__, 'backup_schedule_frequency'),
        backup_schedule_retention=pulumi.get(__ret__, 'backup_schedule_retention'),
        certificate=pulumi.get(__ret__, 'certificate'),
        disable_backup=pulumi.get(__ret__, 'disable_backup'),
        encryption_at_rest=pulumi.get(__ret__, 'encryption_at_rest'),
        endpoint_ip=pulumi.get(__ret__, 'endpoint_ip'),
        endpoint_port=pulumi.get(__ret__, 'endpoint_port'),
        engine=pulumi.get(__ret__, 'engine'),
        id=pulumi.get(__ret__, 'id'),
        init_settings=pulumi.get(__ret__, 'init_settings'),
        instance_id=pulumi.get(__ret__, 'instance_id'),
        is_ha_cluster=pulumi.get(__ret__, 'is_ha_cluster'),
        load_balancers=pulumi.get(__ret__, 'load_balancers'),
        logs_policies=pulumi.get(__ret__, 'logs_policies'),
        name=pulumi.get(__ret__, 'name'),
        node_type=pulumi.get(__ret__, 'node_type'),
        organization_id=pulumi.get(__ret__, 'organization_id'),
        password=pulumi.get(__ret__, 'password'),
        private_ips=pulumi.get(__ret__, 'private_ips'),
        private_networks=pulumi.get(__ret__, 'private_networks'),
        project_id=pulumi.get(__ret__, 'project_id'),
        read_replicas=pulumi.get(__ret__, 'read_replicas'),
        region=pulumi.get(__ret__, 'region'),
        settings=pulumi.get(__ret__, 'settings'),
        snapshot_id=pulumi.get(__ret__, 'snapshot_id'),
        tags=pulumi.get(__ret__, 'tags'),
        upgradable_versions=pulumi.get(__ret__, 'upgradable_versions'),
        user_name=pulumi.get(__ret__, 'user_name'),
        volume_size_in_gb=pulumi.get(__ret__, 'volume_size_in_gb'),
        volume_type=pulumi.get(__ret__, 'volume_type'))
def get_instance_output(instance_id: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                        name: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                        project_id: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                        region: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                        opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetInstanceResult]:
    """
    Gets information about an Database Instance.

    For further information refer the Managed Databases for PostgreSQL and MySQL [API documentation](https://developers.scaleway.com/en/products/rdb/api/#database-instance)


    :param _builtins.str instance_id: The RDB instance ID.
           
           > **Note** You must specify at least one: `name` and/or `instance_id`.
    :param _builtins.str name: The name of the RDB instance.
    :param _builtins.str project_id: The ID of the project the Database Instance is in. Can be used to filter instances when using `name`.
    :param _builtins.str region: `region`) The region in which the Database Instance exists.
    """
    __args__ = dict()
    __args__['instanceId'] = instance_id
    __args__['name'] = name
    __args__['projectId'] = project_id
    __args__['region'] = region
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('scaleway:databases/getInstance:getInstance', __args__, opts=opts, typ=GetInstanceResult)
    return __ret__.apply(lambda __response__: GetInstanceResult(
        backup_same_region=pulumi.get(__response__, 'backup_same_region'),
        backup_schedule_frequency=pulumi.get(__response__, 'backup_schedule_frequency'),
        backup_schedule_retention=pulumi.get(__response__, 'backup_schedule_retention'),
        certificate=pulumi.get(__response__, 'certificate'),
        disable_backup=pulumi.get(__response__, 'disable_backup'),
        encryption_at_rest=pulumi.get(__response__, 'encryption_at_rest'),
        endpoint_ip=pulumi.get(__response__, 'endpoint_ip'),
        endpoint_port=pulumi.get(__response__, 'endpoint_port'),
        engine=pulumi.get(__response__, 'engine'),
        id=pulumi.get(__response__, 'id'),
        init_settings=pulumi.get(__response__, 'init_settings'),
        instance_id=pulumi.get(__response__, 'instance_id'),
        is_ha_cluster=pulumi.get(__response__, 'is_ha_cluster'),
        load_balancers=pulumi.get(__response__, 'load_balancers'),
        logs_policies=pulumi.get(__response__, 'logs_policies'),
        name=pulumi.get(__response__, 'name'),
        node_type=pulumi.get(__response__, 'node_type'),
        organization_id=pulumi.get(__response__, 'organization_id'),
        password=pulumi.get(__response__, 'password'),
        private_ips=pulumi.get(__response__, 'private_ips'),
        private_networks=pulumi.get(__response__, 'private_networks'),
        project_id=pulumi.get(__response__, 'project_id'),
        read_replicas=pulumi.get(__response__, 'read_replicas'),
        region=pulumi.get(__response__, 'region'),
        settings=pulumi.get(__response__, 'settings'),
        snapshot_id=pulumi.get(__response__, 'snapshot_id'),
        tags=pulumi.get(__response__, 'tags'),
        upgradable_versions=pulumi.get(__response__, 'upgradable_versions'),
        user_name=pulumi.get(__response__, 'user_name'),
        volume_size_in_gb=pulumi.get(__response__, 'volume_size_in_gb'),
        volume_type=pulumi.get(__response__, 'volume_type')))
