UNPKG

@pulumi/pagerduty

Version:

A Pulumi package for creating and managing pagerduty cloud resources.

164 lines 7.51 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! *** 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.EventOrchestrationGlobalCacheVariable = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("./utilities")); /** * A [Cache Variable](https://support.pagerduty.com/docs/event-orchestration-variables) can be created on a Global Event Orchestration, in order to temporarily store event data to be referenced later within the Global Event Orchestration * * ## Example of configuring a Cache Variable for a Global Event Orchestration * * This example shows creating a global `Event Orchestration` and a `Cache Variable`. All events that have the `event.source` field will have its `source` value stored in this Cache Variable, and appended as a note for the subsequent incident created by this Event Orchestration. * * ```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 recentHost = new pagerduty.EventOrchestrationGlobalCacheVariable("recent_host", { * eventOrchestration: eventOrchestration.id, * name: "recent_host", * conditions: [{ * expression: "event.source exists", * }], * configuration: { * type: "recent_value", * source: "event.source", * regex: ".*", * }, * }); * const hostIgnoreList = new pagerduty.EventOrchestrationServiceCacheVariable("host_ignore_list", { * eventOrchestration: eventOrchestration.id, * name: "host_ignore_list", * configuration: { * type: "external_data", * dataType: "string", * ttlSeconds: 3000, * }, * }); * const global = new pagerduty.EventOrchestrationGlobal("global", { * eventOrchestration: eventOrchestration.id, * sets: [{ * id: "start", * rules: [ * { * label: "Drop events originating from hosts on the ignore list", * conditions: [{ * expression: "cache_var.host_ignore_list matches part event.custom_details.host", * }], * actions: { * drop: true, * }, * }, * { * label: "Always annotate the incident with the event source for all events", * actions: { * annotate: "Last time, we saw this incident occur on host: {{cache_var.recent_host}}", * }, * }, * ], * }], * catchAll: { * actions: {}, * }, * }); * ``` * * ## Import * * Cache Variables can be imported using colon-separated IDs, which is the combination of the Global Event Orchestration ID followed by the Cache Variable ID, e.g. * * ```sh * $ pulumi import pagerduty:index/eventOrchestrationGlobalCacheVariable:EventOrchestrationGlobalCacheVariable cache_variable 5e7110bf-0ee7-429e-9724-34ed1fe15ac3:138ed254-3444-44ad-8cc7-701d69def439 * ``` * * [1]: https://support.pagerduty.com/docs/event-orchestration-variables * [2]: https://developer.pagerduty.com/docs/ZG9jOjM1NTE0MDc0-pcl-overview * [3]: https://developer.pagerduty.com/docs/ZG9jOjM1NTE0MDc0-pcl-overview#paths * [4]: https://github.com/google/re2/wiki/Syntax */ class EventOrchestrationGlobalCacheVariable extends pulumi.CustomResource { /** * Get an existing EventOrchestrationGlobalCacheVariable 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 EventOrchestrationGlobalCacheVariable(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'pagerduty:index/eventOrchestrationGlobalCacheVariable:EventOrchestrationGlobalCacheVariable'; /** * Returns true if the given object is an instance of EventOrchestrationGlobalCacheVariable. 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'] === EventOrchestrationGlobalCacheVariable.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["conditions"] = state?.conditions; resourceInputs["configuration"] = state?.configuration; resourceInputs["disabled"] = state?.disabled; resourceInputs["eventOrchestration"] = state?.eventOrchestration; resourceInputs["name"] = state?.name; } else { const args = argsOrState; if (args?.configuration === undefined && !opts.urn) { throw new Error("Missing required property 'configuration'"); } if (args?.eventOrchestration === undefined && !opts.urn) { throw new Error("Missing required property 'eventOrchestration'"); } resourceInputs["conditions"] = args?.conditions; resourceInputs["configuration"] = args?.configuration; resourceInputs["disabled"] = args?.disabled; resourceInputs["eventOrchestration"] = args?.eventOrchestration; resourceInputs["name"] = args?.name; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(EventOrchestrationGlobalCacheVariable.__pulumiType, name, resourceInputs, opts); } } exports.EventOrchestrationGlobalCacheVariable = EventOrchestrationGlobalCacheVariable; //# sourceMappingURL=eventOrchestrationGlobalCacheVariable.js.map