UNPKG

@pulumi/pagerduty

Version:

A Pulumi package for creating and managing pagerduty cloud resources.

175 lines 6.29 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.RulesetRule = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * ## 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 `ruleset_rule` 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 }); } /** * 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; /** @internal */ RulesetRule.__pulumiType = 'pagerduty:index/rulesetRule:RulesetRule'; //# sourceMappingURL=rulesetRule.js.map