# 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__ = ['AlertV2Args', 'AlertV2']

@pulumi.input_type
class AlertV2Args:
    def __init__(__self__, *,
                 display_name: pulumi.Input[_builtins.str],
                 evaluation: pulumi.Input['AlertV2EvaluationArgs'],
                 query_text: pulumi.Input[_builtins.str],
                 schedule: pulumi.Input['AlertV2ScheduleArgs'],
                 warehouse_id: pulumi.Input[_builtins.str],
                 custom_description: Optional[pulumi.Input[_builtins.str]] = None,
                 custom_summary: Optional[pulumi.Input[_builtins.str]] = None,
                 parent_path: Optional[pulumi.Input[_builtins.str]] = None,
                 run_as: Optional[pulumi.Input['AlertV2RunAsArgs']] = None,
                 run_as_user_name: Optional[pulumi.Input[_builtins.str]] = None):
        """
        The set of arguments for constructing a AlertV2 resource.
        :param pulumi.Input[_builtins.str] display_name: The display name of the alert
        :param pulumi.Input[_builtins.str] query_text: Text of the query to be run
        :param pulumi.Input[_builtins.str] warehouse_id: ID of the SQL warehouse attached to the alert
        :param pulumi.Input[_builtins.str] custom_description: Custom description for the alert. support mustache template
        :param pulumi.Input[_builtins.str] custom_summary: Custom summary for the alert. support mustache template
        :param pulumi.Input[_builtins.str] parent_path: The workspace path of the folder containing the alert. Can only be set on create, and cannot be updated
        :param pulumi.Input['AlertV2RunAsArgs'] run_as: Specifies the identity that will be used to run the alert.
               This field allows you to configure alerts to run as a specific user or service principal.
               - For user identity: Set `user_name` to the email of an active workspace user. Users can only set this to their own email.
               - For service principal: Set `service_principal_name` to the application ID. Requires the `servicePrincipal/user` role.
               If not specified, the alert will run as the request user
        :param pulumi.Input[_builtins.str] run_as_user_name: The run as username or application ID of service principal.
               On Create and Update, this field can be set to application ID of an active service principal. Setting this field requires the servicePrincipal/user role.
               Deprecated: Use `run_as` field instead. This field will be removed in a future release
        """
        pulumi.set(__self__, "display_name", display_name)
        pulumi.set(__self__, "evaluation", evaluation)
        pulumi.set(__self__, "query_text", query_text)
        pulumi.set(__self__, "schedule", schedule)
        pulumi.set(__self__, "warehouse_id", warehouse_id)
        if custom_description is not None:
            pulumi.set(__self__, "custom_description", custom_description)
        if custom_summary is not None:
            pulumi.set(__self__, "custom_summary", custom_summary)
        if parent_path is not None:
            pulumi.set(__self__, "parent_path", parent_path)
        if run_as is not None:
            pulumi.set(__self__, "run_as", run_as)
        if run_as_user_name is not None:
            pulumi.set(__self__, "run_as_user_name", run_as_user_name)

    @_builtins.property
    @pulumi.getter(name="displayName")
    def display_name(self) -> pulumi.Input[_builtins.str]:
        """
        The display name of the alert
        """
        return pulumi.get(self, "display_name")

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

    @_builtins.property
    @pulumi.getter
    def evaluation(self) -> pulumi.Input['AlertV2EvaluationArgs']:
        return pulumi.get(self, "evaluation")

    @evaluation.setter
    def evaluation(self, value: pulumi.Input['AlertV2EvaluationArgs']):
        pulumi.set(self, "evaluation", value)

    @_builtins.property
    @pulumi.getter(name="queryText")
    def query_text(self) -> pulumi.Input[_builtins.str]:
        """
        Text of the query to be run
        """
        return pulumi.get(self, "query_text")

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

    @_builtins.property
    @pulumi.getter
    def schedule(self) -> pulumi.Input['AlertV2ScheduleArgs']:
        return pulumi.get(self, "schedule")

    @schedule.setter
    def schedule(self, value: pulumi.Input['AlertV2ScheduleArgs']):
        pulumi.set(self, "schedule", value)

    @_builtins.property
    @pulumi.getter(name="warehouseId")
    def warehouse_id(self) -> pulumi.Input[_builtins.str]:
        """
        ID of the SQL warehouse attached to the alert
        """
        return pulumi.get(self, "warehouse_id")

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

    @_builtins.property
    @pulumi.getter(name="customDescription")
    def custom_description(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Custom description for the alert. support mustache template
        """
        return pulumi.get(self, "custom_description")

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

    @_builtins.property
    @pulumi.getter(name="customSummary")
    def custom_summary(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Custom summary for the alert. support mustache template
        """
        return pulumi.get(self, "custom_summary")

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

    @_builtins.property
    @pulumi.getter(name="parentPath")
    def parent_path(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The workspace path of the folder containing the alert. Can only be set on create, and cannot be updated
        """
        return pulumi.get(self, "parent_path")

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

    @_builtins.property
    @pulumi.getter(name="runAs")
    def run_as(self) -> Optional[pulumi.Input['AlertV2RunAsArgs']]:
        """
        Specifies the identity that will be used to run the alert.
        This field allows you to configure alerts to run as a specific user or service principal.
        - For user identity: Set `user_name` to the email of an active workspace user. Users can only set this to their own email.
        - For service principal: Set `service_principal_name` to the application ID. Requires the `servicePrincipal/user` role.
        If not specified, the alert will run as the request user
        """
        return pulumi.get(self, "run_as")

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

    @_builtins.property
    @pulumi.getter(name="runAsUserName")
    def run_as_user_name(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The run as username or application ID of service principal.
        On Create and Update, this field can be set to application ID of an active service principal. Setting this field requires the servicePrincipal/user role.
        Deprecated: Use `run_as` field instead. This field will be removed in a future release
        """
        return pulumi.get(self, "run_as_user_name")

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


@pulumi.input_type
class _AlertV2State:
    def __init__(__self__, *,
                 create_time: Optional[pulumi.Input[_builtins.str]] = None,
                 custom_description: Optional[pulumi.Input[_builtins.str]] = None,
                 custom_summary: Optional[pulumi.Input[_builtins.str]] = None,
                 display_name: Optional[pulumi.Input[_builtins.str]] = None,
                 effective_run_as: Optional[pulumi.Input['AlertV2EffectiveRunAsArgs']] = None,
                 evaluation: Optional[pulumi.Input['AlertV2EvaluationArgs']] = None,
                 lifecycle_state: Optional[pulumi.Input[_builtins.str]] = None,
                 owner_user_name: Optional[pulumi.Input[_builtins.str]] = None,
                 parent_path: Optional[pulumi.Input[_builtins.str]] = None,
                 query_text: Optional[pulumi.Input[_builtins.str]] = None,
                 run_as: Optional[pulumi.Input['AlertV2RunAsArgs']] = None,
                 run_as_user_name: Optional[pulumi.Input[_builtins.str]] = None,
                 schedule: Optional[pulumi.Input['AlertV2ScheduleArgs']] = None,
                 update_time: Optional[pulumi.Input[_builtins.str]] = None,
                 warehouse_id: Optional[pulumi.Input[_builtins.str]] = None):
        """
        Input properties used for looking up and filtering AlertV2 resources.
        :param pulumi.Input[_builtins.str] create_time: (string) - The timestamp indicating when the alert was created
        :param pulumi.Input[_builtins.str] custom_description: Custom description for the alert. support mustache template
        :param pulumi.Input[_builtins.str] custom_summary: Custom summary for the alert. support mustache template
        :param pulumi.Input[_builtins.str] display_name: The display name of the alert
        :param pulumi.Input['AlertV2EffectiveRunAsArgs'] effective_run_as: (AlertV2RunAs) - The actual identity that will be used to execute the alert.
               This is an output-only field that shows the resolved run-as identity after applying
               permissions and defaults
        :param pulumi.Input[_builtins.str] lifecycle_state: (string) - Indicates whether the query is trashed. Possible values are: `ACTIVE`, `DELETED`
        :param pulumi.Input[_builtins.str] owner_user_name: (string) - The owner's username. This field is set to "Unavailable" if the user has been deleted
        :param pulumi.Input[_builtins.str] parent_path: The workspace path of the folder containing the alert. Can only be set on create, and cannot be updated
        :param pulumi.Input[_builtins.str] query_text: Text of the query to be run
        :param pulumi.Input['AlertV2RunAsArgs'] run_as: Specifies the identity that will be used to run the alert.
               This field allows you to configure alerts to run as a specific user or service principal.
               - For user identity: Set `user_name` to the email of an active workspace user. Users can only set this to their own email.
               - For service principal: Set `service_principal_name` to the application ID. Requires the `servicePrincipal/user` role.
               If not specified, the alert will run as the request user
        :param pulumi.Input[_builtins.str] run_as_user_name: The run as username or application ID of service principal.
               On Create and Update, this field can be set to application ID of an active service principal. Setting this field requires the servicePrincipal/user role.
               Deprecated: Use `run_as` field instead. This field will be removed in a future release
        :param pulumi.Input[_builtins.str] update_time: (string) - The timestamp indicating when the alert was updated
        :param pulumi.Input[_builtins.str] warehouse_id: ID of the SQL warehouse attached to the alert
        """
        if create_time is not None:
            pulumi.set(__self__, "create_time", create_time)
        if custom_description is not None:
            pulumi.set(__self__, "custom_description", custom_description)
        if custom_summary is not None:
            pulumi.set(__self__, "custom_summary", custom_summary)
        if display_name is not None:
            pulumi.set(__self__, "display_name", display_name)
        if effective_run_as is not None:
            pulumi.set(__self__, "effective_run_as", effective_run_as)
        if evaluation is not None:
            pulumi.set(__self__, "evaluation", evaluation)
        if lifecycle_state is not None:
            pulumi.set(__self__, "lifecycle_state", lifecycle_state)
        if owner_user_name is not None:
            pulumi.set(__self__, "owner_user_name", owner_user_name)
        if parent_path is not None:
            pulumi.set(__self__, "parent_path", parent_path)
        if query_text is not None:
            pulumi.set(__self__, "query_text", query_text)
        if run_as is not None:
            pulumi.set(__self__, "run_as", run_as)
        if run_as_user_name is not None:
            pulumi.set(__self__, "run_as_user_name", run_as_user_name)
        if schedule is not None:
            pulumi.set(__self__, "schedule", schedule)
        if update_time is not None:
            pulumi.set(__self__, "update_time", update_time)
        if warehouse_id is not None:
            pulumi.set(__self__, "warehouse_id", warehouse_id)

    @_builtins.property
    @pulumi.getter(name="createTime")
    def create_time(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        (string) - The timestamp indicating when the alert was created
        """
        return pulumi.get(self, "create_time")

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

    @_builtins.property
    @pulumi.getter(name="customDescription")
    def custom_description(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Custom description for the alert. support mustache template
        """
        return pulumi.get(self, "custom_description")

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

    @_builtins.property
    @pulumi.getter(name="customSummary")
    def custom_summary(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Custom summary for the alert. support mustache template
        """
        return pulumi.get(self, "custom_summary")

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

    @_builtins.property
    @pulumi.getter(name="displayName")
    def display_name(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The display name of the alert
        """
        return pulumi.get(self, "display_name")

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

    @_builtins.property
    @pulumi.getter(name="effectiveRunAs")
    def effective_run_as(self) -> Optional[pulumi.Input['AlertV2EffectiveRunAsArgs']]:
        """
        (AlertV2RunAs) - The actual identity that will be used to execute the alert.
        This is an output-only field that shows the resolved run-as identity after applying
        permissions and defaults
        """
        return pulumi.get(self, "effective_run_as")

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

    @_builtins.property
    @pulumi.getter
    def evaluation(self) -> Optional[pulumi.Input['AlertV2EvaluationArgs']]:
        return pulumi.get(self, "evaluation")

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

    @_builtins.property
    @pulumi.getter(name="lifecycleState")
    def lifecycle_state(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        (string) - Indicates whether the query is trashed. Possible values are: `ACTIVE`, `DELETED`
        """
        return pulumi.get(self, "lifecycle_state")

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

    @_builtins.property
    @pulumi.getter(name="ownerUserName")
    def owner_user_name(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        (string) - The owner's username. This field is set to "Unavailable" if the user has been deleted
        """
        return pulumi.get(self, "owner_user_name")

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

    @_builtins.property
    @pulumi.getter(name="parentPath")
    def parent_path(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The workspace path of the folder containing the alert. Can only be set on create, and cannot be updated
        """
        return pulumi.get(self, "parent_path")

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

    @_builtins.property
    @pulumi.getter(name="queryText")
    def query_text(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Text of the query to be run
        """
        return pulumi.get(self, "query_text")

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

    @_builtins.property
    @pulumi.getter(name="runAs")
    def run_as(self) -> Optional[pulumi.Input['AlertV2RunAsArgs']]:
        """
        Specifies the identity that will be used to run the alert.
        This field allows you to configure alerts to run as a specific user or service principal.
        - For user identity: Set `user_name` to the email of an active workspace user. Users can only set this to their own email.
        - For service principal: Set `service_principal_name` to the application ID. Requires the `servicePrincipal/user` role.
        If not specified, the alert will run as the request user
        """
        return pulumi.get(self, "run_as")

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

    @_builtins.property
    @pulumi.getter(name="runAsUserName")
    def run_as_user_name(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The run as username or application ID of service principal.
        On Create and Update, this field can be set to application ID of an active service principal. Setting this field requires the servicePrincipal/user role.
        Deprecated: Use `run_as` field instead. This field will be removed in a future release
        """
        return pulumi.get(self, "run_as_user_name")

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

    @_builtins.property
    @pulumi.getter
    def schedule(self) -> Optional[pulumi.Input['AlertV2ScheduleArgs']]:
        return pulumi.get(self, "schedule")

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

    @_builtins.property
    @pulumi.getter(name="updateTime")
    def update_time(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        (string) - The timestamp indicating when the alert was updated
        """
        return pulumi.get(self, "update_time")

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

    @_builtins.property
    @pulumi.getter(name="warehouseId")
    def warehouse_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        ID of the SQL warehouse attached to the alert
        """
        return pulumi.get(self, "warehouse_id")

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


@pulumi.type_token("databricks:index/alertV2:AlertV2")
class AlertV2(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 custom_description: Optional[pulumi.Input[_builtins.str]] = None,
                 custom_summary: Optional[pulumi.Input[_builtins.str]] = None,
                 display_name: Optional[pulumi.Input[_builtins.str]] = None,
                 evaluation: Optional[pulumi.Input[Union['AlertV2EvaluationArgs', 'AlertV2EvaluationArgsDict']]] = None,
                 parent_path: Optional[pulumi.Input[_builtins.str]] = None,
                 query_text: Optional[pulumi.Input[_builtins.str]] = None,
                 run_as: Optional[pulumi.Input[Union['AlertV2RunAsArgs', 'AlertV2RunAsArgsDict']]] = None,
                 run_as_user_name: Optional[pulumi.Input[_builtins.str]] = None,
                 schedule: Optional[pulumi.Input[Union['AlertV2ScheduleArgs', 'AlertV2ScheduleArgsDict']]] = None,
                 warehouse_id: 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)

        The Alert v2 resource allows you to manage SQL alerts in Databricks SQL. Alerts monitor query results and notify you when specific conditions are met.

        Alerts run on a schedule and evaluate query results against defined thresholds. When an alert is triggered, notifications can be sent to specified users or destinations.

        ## Example Usage

        ### Basic Alert Example
        This example creates a basic alert that monitors a query and sends notifications to a user when the value exceeds a threshold:

        ```python
        import pulumi
        import pulumi_databricks as databricks

        basic_alert = databricks.AlertV2("basic_alert",
            display_name="High Error Rate Alert",
            query_text="SELECT count(*) as error_count FROM logs WHERE level = 'ERROR' AND timestamp > now() - interval 1 hour",
            warehouse_id="a7066a8ef796be84",
            parent_path="/Users/user@example.com",
            evaluation={
                "source": {
                    "name": "error_count",
                    "display": "Error Count",
                    "aggregation": "COUNT",
                },
                "comparison_operator": "GREATER_THAN",
                "threshold": {
                    "value": {
                        "double_value": 100,
                    },
                },
                "empty_result_state": "OK",
                "notification": {
                    "subscriptions": [{
                        "user_email": "user@example.com",
                    }],
                    "notify_on_ok": True,
                },
            },
            schedule={
                "quartz_cron_schedule": "0 0/15 * * * ?",
                "timezone_id": "America/Los_Angeles",
                "pause_status": "UNPAUSED",
            })
        ```

        ## Import

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

        hcl

        import {

          id = "id"

          to = databricks_alert_v2.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/alertV2:AlertV2 this "id"
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.str] custom_description: Custom description for the alert. support mustache template
        :param pulumi.Input[_builtins.str] custom_summary: Custom summary for the alert. support mustache template
        :param pulumi.Input[_builtins.str] display_name: The display name of the alert
        :param pulumi.Input[_builtins.str] parent_path: The workspace path of the folder containing the alert. Can only be set on create, and cannot be updated
        :param pulumi.Input[_builtins.str] query_text: Text of the query to be run
        :param pulumi.Input[Union['AlertV2RunAsArgs', 'AlertV2RunAsArgsDict']] run_as: Specifies the identity that will be used to run the alert.
               This field allows you to configure alerts to run as a specific user or service principal.
               - For user identity: Set `user_name` to the email of an active workspace user. Users can only set this to their own email.
               - For service principal: Set `service_principal_name` to the application ID. Requires the `servicePrincipal/user` role.
               If not specified, the alert will run as the request user
        :param pulumi.Input[_builtins.str] run_as_user_name: The run as username or application ID of service principal.
               On Create and Update, this field can be set to application ID of an active service principal. Setting this field requires the servicePrincipal/user role.
               Deprecated: Use `run_as` field instead. This field will be removed in a future release
        :param pulumi.Input[_builtins.str] warehouse_id: ID of the SQL warehouse attached to the alert
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: AlertV2Args,
                 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)

        The Alert v2 resource allows you to manage SQL alerts in Databricks SQL. Alerts monitor query results and notify you when specific conditions are met.

        Alerts run on a schedule and evaluate query results against defined thresholds. When an alert is triggered, notifications can be sent to specified users or destinations.

        ## Example Usage

        ### Basic Alert Example
        This example creates a basic alert that monitors a query and sends notifications to a user when the value exceeds a threshold:

        ```python
        import pulumi
        import pulumi_databricks as databricks

        basic_alert = databricks.AlertV2("basic_alert",
            display_name="High Error Rate Alert",
            query_text="SELECT count(*) as error_count FROM logs WHERE level = 'ERROR' AND timestamp > now() - interval 1 hour",
            warehouse_id="a7066a8ef796be84",
            parent_path="/Users/user@example.com",
            evaluation={
                "source": {
                    "name": "error_count",
                    "display": "Error Count",
                    "aggregation": "COUNT",
                },
                "comparison_operator": "GREATER_THAN",
                "threshold": {
                    "value": {
                        "double_value": 100,
                    },
                },
                "empty_result_state": "OK",
                "notification": {
                    "subscriptions": [{
                        "user_email": "user@example.com",
                    }],
                    "notify_on_ok": True,
                },
            },
            schedule={
                "quartz_cron_schedule": "0 0/15 * * * ?",
                "timezone_id": "America/Los_Angeles",
                "pause_status": "UNPAUSED",
            })
        ```

        ## Import

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

        hcl

        import {

          id = "id"

          to = databricks_alert_v2.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/alertV2:AlertV2 this "id"
        ```

        :param str resource_name: The name of the resource.
        :param AlertV2Args 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(AlertV2Args, 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,
                 custom_description: Optional[pulumi.Input[_builtins.str]] = None,
                 custom_summary: Optional[pulumi.Input[_builtins.str]] = None,
                 display_name: Optional[pulumi.Input[_builtins.str]] = None,
                 evaluation: Optional[pulumi.Input[Union['AlertV2EvaluationArgs', 'AlertV2EvaluationArgsDict']]] = None,
                 parent_path: Optional[pulumi.Input[_builtins.str]] = None,
                 query_text: Optional[pulumi.Input[_builtins.str]] = None,
                 run_as: Optional[pulumi.Input[Union['AlertV2RunAsArgs', 'AlertV2RunAsArgsDict']]] = None,
                 run_as_user_name: Optional[pulumi.Input[_builtins.str]] = None,
                 schedule: Optional[pulumi.Input[Union['AlertV2ScheduleArgs', 'AlertV2ScheduleArgsDict']]] = None,
                 warehouse_id: 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__ = AlertV2Args.__new__(AlertV2Args)

            __props__.__dict__["custom_description"] = custom_description
            __props__.__dict__["custom_summary"] = custom_summary
            if display_name is None and not opts.urn:
                raise TypeError("Missing required property 'display_name'")
            __props__.__dict__["display_name"] = display_name
            if evaluation is None and not opts.urn:
                raise TypeError("Missing required property 'evaluation'")
            __props__.__dict__["evaluation"] = evaluation
            __props__.__dict__["parent_path"] = parent_path
            if query_text is None and not opts.urn:
                raise TypeError("Missing required property 'query_text'")
            __props__.__dict__["query_text"] = query_text
            __props__.__dict__["run_as"] = run_as
            __props__.__dict__["run_as_user_name"] = run_as_user_name
            if schedule is None and not opts.urn:
                raise TypeError("Missing required property 'schedule'")
            __props__.__dict__["schedule"] = schedule
            if warehouse_id is None and not opts.urn:
                raise TypeError("Missing required property 'warehouse_id'")
            __props__.__dict__["warehouse_id"] = warehouse_id
            __props__.__dict__["create_time"] = None
            __props__.__dict__["effective_run_as"] = None
            __props__.__dict__["lifecycle_state"] = None
            __props__.__dict__["owner_user_name"] = None
            __props__.__dict__["update_time"] = None
        super(AlertV2, __self__).__init__(
            'databricks:index/alertV2:AlertV2',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            create_time: Optional[pulumi.Input[_builtins.str]] = None,
            custom_description: Optional[pulumi.Input[_builtins.str]] = None,
            custom_summary: Optional[pulumi.Input[_builtins.str]] = None,
            display_name: Optional[pulumi.Input[_builtins.str]] = None,
            effective_run_as: Optional[pulumi.Input[Union['AlertV2EffectiveRunAsArgs', 'AlertV2EffectiveRunAsArgsDict']]] = None,
            evaluation: Optional[pulumi.Input[Union['AlertV2EvaluationArgs', 'AlertV2EvaluationArgsDict']]] = None,
            lifecycle_state: Optional[pulumi.Input[_builtins.str]] = None,
            owner_user_name: Optional[pulumi.Input[_builtins.str]] = None,
            parent_path: Optional[pulumi.Input[_builtins.str]] = None,
            query_text: Optional[pulumi.Input[_builtins.str]] = None,
            run_as: Optional[pulumi.Input[Union['AlertV2RunAsArgs', 'AlertV2RunAsArgsDict']]] = None,
            run_as_user_name: Optional[pulumi.Input[_builtins.str]] = None,
            schedule: Optional[pulumi.Input[Union['AlertV2ScheduleArgs', 'AlertV2ScheduleArgsDict']]] = None,
            update_time: Optional[pulumi.Input[_builtins.str]] = None,
            warehouse_id: Optional[pulumi.Input[_builtins.str]] = None) -> 'AlertV2':
        """
        Get an existing AlertV2 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[_builtins.str] create_time: (string) - The timestamp indicating when the alert was created
        :param pulumi.Input[_builtins.str] custom_description: Custom description for the alert. support mustache template
        :param pulumi.Input[_builtins.str] custom_summary: Custom summary for the alert. support mustache template
        :param pulumi.Input[_builtins.str] display_name: The display name of the alert
        :param pulumi.Input[Union['AlertV2EffectiveRunAsArgs', 'AlertV2EffectiveRunAsArgsDict']] effective_run_as: (AlertV2RunAs) - The actual identity that will be used to execute the alert.
               This is an output-only field that shows the resolved run-as identity after applying
               permissions and defaults
        :param pulumi.Input[_builtins.str] lifecycle_state: (string) - Indicates whether the query is trashed. Possible values are: `ACTIVE`, `DELETED`
        :param pulumi.Input[_builtins.str] owner_user_name: (string) - The owner's username. This field is set to "Unavailable" if the user has been deleted
        :param pulumi.Input[_builtins.str] parent_path: The workspace path of the folder containing the alert. Can only be set on create, and cannot be updated
        :param pulumi.Input[_builtins.str] query_text: Text of the query to be run
        :param pulumi.Input[Union['AlertV2RunAsArgs', 'AlertV2RunAsArgsDict']] run_as: Specifies the identity that will be used to run the alert.
               This field allows you to configure alerts to run as a specific user or service principal.
               - For user identity: Set `user_name` to the email of an active workspace user. Users can only set this to their own email.
               - For service principal: Set `service_principal_name` to the application ID. Requires the `servicePrincipal/user` role.
               If not specified, the alert will run as the request user
        :param pulumi.Input[_builtins.str] run_as_user_name: The run as username or application ID of service principal.
               On Create and Update, this field can be set to application ID of an active service principal. Setting this field requires the servicePrincipal/user role.
               Deprecated: Use `run_as` field instead. This field will be removed in a future release
        :param pulumi.Input[_builtins.str] update_time: (string) - The timestamp indicating when the alert was updated
        :param pulumi.Input[_builtins.str] warehouse_id: ID of the SQL warehouse attached to the alert
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _AlertV2State.__new__(_AlertV2State)

        __props__.__dict__["create_time"] = create_time
        __props__.__dict__["custom_description"] = custom_description
        __props__.__dict__["custom_summary"] = custom_summary
        __props__.__dict__["display_name"] = display_name
        __props__.__dict__["effective_run_as"] = effective_run_as
        __props__.__dict__["evaluation"] = evaluation
        __props__.__dict__["lifecycle_state"] = lifecycle_state
        __props__.__dict__["owner_user_name"] = owner_user_name
        __props__.__dict__["parent_path"] = parent_path
        __props__.__dict__["query_text"] = query_text
        __props__.__dict__["run_as"] = run_as
        __props__.__dict__["run_as_user_name"] = run_as_user_name
        __props__.__dict__["schedule"] = schedule
        __props__.__dict__["update_time"] = update_time
        __props__.__dict__["warehouse_id"] = warehouse_id
        return AlertV2(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter(name="createTime")
    def create_time(self) -> pulumi.Output[_builtins.str]:
        """
        (string) - The timestamp indicating when the alert was created
        """
        return pulumi.get(self, "create_time")

    @_builtins.property
    @pulumi.getter(name="customDescription")
    def custom_description(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        Custom description for the alert. support mustache template
        """
        return pulumi.get(self, "custom_description")

    @_builtins.property
    @pulumi.getter(name="customSummary")
    def custom_summary(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        Custom summary for the alert. support mustache template
        """
        return pulumi.get(self, "custom_summary")

    @_builtins.property
    @pulumi.getter(name="displayName")
    def display_name(self) -> pulumi.Output[_builtins.str]:
        """
        The display name of the alert
        """
        return pulumi.get(self, "display_name")

    @_builtins.property
    @pulumi.getter(name="effectiveRunAs")
    def effective_run_as(self) -> pulumi.Output['outputs.AlertV2EffectiveRunAs']:
        """
        (AlertV2RunAs) - The actual identity that will be used to execute the alert.
        This is an output-only field that shows the resolved run-as identity after applying
        permissions and defaults
        """
        return pulumi.get(self, "effective_run_as")

    @_builtins.property
    @pulumi.getter
    def evaluation(self) -> pulumi.Output['outputs.AlertV2Evaluation']:
        return pulumi.get(self, "evaluation")

    @_builtins.property
    @pulumi.getter(name="lifecycleState")
    def lifecycle_state(self) -> pulumi.Output[_builtins.str]:
        """
        (string) - Indicates whether the query is trashed. Possible values are: `ACTIVE`, `DELETED`
        """
        return pulumi.get(self, "lifecycle_state")

    @_builtins.property
    @pulumi.getter(name="ownerUserName")
    def owner_user_name(self) -> pulumi.Output[_builtins.str]:
        """
        (string) - The owner's username. This field is set to "Unavailable" if the user has been deleted
        """
        return pulumi.get(self, "owner_user_name")

    @_builtins.property
    @pulumi.getter(name="parentPath")
    def parent_path(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The workspace path of the folder containing the alert. Can only be set on create, and cannot be updated
        """
        return pulumi.get(self, "parent_path")

    @_builtins.property
    @pulumi.getter(name="queryText")
    def query_text(self) -> pulumi.Output[_builtins.str]:
        """
        Text of the query to be run
        """
        return pulumi.get(self, "query_text")

    @_builtins.property
    @pulumi.getter(name="runAs")
    def run_as(self) -> pulumi.Output[Optional['outputs.AlertV2RunAs']]:
        """
        Specifies the identity that will be used to run the alert.
        This field allows you to configure alerts to run as a specific user or service principal.
        - For user identity: Set `user_name` to the email of an active workspace user. Users can only set this to their own email.
        - For service principal: Set `service_principal_name` to the application ID. Requires the `servicePrincipal/user` role.
        If not specified, the alert will run as the request user
        """
        return pulumi.get(self, "run_as")

    @_builtins.property
    @pulumi.getter(name="runAsUserName")
    def run_as_user_name(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The run as username or application ID of service principal.
        On Create and Update, this field can be set to application ID of an active service principal. Setting this field requires the servicePrincipal/user role.
        Deprecated: Use `run_as` field instead. This field will be removed in a future release
        """
        return pulumi.get(self, "run_as_user_name")

    @_builtins.property
    @pulumi.getter
    def schedule(self) -> pulumi.Output['outputs.AlertV2Schedule']:
        return pulumi.get(self, "schedule")

    @_builtins.property
    @pulumi.getter(name="updateTime")
    def update_time(self) -> pulumi.Output[_builtins.str]:
        """
        (string) - The timestamp indicating when the alert was updated
        """
        return pulumi.get(self, "update_time")

    @_builtins.property
    @pulumi.getter(name="warehouseId")
    def warehouse_id(self) -> pulumi.Output[_builtins.str]:
        """
        ID of the SQL warehouse attached to the alert
        """
        return pulumi.get(self, "warehouse_id")

