UNPKG

@pulumi/databricks

Version:

A Pulumi package for creating and managing databricks cloud resources.

161 lines 6.74 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.AlertV2 = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * [![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: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as databricks from "@pulumi/databricks"; * * const basicAlert = new databricks.AlertV2("basic_alert", { * displayName: "High Error Rate Alert", * queryText: "SELECT count(*) as error_count FROM logs WHERE level = 'ERROR' AND timestamp > now() - interval 1 hour", * warehouseId: "a7066a8ef796be84", * parentPath: "/Users/user@example.com", * evaluation: { * source: { * name: "error_count", * display: "Error Count", * aggregation: "COUNT", * }, * comparisonOperator: "GREATER_THAN", * threshold: { * value: { * doubleValue: 100, * }, * }, * emptyResultState: "OK", * notification: { * subscriptions: [{ * userEmail: "user@example.com", * }], * notifyOnOk: true, * }, * }, * schedule: { * quartzCronSchedule: "0 0/15 * * * ?", * timezoneId: "America/Los_Angeles", * pauseStatus: "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" * ``` */ class AlertV2 extends pulumi.CustomResource { /** * Get an existing AlertV2 resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new AlertV2(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of AlertV2. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === AlertV2.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createTime"] = state?.createTime; resourceInputs["customDescription"] = state?.customDescription; resourceInputs["customSummary"] = state?.customSummary; resourceInputs["displayName"] = state?.displayName; resourceInputs["effectiveRunAs"] = state?.effectiveRunAs; resourceInputs["evaluation"] = state?.evaluation; resourceInputs["lifecycleState"] = state?.lifecycleState; resourceInputs["ownerUserName"] = state?.ownerUserName; resourceInputs["parentPath"] = state?.parentPath; resourceInputs["queryText"] = state?.queryText; resourceInputs["runAs"] = state?.runAs; resourceInputs["runAsUserName"] = state?.runAsUserName; resourceInputs["schedule"] = state?.schedule; resourceInputs["updateTime"] = state?.updateTime; resourceInputs["warehouseId"] = state?.warehouseId; } else { const args = argsOrState; if (args?.displayName === undefined && !opts.urn) { throw new Error("Missing required property 'displayName'"); } if (args?.evaluation === undefined && !opts.urn) { throw new Error("Missing required property 'evaluation'"); } if (args?.queryText === undefined && !opts.urn) { throw new Error("Missing required property 'queryText'"); } if (args?.schedule === undefined && !opts.urn) { throw new Error("Missing required property 'schedule'"); } if (args?.warehouseId === undefined && !opts.urn) { throw new Error("Missing required property 'warehouseId'"); } resourceInputs["customDescription"] = args?.customDescription; resourceInputs["customSummary"] = args?.customSummary; resourceInputs["displayName"] = args?.displayName; resourceInputs["evaluation"] = args?.evaluation; resourceInputs["parentPath"] = args?.parentPath; resourceInputs["queryText"] = args?.queryText; resourceInputs["runAs"] = args?.runAs; resourceInputs["runAsUserName"] = args?.runAsUserName; resourceInputs["schedule"] = args?.schedule; resourceInputs["warehouseId"] = args?.warehouseId; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["effectiveRunAs"] = undefined /*out*/; resourceInputs["lifecycleState"] = undefined /*out*/; resourceInputs["ownerUserName"] = undefined /*out*/; resourceInputs["updateTime"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(AlertV2.__pulumiType, name, resourceInputs, opts); } } exports.AlertV2 = AlertV2; /** @internal */ AlertV2.__pulumiType = 'databricks:index/alertV2:AlertV2'; //# sourceMappingURL=alertV2.js.map