# 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__ = [
    'GetDatabaseInstanceResult',
    'AwaitableGetDatabaseInstanceResult',
    'get_database_instance',
    'get_database_instance_output',
]

@pulumi.output_type
class GetDatabaseInstanceResult:
    """
    A collection of values returned by getDatabaseInstance.
    """
    def __init__(__self__, capacity=None, child_instance_refs=None, creation_time=None, creator=None, custom_tags=None, effective_capacity=None, effective_custom_tags=None, effective_enable_pg_native_login=None, effective_enable_readable_secondaries=None, effective_node_count=None, effective_retention_window_in_days=None, effective_stopped=None, effective_usage_policy_id=None, enable_pg_native_login=None, enable_readable_secondaries=None, id=None, name=None, node_count=None, parent_instance_ref=None, pg_version=None, read_only_dns=None, read_write_dns=None, retention_window_in_days=None, state=None, stopped=None, uid=None, usage_policy_id=None):
        if capacity and not isinstance(capacity, str):
            raise TypeError("Expected argument 'capacity' to be a str")
        pulumi.set(__self__, "capacity", capacity)
        if child_instance_refs and not isinstance(child_instance_refs, list):
            raise TypeError("Expected argument 'child_instance_refs' to be a list")
        pulumi.set(__self__, "child_instance_refs", child_instance_refs)
        if creation_time and not isinstance(creation_time, str):
            raise TypeError("Expected argument 'creation_time' to be a str")
        pulumi.set(__self__, "creation_time", creation_time)
        if creator and not isinstance(creator, str):
            raise TypeError("Expected argument 'creator' to be a str")
        pulumi.set(__self__, "creator", creator)
        if custom_tags and not isinstance(custom_tags, list):
            raise TypeError("Expected argument 'custom_tags' to be a list")
        pulumi.set(__self__, "custom_tags", custom_tags)
        if effective_capacity and not isinstance(effective_capacity, str):
            raise TypeError("Expected argument 'effective_capacity' to be a str")
        pulumi.set(__self__, "effective_capacity", effective_capacity)
        if effective_custom_tags and not isinstance(effective_custom_tags, list):
            raise TypeError("Expected argument 'effective_custom_tags' to be a list")
        pulumi.set(__self__, "effective_custom_tags", effective_custom_tags)
        if effective_enable_pg_native_login and not isinstance(effective_enable_pg_native_login, bool):
            raise TypeError("Expected argument 'effective_enable_pg_native_login' to be a bool")
        pulumi.set(__self__, "effective_enable_pg_native_login", effective_enable_pg_native_login)
        if effective_enable_readable_secondaries and not isinstance(effective_enable_readable_secondaries, bool):
            raise TypeError("Expected argument 'effective_enable_readable_secondaries' to be a bool")
        pulumi.set(__self__, "effective_enable_readable_secondaries", effective_enable_readable_secondaries)
        if effective_node_count and not isinstance(effective_node_count, int):
            raise TypeError("Expected argument 'effective_node_count' to be a int")
        pulumi.set(__self__, "effective_node_count", effective_node_count)
        if effective_retention_window_in_days and not isinstance(effective_retention_window_in_days, int):
            raise TypeError("Expected argument 'effective_retention_window_in_days' to be a int")
        pulumi.set(__self__, "effective_retention_window_in_days", effective_retention_window_in_days)
        if effective_stopped and not isinstance(effective_stopped, bool):
            raise TypeError("Expected argument 'effective_stopped' to be a bool")
        pulumi.set(__self__, "effective_stopped", effective_stopped)
        if effective_usage_policy_id and not isinstance(effective_usage_policy_id, str):
            raise TypeError("Expected argument 'effective_usage_policy_id' to be a str")
        pulumi.set(__self__, "effective_usage_policy_id", effective_usage_policy_id)
        if enable_pg_native_login and not isinstance(enable_pg_native_login, bool):
            raise TypeError("Expected argument 'enable_pg_native_login' to be a bool")
        pulumi.set(__self__, "enable_pg_native_login", enable_pg_native_login)
        if enable_readable_secondaries and not isinstance(enable_readable_secondaries, bool):
            raise TypeError("Expected argument 'enable_readable_secondaries' to be a bool")
        pulumi.set(__self__, "enable_readable_secondaries", enable_readable_secondaries)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if name and not isinstance(name, str):
            raise TypeError("Expected argument 'name' to be a str")
        pulumi.set(__self__, "name", name)
        if node_count and not isinstance(node_count, int):
            raise TypeError("Expected argument 'node_count' to be a int")
        pulumi.set(__self__, "node_count", node_count)
        if parent_instance_ref and not isinstance(parent_instance_ref, dict):
            raise TypeError("Expected argument 'parent_instance_ref' to be a dict")
        pulumi.set(__self__, "parent_instance_ref", parent_instance_ref)
        if pg_version and not isinstance(pg_version, str):
            raise TypeError("Expected argument 'pg_version' to be a str")
        pulumi.set(__self__, "pg_version", pg_version)
        if read_only_dns and not isinstance(read_only_dns, str):
            raise TypeError("Expected argument 'read_only_dns' to be a str")
        pulumi.set(__self__, "read_only_dns", read_only_dns)
        if read_write_dns and not isinstance(read_write_dns, str):
            raise TypeError("Expected argument 'read_write_dns' to be a str")
        pulumi.set(__self__, "read_write_dns", read_write_dns)
        if retention_window_in_days and not isinstance(retention_window_in_days, int):
            raise TypeError("Expected argument 'retention_window_in_days' to be a int")
        pulumi.set(__self__, "retention_window_in_days", retention_window_in_days)
        if state and not isinstance(state, str):
            raise TypeError("Expected argument 'state' to be a str")
        pulumi.set(__self__, "state", state)
        if stopped and not isinstance(stopped, bool):
            raise TypeError("Expected argument 'stopped' to be a bool")
        pulumi.set(__self__, "stopped", stopped)
        if uid and not isinstance(uid, str):
            raise TypeError("Expected argument 'uid' to be a str")
        pulumi.set(__self__, "uid", uid)
        if usage_policy_id and not isinstance(usage_policy_id, str):
            raise TypeError("Expected argument 'usage_policy_id' to be a str")
        pulumi.set(__self__, "usage_policy_id", usage_policy_id)

    @_builtins.property
    @pulumi.getter
    def capacity(self) -> _builtins.str:
        """
        (string) - The sku of the instance. Valid values are "CU_1", "CU_2", "CU_4", "CU_8"
        """
        return pulumi.get(self, "capacity")

    @_builtins.property
    @pulumi.getter(name="childInstanceRefs")
    def child_instance_refs(self) -> Sequence['outputs.GetDatabaseInstanceChildInstanceRefResult']:
        """
        (list of DatabaseInstanceRef) - The refs of the child instances. This is only available if the instance is
        parent instance
        """
        return pulumi.get(self, "child_instance_refs")

    @_builtins.property
    @pulumi.getter(name="creationTime")
    def creation_time(self) -> _builtins.str:
        """
        (string) - The timestamp when the instance was created
        """
        return pulumi.get(self, "creation_time")

    @_builtins.property
    @pulumi.getter
    def creator(self) -> _builtins.str:
        """
        (string) - The email of the creator of the instance
        """
        return pulumi.get(self, "creator")

    @_builtins.property
    @pulumi.getter(name="customTags")
    def custom_tags(self) -> Sequence['outputs.GetDatabaseInstanceCustomTagResult']:
        """
        (list of CustomTag) - Custom tags associated with the instance. This field is only included on create and update responses
        """
        return pulumi.get(self, "custom_tags")

    @_builtins.property
    @pulumi.getter(name="effectiveCapacity")
    def effective_capacity(self) -> _builtins.str:
        """
        (string, deprecated) - Deprecated. The sku of the instance; this field will always match the value of capacity.
        This is an output only field that contains the value computed from the input field combined with
        server side defaults. Use the field without the effective_ prefix to set the value
        """
        return pulumi.get(self, "effective_capacity")

    @_builtins.property
    @pulumi.getter(name="effectiveCustomTags")
    def effective_custom_tags(self) -> Sequence['outputs.GetDatabaseInstanceEffectiveCustomTagResult']:
        """
        (list of CustomTag) - The recorded custom tags associated with the instance.
        This is an output only field that contains the value computed from the input field combined with
        server side defaults. Use the field without the effective_ prefix to set the value
        """
        return pulumi.get(self, "effective_custom_tags")

    @_builtins.property
    @pulumi.getter(name="effectiveEnablePgNativeLogin")
    def effective_enable_pg_native_login(self) -> _builtins.bool:
        """
        (boolean) - Whether the instance has PG native password login enabled.
        This is an output only field that contains the value computed from the input field combined with
        server side defaults. Use the field without the effective_ prefix to set the value
        """
        return pulumi.get(self, "effective_enable_pg_native_login")

    @_builtins.property
    @pulumi.getter(name="effectiveEnableReadableSecondaries")
    def effective_enable_readable_secondaries(self) -> _builtins.bool:
        """
        (boolean) - Whether secondaries serving read-only traffic are enabled. Defaults to false.
        This is an output only field that contains the value computed from the input field combined with
        server side defaults. Use the field without the effective_ prefix to set the value
        """
        return pulumi.get(self, "effective_enable_readable_secondaries")

    @_builtins.property
    @pulumi.getter(name="effectiveNodeCount")
    def effective_node_count(self) -> _builtins.int:
        """
        (integer) - The number of nodes in the instance, composed of 1 primary and 0 or more secondaries. Defaults to
        1 primary and 0 secondaries.
        This is an output only field that contains the value computed from the input field combined with
        server side defaults. Use the field without the effective_ prefix to set the value
        """
        return pulumi.get(self, "effective_node_count")

    @_builtins.property
    @pulumi.getter(name="effectiveRetentionWindowInDays")
    def effective_retention_window_in_days(self) -> _builtins.int:
        """
        (integer) - The retention window for the instance. This is the time window in days
        for which the historical data is retained.
        This is an output only field that contains the value computed from the input field combined with
        server side defaults. Use the field without the effective_ prefix to set the value
        """
        return pulumi.get(self, "effective_retention_window_in_days")

    @_builtins.property
    @pulumi.getter(name="effectiveStopped")
    def effective_stopped(self) -> _builtins.bool:
        """
        (boolean) - Whether the instance is stopped.
        This is an output only field that contains the value computed from the input field combined with
        server side defaults. Use the field without the effective_ prefix to set the value
        """
        return pulumi.get(self, "effective_stopped")

    @_builtins.property
    @pulumi.getter(name="effectiveUsagePolicyId")
    def effective_usage_policy_id(self) -> _builtins.str:
        """
        (string) - The policy that is applied to the instance.
        This is an output only field that contains the value computed from the input field combined with
        server side defaults. Use the field without the effective_ prefix to set the value
        """
        return pulumi.get(self, "effective_usage_policy_id")

    @_builtins.property
    @pulumi.getter(name="enablePgNativeLogin")
    def enable_pg_native_login(self) -> _builtins.bool:
        """
        (boolean) - Whether to enable PG native password login on the instance. Defaults to false
        """
        return pulumi.get(self, "enable_pg_native_login")

    @_builtins.property
    @pulumi.getter(name="enableReadableSecondaries")
    def enable_readable_secondaries(self) -> _builtins.bool:
        """
        (boolean) - Whether to enable secondaries to serve read-only traffic. Defaults to false
        """
        return pulumi.get(self, "enable_readable_secondaries")

    @_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
    def name(self) -> _builtins.str:
        """
        (string) - Name of the ref database instance
        """
        return pulumi.get(self, "name")

    @_builtins.property
    @pulumi.getter(name="nodeCount")
    def node_count(self) -> _builtins.int:
        """
        (integer) - The number of nodes in the instance, composed of 1 primary and 0 or more secondaries. Defaults to
        1 primary and 0 secondaries. This field is input only, see effective_node_count for the output
        """
        return pulumi.get(self, "node_count")

    @_builtins.property
    @pulumi.getter(name="parentInstanceRef")
    def parent_instance_ref(self) -> 'outputs.GetDatabaseInstanceParentInstanceRefResult':
        """
        (DatabaseInstanceRef) - The ref of the parent instance. This is only available if the instance is
        child instance.
        Input: For specifying the parent instance to create a child instance. Optional.
        Output: Only populated if provided as input to create a child instance
        """
        return pulumi.get(self, "parent_instance_ref")

    @_builtins.property
    @pulumi.getter(name="pgVersion")
    def pg_version(self) -> _builtins.str:
        """
        (string) - The version of Postgres running on the instance
        """
        return pulumi.get(self, "pg_version")

    @_builtins.property
    @pulumi.getter(name="readOnlyDns")
    def read_only_dns(self) -> _builtins.str:
        """
        (string) - The DNS endpoint to connect to the instance for read only access. This is only available if
        enable_readable_secondaries is true
        """
        return pulumi.get(self, "read_only_dns")

    @_builtins.property
    @pulumi.getter(name="readWriteDns")
    def read_write_dns(self) -> _builtins.str:
        """
        (string) - The DNS endpoint to connect to the instance for read+write access
        """
        return pulumi.get(self, "read_write_dns")

    @_builtins.property
    @pulumi.getter(name="retentionWindowInDays")
    def retention_window_in_days(self) -> _builtins.int:
        """
        (integer) - The retention window for the instance. This is the time window in days
        for which the historical data is retained. The default value is 7 days.
        Valid values are 2 to 35 days
        """
        return pulumi.get(self, "retention_window_in_days")

    @_builtins.property
    @pulumi.getter
    def state(self) -> _builtins.str:
        """
        (string) - The current state of the instance. Possible values are: `AVAILABLE`, `DELETING`, `FAILING_OVER`, `STARTING`, `STOPPED`, `UPDATING`
        """
        return pulumi.get(self, "state")

    @_builtins.property
    @pulumi.getter
    def stopped(self) -> _builtins.bool:
        """
        (boolean) - Whether to stop the instance. An input only param, see effective_stopped for the output
        """
        return pulumi.get(self, "stopped")

    @_builtins.property
    @pulumi.getter
    def uid(self) -> _builtins.str:
        """
        (string) - Id of the ref database instance
        """
        return pulumi.get(self, "uid")

    @_builtins.property
    @pulumi.getter(name="usagePolicyId")
    def usage_policy_id(self) -> _builtins.str:
        """
        (string) - The desired usage policy to associate with the instance
        """
        return pulumi.get(self, "usage_policy_id")


class AwaitableGetDatabaseInstanceResult(GetDatabaseInstanceResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetDatabaseInstanceResult(
            capacity=self.capacity,
            child_instance_refs=self.child_instance_refs,
            creation_time=self.creation_time,
            creator=self.creator,
            custom_tags=self.custom_tags,
            effective_capacity=self.effective_capacity,
            effective_custom_tags=self.effective_custom_tags,
            effective_enable_pg_native_login=self.effective_enable_pg_native_login,
            effective_enable_readable_secondaries=self.effective_enable_readable_secondaries,
            effective_node_count=self.effective_node_count,
            effective_retention_window_in_days=self.effective_retention_window_in_days,
            effective_stopped=self.effective_stopped,
            effective_usage_policy_id=self.effective_usage_policy_id,
            enable_pg_native_login=self.enable_pg_native_login,
            enable_readable_secondaries=self.enable_readable_secondaries,
            id=self.id,
            name=self.name,
            node_count=self.node_count,
            parent_instance_ref=self.parent_instance_ref,
            pg_version=self.pg_version,
            read_only_dns=self.read_only_dns,
            read_write_dns=self.read_write_dns,
            retention_window_in_days=self.retention_window_in_days,
            state=self.state,
            stopped=self.stopped,
            uid=self.uid,
            usage_policy_id=self.usage_policy_id)


def get_database_instance(name: Optional[_builtins.str] = None,
                          opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetDatabaseInstanceResult:
    """
    [![Public Preview](https://img.shields.io/badge/Release_Stage-Public_Preview-yellowgreen)](https://docs.databricks.com/aws/en/release-notes/release-types)

    This data source can be used to get a single Database Instance.

    ## Example Usage

    Referring to a Database Instance by name:

    ```python
    import pulumi
    import pulumi_databricks as databricks

    this = databricks.get_database_instance(name="my-database-instance")
    ```


    :param _builtins.str name: The name of the instance. This is the unique identifier for the instance
    """
    __args__ = dict()
    __args__['name'] = name
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('databricks:index/getDatabaseInstance:getDatabaseInstance', __args__, opts=opts, typ=GetDatabaseInstanceResult).value

    return AwaitableGetDatabaseInstanceResult(
        capacity=pulumi.get(__ret__, 'capacity'),
        child_instance_refs=pulumi.get(__ret__, 'child_instance_refs'),
        creation_time=pulumi.get(__ret__, 'creation_time'),
        creator=pulumi.get(__ret__, 'creator'),
        custom_tags=pulumi.get(__ret__, 'custom_tags'),
        effective_capacity=pulumi.get(__ret__, 'effective_capacity'),
        effective_custom_tags=pulumi.get(__ret__, 'effective_custom_tags'),
        effective_enable_pg_native_login=pulumi.get(__ret__, 'effective_enable_pg_native_login'),
        effective_enable_readable_secondaries=pulumi.get(__ret__, 'effective_enable_readable_secondaries'),
        effective_node_count=pulumi.get(__ret__, 'effective_node_count'),
        effective_retention_window_in_days=pulumi.get(__ret__, 'effective_retention_window_in_days'),
        effective_stopped=pulumi.get(__ret__, 'effective_stopped'),
        effective_usage_policy_id=pulumi.get(__ret__, 'effective_usage_policy_id'),
        enable_pg_native_login=pulumi.get(__ret__, 'enable_pg_native_login'),
        enable_readable_secondaries=pulumi.get(__ret__, 'enable_readable_secondaries'),
        id=pulumi.get(__ret__, 'id'),
        name=pulumi.get(__ret__, 'name'),
        node_count=pulumi.get(__ret__, 'node_count'),
        parent_instance_ref=pulumi.get(__ret__, 'parent_instance_ref'),
        pg_version=pulumi.get(__ret__, 'pg_version'),
        read_only_dns=pulumi.get(__ret__, 'read_only_dns'),
        read_write_dns=pulumi.get(__ret__, 'read_write_dns'),
        retention_window_in_days=pulumi.get(__ret__, 'retention_window_in_days'),
        state=pulumi.get(__ret__, 'state'),
        stopped=pulumi.get(__ret__, 'stopped'),
        uid=pulumi.get(__ret__, 'uid'),
        usage_policy_id=pulumi.get(__ret__, 'usage_policy_id'))
def get_database_instance_output(name: Optional[pulumi.Input[_builtins.str]] = None,
                                 opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetDatabaseInstanceResult]:
    """
    [![Public Preview](https://img.shields.io/badge/Release_Stage-Public_Preview-yellowgreen)](https://docs.databricks.com/aws/en/release-notes/release-types)

    This data source can be used to get a single Database Instance.

    ## Example Usage

    Referring to a Database Instance by name:

    ```python
    import pulumi
    import pulumi_databricks as databricks

    this = databricks.get_database_instance(name="my-database-instance")
    ```


    :param _builtins.str name: The name of the instance. This is the unique identifier for the instance
    """
    __args__ = dict()
    __args__['name'] = name
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('databricks:index/getDatabaseInstance:getDatabaseInstance', __args__, opts=opts, typ=GetDatabaseInstanceResult)
    return __ret__.apply(lambda __response__: GetDatabaseInstanceResult(
        capacity=pulumi.get(__response__, 'capacity'),
        child_instance_refs=pulumi.get(__response__, 'child_instance_refs'),
        creation_time=pulumi.get(__response__, 'creation_time'),
        creator=pulumi.get(__response__, 'creator'),
        custom_tags=pulumi.get(__response__, 'custom_tags'),
        effective_capacity=pulumi.get(__response__, 'effective_capacity'),
        effective_custom_tags=pulumi.get(__response__, 'effective_custom_tags'),
        effective_enable_pg_native_login=pulumi.get(__response__, 'effective_enable_pg_native_login'),
        effective_enable_readable_secondaries=pulumi.get(__response__, 'effective_enable_readable_secondaries'),
        effective_node_count=pulumi.get(__response__, 'effective_node_count'),
        effective_retention_window_in_days=pulumi.get(__response__, 'effective_retention_window_in_days'),
        effective_stopped=pulumi.get(__response__, 'effective_stopped'),
        effective_usage_policy_id=pulumi.get(__response__, 'effective_usage_policy_id'),
        enable_pg_native_login=pulumi.get(__response__, 'enable_pg_native_login'),
        enable_readable_secondaries=pulumi.get(__response__, 'enable_readable_secondaries'),
        id=pulumi.get(__response__, 'id'),
        name=pulumi.get(__response__, 'name'),
        node_count=pulumi.get(__response__, 'node_count'),
        parent_instance_ref=pulumi.get(__response__, 'parent_instance_ref'),
        pg_version=pulumi.get(__response__, 'pg_version'),
        read_only_dns=pulumi.get(__response__, 'read_only_dns'),
        read_write_dns=pulumi.get(__response__, 'read_write_dns'),
        retention_window_in_days=pulumi.get(__response__, 'retention_window_in_days'),
        state=pulumi.get(__response__, 'state'),
        stopped=pulumi.get(__response__, 'stopped'),
        uid=pulumi.get(__response__, 'uid'),
        usage_policy_id=pulumi.get(__response__, 'usage_policy_id')))
