# 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__ = [
    'GetAlertsV2Result',
    'AwaitableGetAlertsV2Result',
    'get_alerts_v2',
    'get_alerts_v2_output',
]

@pulumi.output_type
class GetAlertsV2Result:
    """
    A collection of values returned by getAlertsV2.
    """
    def __init__(__self__, id=None, results=None, workspace_id=None):
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if results and not isinstance(results, list):
            raise TypeError("Expected argument 'results' to be a list")
        pulumi.set(__self__, "results", results)
        if workspace_id and not isinstance(workspace_id, str):
            raise TypeError("Expected argument 'workspace_id' to be a str")
        pulumi.set(__self__, "workspace_id", workspace_id)

    @_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 results(self) -> Sequence['outputs.GetAlertsV2ResultResult']:
        return pulumi.get(self, "results")

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


class AwaitableGetAlertsV2Result(GetAlertsV2Result):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetAlertsV2Result(
            id=self.id,
            results=self.results,
            workspace_id=self.workspace_id)


def get_alerts_v2(workspace_id: Optional[_builtins.str] = None,
                  opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetAlertsV2Result:
    """
    The SQL Alerts v2 data source allows you to retrieve a list of alerts in Databricks SQL that are accessible to the current user. This data source returns alerts ordered by their creation time.

    You can use this data source to:
    - Get a comprehensive list of all alerts in your workspace
    - Monitor and audit alert configurations across your workspace

    ## Example Usage

    ### List All Alerts
    This example retrieves all alerts accessible to the current user:

    ```python
    import pulumi
    import pulumi_databricks as databricks

    all = databricks.get_alert_v2()
    ```


    :param _builtins.str workspace_id: Workspace ID of the resource
    """
    __args__ = dict()
    __args__['workspaceId'] = workspace_id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('databricks:index/getAlertsV2:getAlertsV2', __args__, opts=opts, typ=GetAlertsV2Result).value

    return AwaitableGetAlertsV2Result(
        id=pulumi.get(__ret__, 'id'),
        results=pulumi.get(__ret__, 'results'),
        workspace_id=pulumi.get(__ret__, 'workspace_id'))
def get_alerts_v2_output(workspace_id: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                         opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetAlertsV2Result]:
    """
    The SQL Alerts v2 data source allows you to retrieve a list of alerts in Databricks SQL that are accessible to the current user. This data source returns alerts ordered by their creation time.

    You can use this data source to:
    - Get a comprehensive list of all alerts in your workspace
    - Monitor and audit alert configurations across your workspace

    ## Example Usage

    ### List All Alerts
    This example retrieves all alerts accessible to the current user:

    ```python
    import pulumi
    import pulumi_databricks as databricks

    all = databricks.get_alert_v2()
    ```


    :param _builtins.str workspace_id: Workspace ID of the resource
    """
    __args__ = dict()
    __args__['workspaceId'] = workspace_id
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('databricks:index/getAlertsV2:getAlertsV2', __args__, opts=opts, typ=GetAlertsV2Result)
    return __ret__.apply(lambda __response__: GetAlertsV2Result(
        id=pulumi.get(__response__, 'id'),
        results=pulumi.get(__response__, 'results'),
        workspace_id=pulumi.get(__response__, 'workspace_id')))
