# 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__ = [
    'GetDataQualityRefreshResult',
    'AwaitableGetDataQualityRefreshResult',
    'get_data_quality_refresh',
    'get_data_quality_refresh_output',
]

@pulumi.output_type
class GetDataQualityRefreshResult:
    """
    A collection of values returned by getDataQualityRefresh.
    """
    def __init__(__self__, end_time_ms=None, id=None, message=None, object_id=None, object_type=None, provider_config=None, refresh_id=None, start_time_ms=None, state=None, trigger=None):
        if end_time_ms and not isinstance(end_time_ms, int):
            raise TypeError("Expected argument 'end_time_ms' to be a int")
        pulumi.set(__self__, "end_time_ms", end_time_ms)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if message and not isinstance(message, str):
            raise TypeError("Expected argument 'message' to be a str")
        pulumi.set(__self__, "message", message)
        if object_id and not isinstance(object_id, str):
            raise TypeError("Expected argument 'object_id' to be a str")
        pulumi.set(__self__, "object_id", object_id)
        if object_type and not isinstance(object_type, str):
            raise TypeError("Expected argument 'object_type' to be a str")
        pulumi.set(__self__, "object_type", object_type)
        if provider_config and not isinstance(provider_config, dict):
            raise TypeError("Expected argument 'provider_config' to be a dict")
        pulumi.set(__self__, "provider_config", provider_config)
        if refresh_id and not isinstance(refresh_id, int):
            raise TypeError("Expected argument 'refresh_id' to be a int")
        pulumi.set(__self__, "refresh_id", refresh_id)
        if start_time_ms and not isinstance(start_time_ms, int):
            raise TypeError("Expected argument 'start_time_ms' to be a int")
        pulumi.set(__self__, "start_time_ms", start_time_ms)
        if state and not isinstance(state, str):
            raise TypeError("Expected argument 'state' to be a str")
        pulumi.set(__self__, "state", state)
        if trigger and not isinstance(trigger, str):
            raise TypeError("Expected argument 'trigger' to be a str")
        pulumi.set(__self__, "trigger", trigger)

    @_builtins.property
    @pulumi.getter(name="endTimeMs")
    def end_time_ms(self) -> _builtins.int:
        """
        (integer) - Time when the refresh ended (milliseconds since 1/1/1970 UTC)
        """
        return pulumi.get(self, "end_time_ms")

    @_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 message(self) -> _builtins.str:
        """
        (string) - An optional message to give insight into the current state of the refresh (e.g. FAILURE messages)
        """
        return pulumi.get(self, "message")

    @_builtins.property
    @pulumi.getter(name="objectId")
    def object_id(self) -> _builtins.str:
        """
        (string) - The UUID of the request object. It is `schema_id` for `schema`, and `table_id` for `table`.
        """
        return pulumi.get(self, "object_id")

    @_builtins.property
    @pulumi.getter(name="objectType")
    def object_type(self) -> _builtins.str:
        """
        (string) - The type of the monitored object. Can be one of the following: `schema`or `table`
        """
        return pulumi.get(self, "object_type")

    @_builtins.property
    @pulumi.getter(name="providerConfig")
    def provider_config(self) -> Optional['outputs.GetDataQualityRefreshProviderConfigResult']:
        return pulumi.get(self, "provider_config")

    @_builtins.property
    @pulumi.getter(name="refreshId")
    def refresh_id(self) -> _builtins.int:
        """
        (integer) - Unique id of the refresh operation
        """
        return pulumi.get(self, "refresh_id")

    @_builtins.property
    @pulumi.getter(name="startTimeMs")
    def start_time_ms(self) -> _builtins.int:
        """
        (integer) - Time when the refresh started (milliseconds since 1/1/1970 UTC)
        """
        return pulumi.get(self, "start_time_ms")

    @_builtins.property
    @pulumi.getter
    def state(self) -> _builtins.str:
        """
        (string) - The current state of the refresh. Possible values are: `MONITOR_REFRESH_STATE_CANCELED`, `MONITOR_REFRESH_STATE_FAILED`, `MONITOR_REFRESH_STATE_PENDING`, `MONITOR_REFRESH_STATE_RUNNING`, `MONITOR_REFRESH_STATE_SUCCESS`, `MONITOR_REFRESH_STATE_UNKNOWN`
        """
        return pulumi.get(self, "state")

    @_builtins.property
    @pulumi.getter
    def trigger(self) -> _builtins.str:
        """
        (string) - What triggered the refresh. Possible values are: `MONITOR_REFRESH_TRIGGER_DATA_CHANGE`, `MONITOR_REFRESH_TRIGGER_MANUAL`, `MONITOR_REFRESH_TRIGGER_SCHEDULE`, `MONITOR_REFRESH_TRIGGER_UNKNOWN`
        """
        return pulumi.get(self, "trigger")


class AwaitableGetDataQualityRefreshResult(GetDataQualityRefreshResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetDataQualityRefreshResult(
            end_time_ms=self.end_time_ms,
            id=self.id,
            message=self.message,
            object_id=self.object_id,
            object_type=self.object_type,
            provider_config=self.provider_config,
            refresh_id=self.refresh_id,
            start_time_ms=self.start_time_ms,
            state=self.state,
            trigger=self.trigger)


def get_data_quality_refresh(object_id: Optional[_builtins.str] = None,
                             object_type: Optional[_builtins.str] = None,
                             provider_config: Optional[Union['GetDataQualityRefreshProviderConfigArgs', 'GetDataQualityRefreshProviderConfigArgsDict']] = None,
                             refresh_id: Optional[_builtins.int] = None,
                             opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetDataQualityRefreshResult:
    """
    [![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 fetch a data quality refresh on a Unity Catalog table.

    The caller must either:
    1. be an owner of the table's parent catalog
    2. have **USE_CATALOG** on the table's parent catalog and be an owner of the table's parent schema.
    3. have the following permissions:
       - **USE_CATALOG** on the table's parent catalog
       - **USE_SCHEMA** on the table's parent schema
       - **SELECT** privilege on the table.

    > **Note** This data source can only be used with a workspace-level provider!

    ## Example Usage

    Getting a data quality refresh by Unity Catalog object type (currently supports `table`) and object id:

    ```python
    import pulumi
    import pulumi_databricks as databricks

    this = databricks.get_table(name="my_catalog.my_schema.my_table")
    this_get_data_quality_refresh = databricks.get_data_quality_refresh(object_type="table",
        object_id=this.id)
    ```


    :param _builtins.str object_id: The UUID of the request object. It is `schema_id` for `schema`, and `table_id` for `table`.
           
           Find the `schema_id` from either:
           1. The [schema_id](https://docs.databricks.com/api/workspace/schemas/get#schema_id) of the `Schemas` resource.
           2. In [Catalog Explorer](https://docs.databricks.com/aws/en/catalog-explorer/) > select the `schema` > go to the `Details` tab > the `Schema ID` field.
           
           Find the `table_id` from either:
           1. The [table_id](https://docs.databricks.com/api/workspace/tables/get#table_id) of the `Tables` resource.
           2. In [Catalog Explorer](https://docs.databricks.com/aws/en/catalog-explorer/) > select the `table` > go to the `Details` tab > the `Table ID` field
    :param _builtins.str object_type: The type of the monitored object. Can be one of the following: `schema`or `table`
    :param Union['GetDataQualityRefreshProviderConfigArgs', 'GetDataQualityRefreshProviderConfigArgsDict'] provider_config: Configure the provider for management through account provider.
    :param _builtins.int refresh_id: Unique id of the refresh operation
    """
    __args__ = dict()
    __args__['objectId'] = object_id
    __args__['objectType'] = object_type
    __args__['providerConfig'] = provider_config
    __args__['refreshId'] = refresh_id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('databricks:index/getDataQualityRefresh:getDataQualityRefresh', __args__, opts=opts, typ=GetDataQualityRefreshResult).value

    return AwaitableGetDataQualityRefreshResult(
        end_time_ms=pulumi.get(__ret__, 'end_time_ms'),
        id=pulumi.get(__ret__, 'id'),
        message=pulumi.get(__ret__, 'message'),
        object_id=pulumi.get(__ret__, 'object_id'),
        object_type=pulumi.get(__ret__, 'object_type'),
        provider_config=pulumi.get(__ret__, 'provider_config'),
        refresh_id=pulumi.get(__ret__, 'refresh_id'),
        start_time_ms=pulumi.get(__ret__, 'start_time_ms'),
        state=pulumi.get(__ret__, 'state'),
        trigger=pulumi.get(__ret__, 'trigger'))
def get_data_quality_refresh_output(object_id: Optional[pulumi.Input[_builtins.str]] = None,
                                    object_type: Optional[pulumi.Input[_builtins.str]] = None,
                                    provider_config: Optional[pulumi.Input[Optional[Union['GetDataQualityRefreshProviderConfigArgs', 'GetDataQualityRefreshProviderConfigArgsDict']]]] = None,
                                    refresh_id: Optional[pulumi.Input[_builtins.int]] = None,
                                    opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetDataQualityRefreshResult]:
    """
    [![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 fetch a data quality refresh on a Unity Catalog table.

    The caller must either:
    1. be an owner of the table's parent catalog
    2. have **USE_CATALOG** on the table's parent catalog and be an owner of the table's parent schema.
    3. have the following permissions:
       - **USE_CATALOG** on the table's parent catalog
       - **USE_SCHEMA** on the table's parent schema
       - **SELECT** privilege on the table.

    > **Note** This data source can only be used with a workspace-level provider!

    ## Example Usage

    Getting a data quality refresh by Unity Catalog object type (currently supports `table`) and object id:

    ```python
    import pulumi
    import pulumi_databricks as databricks

    this = databricks.get_table(name="my_catalog.my_schema.my_table")
    this_get_data_quality_refresh = databricks.get_data_quality_refresh(object_type="table",
        object_id=this.id)
    ```


    :param _builtins.str object_id: The UUID of the request object. It is `schema_id` for `schema`, and `table_id` for `table`.
           
           Find the `schema_id` from either:
           1. The [schema_id](https://docs.databricks.com/api/workspace/schemas/get#schema_id) of the `Schemas` resource.
           2. In [Catalog Explorer](https://docs.databricks.com/aws/en/catalog-explorer/) > select the `schema` > go to the `Details` tab > the `Schema ID` field.
           
           Find the `table_id` from either:
           1. The [table_id](https://docs.databricks.com/api/workspace/tables/get#table_id) of the `Tables` resource.
           2. In [Catalog Explorer](https://docs.databricks.com/aws/en/catalog-explorer/) > select the `table` > go to the `Details` tab > the `Table ID` field
    :param _builtins.str object_type: The type of the monitored object. Can be one of the following: `schema`or `table`
    :param Union['GetDataQualityRefreshProviderConfigArgs', 'GetDataQualityRefreshProviderConfigArgsDict'] provider_config: Configure the provider for management through account provider.
    :param _builtins.int refresh_id: Unique id of the refresh operation
    """
    __args__ = dict()
    __args__['objectId'] = object_id
    __args__['objectType'] = object_type
    __args__['providerConfig'] = provider_config
    __args__['refreshId'] = refresh_id
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('databricks:index/getDataQualityRefresh:getDataQualityRefresh', __args__, opts=opts, typ=GetDataQualityRefreshResult)
    return __ret__.apply(lambda __response__: GetDataQualityRefreshResult(
        end_time_ms=pulumi.get(__response__, 'end_time_ms'),
        id=pulumi.get(__response__, 'id'),
        message=pulumi.get(__response__, 'message'),
        object_id=pulumi.get(__response__, 'object_id'),
        object_type=pulumi.get(__response__, 'object_type'),
        provider_config=pulumi.get(__response__, 'provider_config'),
        refresh_id=pulumi.get(__response__, 'refresh_id'),
        start_time_ms=pulumi.get(__response__, 'start_time_ms'),
        state=pulumi.get(__response__, 'state'),
        trigger=pulumi.get(__response__, 'trigger')))
