UNPKG

@pulumi/pagerduty

Version:

A Pulumi package for creating and managing pagerduty cloud resources.

116 lines 4.91 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.AlertGroupingSetting = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = 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. * * ## 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. * * Since the `alertGroupingParameters` field creates an Alert Grouping Setting * behind the scenes, it is necessary to import them if you want to keep your * configuration the same as it is right now. * * **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: * ## 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, Object.assign(Object.assign({}, opts), { id: id })); } /** * 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 ? state.config : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["services"] = state ? state.services : undefined; resourceInputs["type"] = state ? state.type : undefined; } else { const args = argsOrState; if ((!args || args.services === undefined) && !opts.urn) { throw new Error("Missing required property 'services'"); } if ((!args || args.type === undefined) && !opts.urn) { throw new Error("Missing required property 'type'"); } resourceInputs["config"] = args ? args.config : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["services"] = args ? args.services : undefined; resourceInputs["type"] = args ? args.type : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(AlertGroupingSetting.__pulumiType, name, resourceInputs, opts); } } exports.AlertGroupingSetting = AlertGroupingSetting; /** @internal */ AlertGroupingSetting.__pulumiType = 'pagerduty:index/alertGroupingSetting:AlertGroupingSetting'; //# sourceMappingURL=alertGroupingSetting.js.map