UNPKG

@pulumi/pagerduty

Version:

A Pulumi package for creating and managing pagerduty cloud resources.

215 lines • 8.18 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.RulesetRule = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("./utilities")); /** * An [event rule](https://support.pagerduty.com/docs/rulesets#section-create-event-rules) allows you to set actions that should be taken on events that meet your designated rule criteria. * * <div role="alert" class="alert alert-warning"> * <div class="alert-title"><i class="fa fa-warning"></i>End-of-Life</div> * <p> * Rulesets and Event Rules will end-of-life soon. We highly recommend that you * <a * href="https://support.pagerduty.com/docs/migrate-to-event-orchestration" * rel="noopener noreferrer" * target="_blank" * >migrate to Event Orchestration</a> * as soon as possible so you can take advantage of the new functionality, such * as improved UI, rule creation, REST APIs and Terraform support, advanced * conditions, and rule nesting. * </p> * </div> * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pagerduty from "@pulumi/pagerduty"; * import * as time from "@pulumiverse/time"; * * const foo = new pagerduty.Team("foo", {name: "Engineering (Seattle)"}); * const fooRuleset = new pagerduty.Ruleset("foo", { * name: "Primary Ruleset", * team: { * id: foo.id, * }, * }); * // The pagerduty_ruleset_rule.foo rule defined below * // repeats daily from 9:30am - 11:30am using the America/New_York timezone. * // Thus it requires a time_static instance to represent 9:30am on an arbitrary date in that timezone. * // April 11th, 2019 was EDT (UTC-4) https://www.timeanddate.com/worldclock/converter.html?iso=20190411T133000&p1=179 * const easternTimeAt0930 = new time.Static("eastern_time_at_0930", {rfc3339: "2019-04-11T09:30:00-04:00"}); * const fooRulesetRule = new pagerduty.RulesetRule("foo", { * ruleset: fooRuleset.id, * position: 0, * disabled: false, * timeFrame: { * scheduledWeeklies: [{ * weekdays: [ * 2, * 4, * 6, * ], * startTime: easternTimeAt0930.unix.apply(unix => unix * 1000), * duration: 2 * 60 * 60 * 1000, * timezone: "America/New_York", * }], * }, * conditions: { * operator: "and", * subconditions: [ * { * operator: "contains", * parameters: [{ * value: "disk space", * path: "payload.summary", * }], * }, * { * operator: "contains", * parameters: [{ * value: "db", * path: "payload.source", * }], * }, * ], * }, * variables: [{ * type: "regex", * name: "Src", * parameters: [{ * value: "(.*)", * path: "payload.source", * }], * }], * actions: { * routes: [{ * value: fooPagerdutyService.id, * }], * severities: [{ * value: "warning", * }], * annotates: [{ * value: "From Terraform", * }], * extractions: [ * { * target: "dedup_key", * source: "details.host", * regex: "(.*)", * }, * { * target: "summary", * template: "Warning: Disk Space Low on {{Src}}", * }, * ], * }, * }); * const catchAll = new pagerduty.RulesetRule("catch_all", { * ruleset: fooRuleset.id, * position: 1, * catchAll: true, * actions: { * annotates: [{ * value: "From Terraform", * }], * suppresses: [{ * value: true, * }], * }, * }); * ``` * * ## Import * * Ruleset rules can be imported using the related `ruleset` ID and the `rulesetRule` ID separated by a dot, e.g. * * ```sh * $ pulumi import pagerduty:index/rulesetRule:RulesetRule main a19cdca1-3d5e-4b52-bfea-8c8de04da243.19acac92-027a-4ea0-b06c-bbf516519601 * ``` */ class RulesetRule extends pulumi.CustomResource { /** * Get an existing RulesetRule 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 RulesetRule(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'pagerduty:index/rulesetRule:RulesetRule'; /** * Returns true if the given object is an instance of RulesetRule. 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'] === RulesetRule.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["actions"] = state?.actions; resourceInputs["catchAll"] = state?.catchAll; resourceInputs["conditions"] = state?.conditions; resourceInputs["disabled"] = state?.disabled; resourceInputs["position"] = state?.position; resourceInputs["ruleset"] = state?.ruleset; resourceInputs["timeFrame"] = state?.timeFrame; resourceInputs["variables"] = state?.variables; } else { const args = argsOrState; if (args?.ruleset === undefined && !opts.urn) { throw new Error("Missing required property 'ruleset'"); } resourceInputs["actions"] = args?.actions; resourceInputs["catchAll"] = args?.catchAll; resourceInputs["conditions"] = args?.conditions; resourceInputs["disabled"] = args?.disabled; resourceInputs["position"] = args?.position; resourceInputs["ruleset"] = args?.ruleset; resourceInputs["timeFrame"] = args?.timeFrame; resourceInputs["variables"] = args?.variables; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(RulesetRule.__pulumiType, name, resourceInputs, opts); } } exports.RulesetRule = RulesetRule; //# sourceMappingURL=rulesetRule.js.map