UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

138 lines 4.92 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.Alert = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * ## Example Usage * * ### Forecast Alert * * This alert uses a forecast. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@pulumiverse/grafana"; * * const testAlertJob = new grafana.machinelearning.Job("test_alert_job", { * name: "Test Job", * metric: "tf_test_alert_job", * datasourceType: "prometheus", * datasourceUid: "abcd12345", * queryParams: { * expr: "grafanacloud_grafana_instance_active_user_count", * }, * }); * const testJobAlert = new grafana.machinelearning.Alert("test_job_alert", { * jobId: testAlertJob.id, * title: "Test Alert", * anomalyCondition: "any", * threshold: ">0.8", * window: "15m", * noDataState: "OK", * }); * ``` * * ### Outlier Alert * * This alert uses an outlier detector. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@pulumiverse/grafana"; * * const testAlertOutlierDetector = new grafana.machinelearning.OutlierDetector("test_alert_outlier_detector", { * name: "Test Outlier", * metric: "tf_test_alert_outlier", * datasourceType: "prometheus", * datasourceUid: "AbCd12345", * queryParams: { * expr: "grafanacloud_grafana_instance_active_user_count", * }, * interval: 300, * algorithm: { * name: "dbscan", * sensitivity: 0.5, * config: { * epsilon: 1, * }, * }, * }); * const testOutlierAlert = new grafana.machinelearning.Alert("test_outlier_alert", { * outlierId: testAlertOutlierDetector.id, * title: "Test Alert", * window: "1h", * }); * ``` * * ## Import * * ```sh * terraform import grafana_machine_learning_alert.name "{{ id }}" * ``` */ class Alert extends pulumi.CustomResource { /** * Get an existing Alert 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 Alert(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Alert. 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'] === Alert.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["annotations"] = state?.annotations; resourceInputs["anomalyCondition"] = state?.anomalyCondition; resourceInputs["for"] = state?.for; resourceInputs["jobId"] = state?.jobId; resourceInputs["labels"] = state?.labels; resourceInputs["noDataState"] = state?.noDataState; resourceInputs["outlierId"] = state?.outlierId; resourceInputs["threshold"] = state?.threshold; resourceInputs["title"] = state?.title; resourceInputs["window"] = state?.window; } else { const args = argsOrState; if (args?.title === undefined && !opts.urn) { throw new Error("Missing required property 'title'"); } resourceInputs["annotations"] = args?.annotations; resourceInputs["anomalyCondition"] = args?.anomalyCondition; resourceInputs["for"] = args?.for; resourceInputs["jobId"] = args?.jobId; resourceInputs["labels"] = args?.labels; resourceInputs["noDataState"] = args?.noDataState; resourceInputs["outlierId"] = args?.outlierId; resourceInputs["threshold"] = args?.threshold; resourceInputs["title"] = args?.title; resourceInputs["window"] = args?.window; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Alert.__pulumiType, name, resourceInputs, opts); } } exports.Alert = Alert; /** @internal */ Alert.__pulumiType = 'grafana:machineLearning/alert:Alert'; //# sourceMappingURL=alert.js.map