@pulumi/pagerduty
Version:
A Pulumi package for creating and managing pagerduty cloud resources.
183 lines • 5.89 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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = 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, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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 ? state.actionJson : undefined;
resourceInputs["advancedConditionJson"] = state ? state.advancedConditionJson : undefined;
resourceInputs["catchAll"] = state ? state.catchAll : undefined;
resourceInputs["conditionJson"] = state ? state.conditionJson : undefined;
}
else {
const args = argsOrState;
if ((!args || args.actionJson === undefined) && !opts.urn) {
throw new Error("Missing required property 'actionJson'");
}
if ((!args || args.conditionJson === undefined) && !opts.urn) {
throw new Error("Missing required property 'conditionJson'");
}
resourceInputs["actionJson"] = args ? args.actionJson : undefined;
resourceInputs["advancedConditionJson"] = args ? args.advancedConditionJson : undefined;
resourceInputs["conditionJson"] = args ? args.conditionJson : undefined;
resourceInputs["catchAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(EventRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.EventRule = EventRule;
/** @internal */
EventRule.__pulumiType = 'pagerduty:index/eventRule:EventRule';
//# sourceMappingURL=eventRule.js.map