# 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__ = ['DataQualityMonitorArgs', 'DataQualityMonitor']

@pulumi.input_type
class DataQualityMonitorArgs:
    def __init__(__self__, *,
                 object_id: pulumi.Input[_builtins.str],
                 object_type: pulumi.Input[_builtins.str],
                 anomaly_detection_config: Optional[pulumi.Input['DataQualityMonitorAnomalyDetectionConfigArgs']] = None,
                 data_profiling_config: Optional[pulumi.Input['DataQualityMonitorDataProfilingConfigArgs']] = None):
        """
        The set of arguments for constructing a DataQualityMonitor resource.
        :param pulumi.Input[_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 pulumi.Input[_builtins.str] object_type: The type of the monitored object. Can be one of the following: `schema` or `table`
        :param pulumi.Input['DataQualityMonitorAnomalyDetectionConfigArgs'] anomaly_detection_config: Anomaly Detection Configuration, applicable to `schema` object types
        :param pulumi.Input['DataQualityMonitorDataProfilingConfigArgs'] data_profiling_config: Data Profiling Configuration, applicable to `table` object types. Exactly one `Analysis Configuration`
               must be present
        """
        pulumi.set(__self__, "object_id", object_id)
        pulumi.set(__self__, "object_type", object_type)
        if anomaly_detection_config is not None:
            pulumi.set(__self__, "anomaly_detection_config", anomaly_detection_config)
        if data_profiling_config is not None:
            pulumi.set(__self__, "data_profiling_config", data_profiling_config)

    @_builtins.property
    @pulumi.getter(name="objectId")
    def object_id(self) -> pulumi.Input[_builtins.str]:
        """
        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
        """
        return pulumi.get(self, "object_id")

    @object_id.setter
    def object_id(self, value: pulumi.Input[_builtins.str]):
        pulumi.set(self, "object_id", value)

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

    @object_type.setter
    def object_type(self, value: pulumi.Input[_builtins.str]):
        pulumi.set(self, "object_type", value)

    @_builtins.property
    @pulumi.getter(name="anomalyDetectionConfig")
    def anomaly_detection_config(self) -> Optional[pulumi.Input['DataQualityMonitorAnomalyDetectionConfigArgs']]:
        """
        Anomaly Detection Configuration, applicable to `schema` object types
        """
        return pulumi.get(self, "anomaly_detection_config")

    @anomaly_detection_config.setter
    def anomaly_detection_config(self, value: Optional[pulumi.Input['DataQualityMonitorAnomalyDetectionConfigArgs']]):
        pulumi.set(self, "anomaly_detection_config", value)

    @_builtins.property
    @pulumi.getter(name="dataProfilingConfig")
    def data_profiling_config(self) -> Optional[pulumi.Input['DataQualityMonitorDataProfilingConfigArgs']]:
        """
        Data Profiling Configuration, applicable to `table` object types. Exactly one `Analysis Configuration`
        must be present
        """
        return pulumi.get(self, "data_profiling_config")

    @data_profiling_config.setter
    def data_profiling_config(self, value: Optional[pulumi.Input['DataQualityMonitorDataProfilingConfigArgs']]):
        pulumi.set(self, "data_profiling_config", value)


@pulumi.input_type
class _DataQualityMonitorState:
    def __init__(__self__, *,
                 anomaly_detection_config: Optional[pulumi.Input['DataQualityMonitorAnomalyDetectionConfigArgs']] = None,
                 data_profiling_config: Optional[pulumi.Input['DataQualityMonitorDataProfilingConfigArgs']] = None,
                 object_id: Optional[pulumi.Input[_builtins.str]] = None,
                 object_type: Optional[pulumi.Input[_builtins.str]] = None):
        """
        Input properties used for looking up and filtering DataQualityMonitor resources.
        :param pulumi.Input['DataQualityMonitorAnomalyDetectionConfigArgs'] anomaly_detection_config: Anomaly Detection Configuration, applicable to `schema` object types
        :param pulumi.Input['DataQualityMonitorDataProfilingConfigArgs'] data_profiling_config: Data Profiling Configuration, applicable to `table` object types. Exactly one `Analysis Configuration`
               must be present
        :param pulumi.Input[_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 pulumi.Input[_builtins.str] object_type: The type of the monitored object. Can be one of the following: `schema` or `table`
        """
        if anomaly_detection_config is not None:
            pulumi.set(__self__, "anomaly_detection_config", anomaly_detection_config)
        if data_profiling_config is not None:
            pulumi.set(__self__, "data_profiling_config", data_profiling_config)
        if object_id is not None:
            pulumi.set(__self__, "object_id", object_id)
        if object_type is not None:
            pulumi.set(__self__, "object_type", object_type)

    @_builtins.property
    @pulumi.getter(name="anomalyDetectionConfig")
    def anomaly_detection_config(self) -> Optional[pulumi.Input['DataQualityMonitorAnomalyDetectionConfigArgs']]:
        """
        Anomaly Detection Configuration, applicable to `schema` object types
        """
        return pulumi.get(self, "anomaly_detection_config")

    @anomaly_detection_config.setter
    def anomaly_detection_config(self, value: Optional[pulumi.Input['DataQualityMonitorAnomalyDetectionConfigArgs']]):
        pulumi.set(self, "anomaly_detection_config", value)

    @_builtins.property
    @pulumi.getter(name="dataProfilingConfig")
    def data_profiling_config(self) -> Optional[pulumi.Input['DataQualityMonitorDataProfilingConfigArgs']]:
        """
        Data Profiling Configuration, applicable to `table` object types. Exactly one `Analysis Configuration`
        must be present
        """
        return pulumi.get(self, "data_profiling_config")

    @data_profiling_config.setter
    def data_profiling_config(self, value: Optional[pulumi.Input['DataQualityMonitorDataProfilingConfigArgs']]):
        pulumi.set(self, "data_profiling_config", value)

    @_builtins.property
    @pulumi.getter(name="objectId")
    def object_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        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
        """
        return pulumi.get(self, "object_id")

    @object_id.setter
    def object_id(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "object_id", value)

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

    @object_type.setter
    def object_type(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "object_type", value)


@pulumi.type_token("databricks:index/dataQualityMonitor:DataQualityMonitor")
class DataQualityMonitor(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 anomaly_detection_config: Optional[pulumi.Input[Union['DataQualityMonitorAnomalyDetectionConfigArgs', 'DataQualityMonitorAnomalyDetectionConfigArgsDict']]] = None,
                 data_profiling_config: Optional[pulumi.Input[Union['DataQualityMonitorDataProfilingConfigArgs', 'DataQualityMonitorDataProfilingConfigArgsDict']]] = None,
                 object_id: Optional[pulumi.Input[_builtins.str]] = None,
                 object_type: Optional[pulumi.Input[_builtins.str]] = None,
                 __props__=None):
        """
        [![Public Preview](https://img.shields.io/badge/Release_Stage-Public_Preview-yellowgreen)](https://docs.databricks.com/aws/en/release-notes/release-types)

        This resource allows you to set up data quality monitoring checks for Unity Catalog objects, currently schema and table.

        For the `table` `object_type`, you must either:
        1. be an owner of the table's parent catalog, have **USE_SCHEMA** on the table's parent schema, and have **SELECT** access on the table
        2. have **USE_CATALOG** on the table's parent catalog, be an owner of the table's parent schema, and have **SELECT** access on the table.
        3. have the following permissions:
           - **USE_CATALOG** on the table's parent catalog
           - **USE_SCHEMA** on the table's parent schema
           - be an owner of the table.

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

        ## Example Usage

        ```python
        import pulumi
        import pulumi_databricks as databricks

        this = databricks.Schema("this",
            catalog_name="my_catalog",
            name="my_schema")
        this_data_quality_monitor = databricks.DataQualityMonitor("this",
            object_type="schema",
            object_id=this.schema_id,
            anomaly_detection_config={})
        ```

        ## Import

        As of Pulumi v1.5, resources can be imported through configuration.

        hcl

        import {

          id = "object_type,object_id"

          to = databricks_data_quality_monitor.this

        }

        If you are using an older version of Pulumi, import the resource using the `pulumi import` command as follows:

        ```sh
        $ pulumi import databricks:index/dataQualityMonitor:DataQualityMonitor this "object_type,object_id"
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[Union['DataQualityMonitorAnomalyDetectionConfigArgs', 'DataQualityMonitorAnomalyDetectionConfigArgsDict']] anomaly_detection_config: Anomaly Detection Configuration, applicable to `schema` object types
        :param pulumi.Input[Union['DataQualityMonitorDataProfilingConfigArgs', 'DataQualityMonitorDataProfilingConfigArgsDict']] data_profiling_config: Data Profiling Configuration, applicable to `table` object types. Exactly one `Analysis Configuration`
               must be present
        :param pulumi.Input[_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 pulumi.Input[_builtins.str] object_type: The type of the monitored object. Can be one of the following: `schema` or `table`
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: DataQualityMonitorArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        [![Public Preview](https://img.shields.io/badge/Release_Stage-Public_Preview-yellowgreen)](https://docs.databricks.com/aws/en/release-notes/release-types)

        This resource allows you to set up data quality monitoring checks for Unity Catalog objects, currently schema and table.

        For the `table` `object_type`, you must either:
        1. be an owner of the table's parent catalog, have **USE_SCHEMA** on the table's parent schema, and have **SELECT** access on the table
        2. have **USE_CATALOG** on the table's parent catalog, be an owner of the table's parent schema, and have **SELECT** access on the table.
        3. have the following permissions:
           - **USE_CATALOG** on the table's parent catalog
           - **USE_SCHEMA** on the table's parent schema
           - be an owner of the table.

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

        ## Example Usage

        ```python
        import pulumi
        import pulumi_databricks as databricks

        this = databricks.Schema("this",
            catalog_name="my_catalog",
            name="my_schema")
        this_data_quality_monitor = databricks.DataQualityMonitor("this",
            object_type="schema",
            object_id=this.schema_id,
            anomaly_detection_config={})
        ```

        ## Import

        As of Pulumi v1.5, resources can be imported through configuration.

        hcl

        import {

          id = "object_type,object_id"

          to = databricks_data_quality_monitor.this

        }

        If you are using an older version of Pulumi, import the resource using the `pulumi import` command as follows:

        ```sh
        $ pulumi import databricks:index/dataQualityMonitor:DataQualityMonitor this "object_type,object_id"
        ```

        :param str resource_name: The name of the resource.
        :param DataQualityMonitorArgs args: The arguments to use to populate this resource's properties.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        ...
    def __init__(__self__, resource_name: str, *args, **kwargs):
        resource_args, opts = _utilities.get_resource_args_opts(DataQualityMonitorArgs, pulumi.ResourceOptions, *args, **kwargs)
        if resource_args is not None:
            __self__._internal_init(resource_name, opts, **resource_args.__dict__)
        else:
            __self__._internal_init(resource_name, *args, **kwargs)

    def _internal_init(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 anomaly_detection_config: Optional[pulumi.Input[Union['DataQualityMonitorAnomalyDetectionConfigArgs', 'DataQualityMonitorAnomalyDetectionConfigArgsDict']]] = None,
                 data_profiling_config: Optional[pulumi.Input[Union['DataQualityMonitorDataProfilingConfigArgs', 'DataQualityMonitorDataProfilingConfigArgsDict']]] = None,
                 object_id: Optional[pulumi.Input[_builtins.str]] = None,
                 object_type: Optional[pulumi.Input[_builtins.str]] = None,
                 __props__=None):
        opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = DataQualityMonitorArgs.__new__(DataQualityMonitorArgs)

            __props__.__dict__["anomaly_detection_config"] = anomaly_detection_config
            __props__.__dict__["data_profiling_config"] = data_profiling_config
            if object_id is None and not opts.urn:
                raise TypeError("Missing required property 'object_id'")
            __props__.__dict__["object_id"] = object_id
            if object_type is None and not opts.urn:
                raise TypeError("Missing required property 'object_type'")
            __props__.__dict__["object_type"] = object_type
        super(DataQualityMonitor, __self__).__init__(
            'databricks:index/dataQualityMonitor:DataQualityMonitor',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            anomaly_detection_config: Optional[pulumi.Input[Union['DataQualityMonitorAnomalyDetectionConfigArgs', 'DataQualityMonitorAnomalyDetectionConfigArgsDict']]] = None,
            data_profiling_config: Optional[pulumi.Input[Union['DataQualityMonitorDataProfilingConfigArgs', 'DataQualityMonitorDataProfilingConfigArgsDict']]] = None,
            object_id: Optional[pulumi.Input[_builtins.str]] = None,
            object_type: Optional[pulumi.Input[_builtins.str]] = None) -> 'DataQualityMonitor':
        """
        Get an existing DataQualityMonitor resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[Union['DataQualityMonitorAnomalyDetectionConfigArgs', 'DataQualityMonitorAnomalyDetectionConfigArgsDict']] anomaly_detection_config: Anomaly Detection Configuration, applicable to `schema` object types
        :param pulumi.Input[Union['DataQualityMonitorDataProfilingConfigArgs', 'DataQualityMonitorDataProfilingConfigArgsDict']] data_profiling_config: Data Profiling Configuration, applicable to `table` object types. Exactly one `Analysis Configuration`
               must be present
        :param pulumi.Input[_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 pulumi.Input[_builtins.str] object_type: The type of the monitored object. Can be one of the following: `schema` or `table`
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _DataQualityMonitorState.__new__(_DataQualityMonitorState)

        __props__.__dict__["anomaly_detection_config"] = anomaly_detection_config
        __props__.__dict__["data_profiling_config"] = data_profiling_config
        __props__.__dict__["object_id"] = object_id
        __props__.__dict__["object_type"] = object_type
        return DataQualityMonitor(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter(name="anomalyDetectionConfig")
    def anomaly_detection_config(self) -> pulumi.Output[Optional['outputs.DataQualityMonitorAnomalyDetectionConfig']]:
        """
        Anomaly Detection Configuration, applicable to `schema` object types
        """
        return pulumi.get(self, "anomaly_detection_config")

    @_builtins.property
    @pulumi.getter(name="dataProfilingConfig")
    def data_profiling_config(self) -> pulumi.Output[Optional['outputs.DataQualityMonitorDataProfilingConfig']]:
        """
        Data Profiling Configuration, applicable to `table` object types. Exactly one `Analysis Configuration`
        must be present
        """
        return pulumi.get(self, "data_profiling_config")

    @_builtins.property
    @pulumi.getter(name="objectId")
    def object_id(self) -> pulumi.Output[_builtins.str]:
        """
        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
        """
        return pulumi.get(self, "object_id")

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

