@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
194 lines • 7.25 kB
JavaScript
;
// *** 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.AlertEnrichment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../../utilities");
/**
* Manages [Grafana Cloud Alert Enrichment](https://grafana.com/docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/alert-enrichment/).
*
* Alert enrichment is currently in public preview. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@pulumiverse/grafana";
*
* const enrichment = new grafana.alerting.v1beta1.AlertEnrichment("enrichment", {
* metadata: {
* uid: "test_enrichment",
* },
* spec: {
* title: "Comprehensive alert enrichment",
* description: "Demonstrates many enrichment steps and configurations",
* alertRuleUids: [
* "alert-rule-1",
* "alert-rule-2",
* ],
* receivers: [
* "webhook",
* "slack-critical",
* ],
* labelMatchers: [
* {
* type: "=",
* name: "severity",
* value: "critical",
* },
* {
* type: "=~",
* name: "team",
* value: "alerting|alerting-team",
* },
* ],
* annotationMatchers: [{
* type: "!=",
* name: "runbook_url",
* value: "",
* }],
* steps: [
* {
* assign: {
* timeout: "30s",
* annotations: {
* priority: "high",
* runbook_url: "https://runbooks.grafana.com/alert-handling",
* },
* },
* },
* {
* external: {
* url: "https://some-api.grafana.com/alert-enrichment",
* },
* },
* {
* dataSource: {
* timeout: "30s",
* logsQuery: {
* dataSourceType: "loki",
* dataSourceUid: "loki-uid-123",
* expr: "{job=\"my-app\"} |= \"error\"",
* maxLines: 5,
* },
* },
* },
* {
* dataSource: {
* timeout: "30s",
* rawQuery: {
* refId: "A",
* request: JSON.stringify({
* datasource: {
* type: "prometheus",
* uid: "prometheus-uid-456",
* },
* expr: "rate(http_requests_total[5m])",
* refId: "A",
* intervalMs: 1000,
* maxDataPoints: 43200,
* }),
* },
* },
* },
* {
* sift: {},
* },
* {
* explain: {
* annotation: "ai_explanation",
* },
* },
* {
* assistantInvestigations: {},
* },
* {
* conditional: {
* "if": {
* labelMatchers: [{
* type: "=",
* name: "severity",
* value: "critical",
* }],
* },
* then: {
* steps: [
* {
* assign: {
* annotations: {
* escalation_level: "immediate",
* },
* },
* },
* {
* external: {
* url: "https://irm.grafana.com/create-incident",
* },
* },
* ],
* },
* "else": {
* steps: [{
* assign: {
* annotations: {
* escalation_level: "standard",
* },
* },
* }],
* },
* },
* },
* ],
* },
* });
* ```
*/
class AlertEnrichment extends pulumi.CustomResource {
/**
* Get an existing AlertEnrichment 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 AlertEnrichment(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of AlertEnrichment. 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'] === AlertEnrichment.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["metadata"] = state?.metadata;
resourceInputs["options"] = state?.options;
resourceInputs["spec"] = state?.spec;
}
else {
const args = argsOrState;
resourceInputs["metadata"] = args?.metadata;
resourceInputs["options"] = args?.options;
resourceInputs["spec"] = args?.spec;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "grafana:alerting/alertEnrichment:AlertEnrichment" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(AlertEnrichment.__pulumiType, name, resourceInputs, opts);
}
}
exports.AlertEnrichment = AlertEnrichment;
/** @internal */
AlertEnrichment.__pulumiType = 'grafana:alerting/v1beta1/alertEnrichment:AlertEnrichment';
//# sourceMappingURL=alertEnrichment.js.map