@pulumi/pagerduty
Version:
A Pulumi package for creating and managing pagerduty cloud resources.
187 lines • 7.11 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! ***
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.ServiceEventRule = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("./utilities"));
/**
* A [service event rule](https://support.pagerduty.com/docs/rulesets#service-event-rules) allows you to set actions that should be taken on events for a service that meet the 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";
*
* const example = new pagerduty.Service("example", {
* name: "Checkout API Service",
* autoResolveTimeout: "14400",
* acknowledgementTimeout: "600",
* escalationPolicy: examplePagerdutyEscalationPolicy.id,
* alertCreation: "create_alerts_and_incidents",
* });
* const foo = new pagerduty.ServiceEventRule("foo", {
* service: example.id,
* position: 0,
* disabled: true,
* conditions: {
* operator: "and",
* subconditions: [{
* operator: "contains",
* parameters: [{
* value: "disk space",
* path: "summary",
* }],
* }],
* },
* variables: [{
* type: "regex",
* name: "Src",
* parameters: [{
* value: "(.*)",
* path: "source",
* }],
* }],
* actions: {
* annotates: [{
* value: "From Terraform",
* }],
* extractions: [
* {
* target: "dedup_key",
* source: "source",
* regex: "(.*)",
* },
* {
* target: "summary",
* template: "Warning: Disk Space Low on {{Src}}",
* },
* ],
* },
* });
* const bar = new pagerduty.ServiceEventRule("bar", {
* service: fooPagerdutyService.id,
* position: 1,
* disabled: true,
* conditions: {
* operator: "and",
* subconditions: [{
* operator: "contains",
* parameters: [{
* value: "cpu spike",
* path: "summary",
* }],
* }],
* },
* actions: {
* annotates: [{
* value: "From Terraform",
* }],
* },
* });
* ```
*
* ## Import
*
* Service event rules can be imported using using the related `service` id and the `serviceEventRule` id separated by a dot, e.g.
*
* ```sh
* $ pulumi import pagerduty:index/serviceEventRule:ServiceEventRule main a19cdca1-3d5e-4b52-bfea-8c8de04da243.19acac92-027a-4ea0-b06c-bbf516519601
* ```
*/
class ServiceEventRule extends pulumi.CustomResource {
/**
* Get an existing ServiceEventRule 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 ServiceEventRule(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'pagerduty:index/serviceEventRule:ServiceEventRule';
/**
* Returns true if the given object is an instance of ServiceEventRule. 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'] === ServiceEventRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["actions"] = state?.actions;
resourceInputs["conditions"] = state?.conditions;
resourceInputs["disabled"] = state?.disabled;
resourceInputs["position"] = state?.position;
resourceInputs["service"] = state?.service;
resourceInputs["timeFrame"] = state?.timeFrame;
resourceInputs["variables"] = state?.variables;
}
else {
const args = argsOrState;
if (args?.service === undefined && !opts.urn) {
throw new Error("Missing required property 'service'");
}
resourceInputs["actions"] = args?.actions;
resourceInputs["conditions"] = args?.conditions;
resourceInputs["disabled"] = args?.disabled;
resourceInputs["position"] = args?.position;
resourceInputs["service"] = args?.service;
resourceInputs["timeFrame"] = args?.timeFrame;
resourceInputs["variables"] = args?.variables;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ServiceEventRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.ServiceEventRule = ServiceEventRule;
//# sourceMappingURL=serviceEventRule.js.map