UNPKG

@pulumi/pagerduty

Version:

A Pulumi package for creating and managing pagerduty cloud resources.

206 lines • 6.77 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.EventRule = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("./utilities")); /** * *NOTE: The `pagerduty.EventRule` resource has been deprecated in favor of the pagerduty.Ruleset and pagerduty.RulesetRule resources. Please use the `ruleset` based resources for working with Event Rules.* * * An [event rule](https://developer.pagerduty.com/docs/rest-api-v2/global-event-rules-api/) determines what happens to an event that is sent to PagerDuty by monitoring tools and other integrations. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pagerduty from "@pulumi/pagerduty"; * * const second = new pagerduty.EventRule("second", { * actionJson: JSON.stringify([ * [ * "route", * "P5DTL0K", * ], * [ * "severity", * "warning", * ], * [ * "annotate", * "2 Managed by terraform", * ], * [ * "priority", * "PL451DT", * ], * ]), * conditionJson: JSON.stringify([ * "and", * [ * "contains", * [ * "path", * "payload", * "source", * ], * "website", * ], * [ * "contains", * [ * "path", * "headers", * "from", * "0", * "address", * ], * "homer", * ], * ]), * advancedConditionJson: JSON.stringify([[ * "scheduled-weekly", * 1565392127032, * 3600000, * "America/Los_Angeles", * [ * 1, * 2, * 3, * 5, * 7, * ], * ]]), * }); * const third = new pagerduty.EventRule("third", { * actionJson: JSON.stringify([ * [ * "route", * "P5DTL0K", * ], * [ * "severity", * "warning", * ], * [ * "annotate", * "3 Managed by terraform", * ], * [ * "priority", * "PL451DT", * ], * ]), * conditionJson: JSON.stringify([ * "and", * [ * "contains", * [ * "path", * "payload", * "source", * ], * "website", * ], * [ * "contains", * [ * "path", * "headers", * "from", * "0", * "address", * ], * "homer", * ], * ]), * }, { * dependsOn: [two], * }); * ``` * * ## Import * * Event rules can be imported using the `id`, e.g. * * ```sh * $ pulumi import pagerduty:index/eventRule:EventRule main 19acac92-027a-4ea0-b06c-bbf516519601 * ``` */ class EventRule extends pulumi.CustomResource { /** * Get an existing EventRule 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 EventRule(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'pagerduty:index/eventRule:EventRule'; /** * Returns true if the given object is an instance of EventRule. 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'] === EventRule.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["actionJson"] = state?.actionJson; resourceInputs["advancedConditionJson"] = state?.advancedConditionJson; resourceInputs["catchAll"] = state?.catchAll; resourceInputs["conditionJson"] = state?.conditionJson; } else { const args = argsOrState; if (args?.actionJson === undefined && !opts.urn) { throw new Error("Missing required property 'actionJson'"); } if (args?.conditionJson === undefined && !opts.urn) { throw new Error("Missing required property 'conditionJson'"); } resourceInputs["actionJson"] = args?.actionJson; resourceInputs["advancedConditionJson"] = args?.advancedConditionJson; resourceInputs["conditionJson"] = args?.conditionJson; resourceInputs["catchAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(EventRule.__pulumiType, name, resourceInputs, opts); } } exports.EventRule = EventRule; //# sourceMappingURL=eventRule.js.map