@pulumi/pagerduty
Version:
A Pulumi package for creating and managing pagerduty cloud resources.
157 lines • 6.79 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventOrchestrationRouter = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(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 });
}
/** @internal */
static __pulumiType = 'pagerduty:index/eventOrchestrationRouter:EventOrchestrationRouter';
/**
* 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;
//# sourceMappingURL=eventOrchestrationRouter.js.map