@pulumi/pagerduty
Version:
A Pulumi package for creating and managing pagerduty cloud resources.
181 lines • 6.76 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.AlertGroupingSetting = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("./utilities"));
/**
* An [alert grouping setting](https://developer.pagerduty.com/api-reference/587edbc8ff416-create-an-alert-grouping-setting)
* stores and centralize the configuration used during grouping of the alerts.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pagerduty from "@pulumi/pagerduty";
*
* const _default = pagerduty.getEscalationPolicy({
* name: "Default",
* });
* const basic = new pagerduty.Service("basic", {
* name: "Example",
* escalationPolicy: _default.then(_default => _default.id),
* });
* const basicSettings = new pagerduty.AlertGroupingSetting("basic_settings", {
* name: "Configuration for type-1 devices",
* type: "content_based",
* services: [basic.id],
* config: {
* timeWindow: 300,
* aggregate: "all",
* fields: ["fields"],
* },
* });
* ```
*
* ## Migration from `alertGroupingParameters`
*
* To migrate from using the field `alertGroupingParameters` of a
* service
* to a `pagerduty.AlertGroupingSetting` resource, you can cut-and-paste the
* contents of an `alertGroupingParameters` field from a `pagerduty.Service`
* resource into the new resource, but you also need to add at least one value in
* the field `services` to create the alert grouping setting with a service
* associated to it.
*
* If you are using `timeout = 0` or `timeWindow = 0` in order to use the values
* recommended by PagerDuty you also need to set its value to null or delete it,
* since a value of `0` is no longer accepted.
*
* **Example**:
*
* Before:
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pagerduty from "@pulumi/pagerduty";
*
* const _default = pagerduty.getEscalationPolicy({
* name: "Default",
* });
* const foo = new pagerduty.Service("foo", {
* name: "Foo",
* escalationPolicy: _default.then(_default => _default.id),
* alertGroupingParameters: {
* type: "time",
* config: {
* timeout: 0,
* },
* },
* });
* ```
*
* After:
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pagerduty from "@pulumi/pagerduty";
*
* const _default = pagerduty.getEscalationPolicy({
* name: "Default",
* });
* const foo = new pagerduty.Service("foo", {
* name: "Foo",
* escalationPolicy: _default.then(_default => _default.id),
* });
* const fooAlert = new pagerduty.AlertGroupingSetting("foo_alert", {
* name: "Alert Grouping for Foo-like services",
* type: "time",
* config: {
* time: null,
* },
* services: [foo.id],
* });
* ```
*
* ## Import
*
* Alert grouping settings can be imported using its `id`, e.g.
*
* ```sh
* $ pulumi import pagerduty:index/alertGroupingSetting:AlertGroupingSetting example P3DH5M6
* ```
*/
class AlertGroupingSetting extends pulumi.CustomResource {
/**
* Get an existing AlertGroupingSetting 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 AlertGroupingSetting(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'pagerduty:index/alertGroupingSetting:AlertGroupingSetting';
/**
* Returns true if the given object is an instance of AlertGroupingSetting. 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'] === AlertGroupingSetting.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["config"] = state?.config;
resourceInputs["description"] = state?.description;
resourceInputs["name"] = state?.name;
resourceInputs["services"] = state?.services;
resourceInputs["type"] = state?.type;
}
else {
const args = argsOrState;
if (args?.services === undefined && !opts.urn) {
throw new Error("Missing required property 'services'");
}
if (args?.type === undefined && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["config"] = args?.config;
resourceInputs["description"] = args?.description;
resourceInputs["name"] = args?.name;
resourceInputs["services"] = args?.services;
resourceInputs["type"] = args?.type;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AlertGroupingSetting.__pulumiType, name, resourceInputs, opts);
}
}
exports.AlertGroupingSetting = AlertGroupingSetting;
//# sourceMappingURL=alertGroupingSetting.js.map