UNPKG

@pulumi/pagerduty

Version:

A Pulumi package for creating and managing pagerduty cloud resources.

134 lines 5.75 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.EventOrchestrationRouter = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * An Orchestration Router allows users to create a set of Event Rules. The Router evaluates events sent to this Orchestration against each of its rules, one at a time, and routes the event to a specific Service based on the first rule that matches. If an event doesn't match any rules, it'll be sent to service specified in the `catchAll` or to the "Unrouted" Orchestration if no service is specified. * * ## Example of configuring Router rules for an Orchestration * * In this example the user has defined the Router with three rules. The first rule configures a dynamic route: any event containing a value in its `pdServiceId` custom detail will be routed to the Service with the ID specified by that value. The other rules route events matching a condition to specific services. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pagerduty from "@pulumi/pagerduty"; * * const database = pagerduty.getService({ * name: "Primary Data Store", * }); * const www = pagerduty.getService({ * name: "Web Server App", * }); * const router = new pagerduty.EventOrchestrationRouter("router", { * eventOrchestration: myMonitor.id, * set: { * id: "start", * rules: [ * { * label: "Dynamically route events related to specific PagerDuty services", * actions: { * dynamicRouteTos: [{ * lookupBy: "service_id", * source: "event.custom_details.pd_service_id", * regex: "(.*)", * }], * }, * }, * { * label: "Events relating to our relational database", * conditions: [ * { * expression: "event.summary matches part 'database'", * }, * { * expression: "event.source matches regex 'db[0-9]+-server'", * }, * ], * actions: { * routeTo: database.then(database => database.id), * }, * }, * { * conditions: [{ * expression: "event.summary matches part 'www'", * }], * actions: { * routeTo: www.then(www => www.id), * }, * }, * ], * }, * catchAll: { * actions: { * routeTo: "unrouted", * }, * }, * }); * ``` * * ## Import * * Router can be imported using the `id` of the Event Orchestration, e.g. * * ```sh * $ pulumi import pagerduty:index/eventOrchestrationRouter:EventOrchestrationRouter router 1b49abe7-26db-4439-a715-c6d883acfb3e * ``` */ class EventOrchestrationRouter extends pulumi.CustomResource { /** * Get an existing EventOrchestrationRouter 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 EventOrchestrationRouter(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of EventOrchestrationRouter. 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'] === EventOrchestrationRouter.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["catchAll"] = state?.catchAll; resourceInputs["eventOrchestration"] = state?.eventOrchestration; resourceInputs["set"] = state?.set; } 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?.set === undefined && !opts.urn) { throw new Error("Missing required property 'set'"); } resourceInputs["catchAll"] = args?.catchAll; resourceInputs["eventOrchestration"] = args?.eventOrchestration; resourceInputs["set"] = args?.set; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(EventOrchestrationRouter.__pulumiType, name, resourceInputs, opts); } } exports.EventOrchestrationRouter = EventOrchestrationRouter; /** @internal */ EventOrchestrationRouter.__pulumiType = 'pagerduty:index/eventOrchestrationRouter:EventOrchestrationRouter'; //# sourceMappingURL=eventOrchestrationRouter.js.map