@pulumi/opsgenie
Version:
A Pulumi package for creating and managing opsgenie cloud resources.
109 lines • 4.64 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.NotificationPolicy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a Notification Policy within Opsgenie.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as opsgenie from "@pulumi/opsgenie";
*
* const test = new opsgenie.Team("test", {
* name: "example team",
* description: "This team deals with all the things",
* });
* const testNotificationPolicy = new opsgenie.NotificationPolicy("test", {
* filters: [{}],
* name: "example policy",
* teamId: test.id,
* policyDescription: "This policy has a delay action",
* delayActions: [{
* delayOption: "next-time",
* untilMinute: 1,
* untilHour: 9,
* }],
* });
* ```
*
* ## Import
*
* Notification policies can be imported using the `team_id` and `notification_policy_id`, e.g.
*
* ```sh
* $ pulumi import opsgenie:index/notificationPolicy:NotificationPolicy test team_id/notification_policy_id`
* ```
*/
class NotificationPolicy extends pulumi.CustomResource {
/**
* Get an existing NotificationPolicy 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 NotificationPolicy(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of NotificationPolicy. 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'] === NotificationPolicy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["autoCloseActions"] = state?.autoCloseActions;
resourceInputs["autoRestartActions"] = state?.autoRestartActions;
resourceInputs["deDuplicationActions"] = state?.deDuplicationActions;
resourceInputs["delayActions"] = state?.delayActions;
resourceInputs["enabled"] = state?.enabled;
resourceInputs["filters"] = state?.filters;
resourceInputs["name"] = state?.name;
resourceInputs["policyDescription"] = state?.policyDescription;
resourceInputs["suppress"] = state?.suppress;
resourceInputs["teamId"] = state?.teamId;
resourceInputs["timeRestrictions"] = state?.timeRestrictions;
}
else {
const args = argsOrState;
if (args?.filters === undefined && !opts.urn) {
throw new Error("Missing required property 'filters'");
}
if (args?.teamId === undefined && !opts.urn) {
throw new Error("Missing required property 'teamId'");
}
resourceInputs["autoCloseActions"] = args?.autoCloseActions;
resourceInputs["autoRestartActions"] = args?.autoRestartActions;
resourceInputs["deDuplicationActions"] = args?.deDuplicationActions;
resourceInputs["delayActions"] = args?.delayActions;
resourceInputs["enabled"] = args?.enabled;
resourceInputs["filters"] = args?.filters;
resourceInputs["name"] = args?.name;
resourceInputs["policyDescription"] = args?.policyDescription;
resourceInputs["suppress"] = args?.suppress;
resourceInputs["teamId"] = args?.teamId;
resourceInputs["timeRestrictions"] = args?.timeRestrictions;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NotificationPolicy.__pulumiType, name, resourceInputs, opts);
}
}
exports.NotificationPolicy = NotificationPolicy;
/** @internal */
NotificationPolicy.__pulumiType = 'opsgenie:index/notificationPolicy:NotificationPolicy';
//# sourceMappingURL=notificationPolicy.js.map