@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
138 lines • 5.35 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** 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
* $ pulumi import grafana:machineLearning/alert: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, Object.assign(Object.assign({}, 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 ? state.annotations : undefined;
resourceInputs["anomalyCondition"] = state ? state.anomalyCondition : undefined;
resourceInputs["for"] = state ? state.for : undefined;
resourceInputs["jobId"] = state ? state.jobId : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["noDataState"] = state ? state.noDataState : undefined;
resourceInputs["outlierId"] = state ? state.outlierId : undefined;
resourceInputs["threshold"] = state ? state.threshold : undefined;
resourceInputs["title"] = state ? state.title : undefined;
resourceInputs["window"] = state ? state.window : undefined;
}
else {
const args = argsOrState;
if ((!args || args.title === undefined) && !opts.urn) {
throw new Error("Missing required property 'title'");
}
resourceInputs["annotations"] = args ? args.annotations : undefined;
resourceInputs["anomalyCondition"] = args ? args.anomalyCondition : undefined;
resourceInputs["for"] = args ? args.for : undefined;
resourceInputs["jobId"] = args ? args.jobId : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["noDataState"] = args ? args.noDataState : undefined;
resourceInputs["outlierId"] = args ? args.outlierId : undefined;
resourceInputs["threshold"] = args ? args.threshold : undefined;
resourceInputs["title"] = args ? args.title : undefined;
resourceInputs["window"] = args ? args.window : undefined;
}
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