UNPKG

@pulumi/pagerduty

Version:

A Pulumi package for creating and managing pagerduty cloud resources.

163 lines 7.46 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.EventOrchestrationGlobal = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * A [Global Orchestration](https://support.pagerduty.com/docs/event-orchestration#global-orchestrations) allows you to create a set of Event Rules. The Global Orchestration evaluates Events sent to it against each of its rules, beginning with the rules in the "start" set. When a matching rule is found, it can modify and enhance the event and can route the event to another set of rules within this Global Orchestration for further processing. * * ## Example of configuring a Global Orchestration * * This example shows creating `Team`, and `Event Orchestration` resources followed by creating a Global Orchestration to handle Events sent to that Event Orchestration. * * This example also shows using the pagerduty.getPriority and pagerduty.EscalationPolicy data sources to configure `priority` and `escalationPolicy` actions for a rule. * * This example shows a Global Orchestration that has nested sets: a rule in the "start" set has a `routeTo` action pointing at the "step-two" set. * * The `catchAll` actions will be applied if an Event reaches the end of any set without matching any rules in that set. In this example the `catchAll` doesn't have any `actions` so it'll leave events as-is. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pagerduty from "@pulumi/pagerduty"; * * const databaseTeam = new pagerduty.Team("database_team", {name: "Database Team"}); * const eventOrchestration = new pagerduty.EventOrchestration("event_orchestration", { * name: "Example Orchestration", * team: databaseTeam.id, * }); * const p1 = pagerduty.getPriority({ * name: "P1", * }); * const sreEscPolicy = pagerduty.getEscalationPolicy({ * name: "SRE Escalation Policy", * }); * const global = new pagerduty.EventOrchestrationGlobal("global", { * eventOrchestration: eventOrchestration.id, * sets: [ * { * id: "start", * rules: [{ * label: "Always annotate a note to all events", * actions: { * annotate: "This incident was created by the Database Team via a Global Orchestration", * routeTo: "step-two", * }, * }], * }, * { * id: "step-two", * rules: [ * { * label: "Drop events that are marked as no-op", * conditions: [{ * expression: "event.summary matches 'no-op'", * }], * actions: { * dropEvent: true, * }, * }, * { * label: "If the DB host is running out of space, then page the SRE team", * conditions: [{ * expression: "event.summary matches part 'running out of space'", * }], * actions: { * escalationPolicy: sreEscPolicy.then(sreEscPolicy => sreEscPolicy.id), * }, * }, * { * label: "If there's something wrong on the replica, then mark the alert as a warning", * conditions: [{ * expression: "event.custom_details.hostname matches part 'replica'", * }], * actions: { * severity: "warning", * }, * }, * { * label: "Otherwise, set the incident to P1, pause for 10 mins and run a diagnostic once the alert is suspended", * actions: { * priority: p1.then(p1 => p1.id), * suspend: 600, * automationAction: { * name: "db-diagnostic", * url: "https://example.com/run-diagnostic", * autoSend: true, * triggerTypes: "alert_suspended", * }, * }, * }, * ], * }, * ], * catchAll: { * actions: {}, * }, * }); * ``` * * ## Import * * Global Orchestration can be imported using the `id` of the Event Orchestration, e.g. * * ```sh * $ pulumi import pagerduty:index/eventOrchestrationGlobal:EventOrchestrationGlobal global 1b49abe7-26db-4439-a715-c6d883acfb3e * ``` */ class EventOrchestrationGlobal extends pulumi.CustomResource { /** * Get an existing EventOrchestrationGlobal 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 EventOrchestrationGlobal(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of EventOrchestrationGlobal. 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'] === EventOrchestrationGlobal.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["catchAll"] = state?.catchAll; resourceInputs["eventOrchestration"] = state?.eventOrchestration; resourceInputs["sets"] = state?.sets; } else { const args = argsOrState; if (args?.catchAll === undefined && !opts.urn) { throw new Error("Missing required property 'catchAll'"); } if (args?.eventOrchestration === undefined && !opts.urn) { throw new Error("Missing required property 'eventOrchestration'"); } if (args?.sets === undefined && !opts.urn) { throw new Error("Missing required property 'sets'"); } resourceInputs["catchAll"] = args?.catchAll; resourceInputs["eventOrchestration"] = args?.eventOrchestration; resourceInputs["sets"] = args?.sets; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(EventOrchestrationGlobal.__pulumiType, name, resourceInputs, opts); } } exports.EventOrchestrationGlobal = EventOrchestrationGlobal; /** @internal */ EventOrchestrationGlobal.__pulumiType = 'pagerduty:index/eventOrchestrationGlobal:EventOrchestrationGlobal'; //# sourceMappingURL=eventOrchestrationGlobal.js.map