@pulumi/pagerduty
Version:
A Pulumi package for creating and managing pagerduty cloud resources.
147 lines • 5.21 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.ServiceEventRule = 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";
*
* 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 `service_event_rule` 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 });
}
/**
* 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;
/** @internal */
ServiceEventRule.__pulumiType = 'pagerduty:index/serviceEventRule:ServiceEventRule';
//# sourceMappingURL=serviceEventRule.js.map