@pulumi/opsgenie
Version:
A Pulumi package for creating and managing opsgenie cloud resources.
109 lines • 5.1 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, Object.assign(Object.assign({}, 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 ? state.autoCloseActions : undefined;
resourceInputs["autoRestartActions"] = state ? state.autoRestartActions : undefined;
resourceInputs["deDuplicationActions"] = state ? state.deDuplicationActions : undefined;
resourceInputs["delayActions"] = state ? state.delayActions : undefined;
resourceInputs["enabled"] = state ? state.enabled : undefined;
resourceInputs["filters"] = state ? state.filters : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["policyDescription"] = state ? state.policyDescription : undefined;
resourceInputs["suppress"] = state ? state.suppress : undefined;
resourceInputs["teamId"] = state ? state.teamId : undefined;
resourceInputs["timeRestrictions"] = state ? state.timeRestrictions : undefined;
}
else {
const args = argsOrState;
if ((!args || args.filters === undefined) && !opts.urn) {
throw new Error("Missing required property 'filters'");
}
if ((!args || args.teamId === undefined) && !opts.urn) {
throw new Error("Missing required property 'teamId'");
}
resourceInputs["autoCloseActions"] = args ? args.autoCloseActions : undefined;
resourceInputs["autoRestartActions"] = args ? args.autoRestartActions : undefined;
resourceInputs["deDuplicationActions"] = args ? args.deDuplicationActions : undefined;
resourceInputs["delayActions"] = args ? args.delayActions : undefined;
resourceInputs["enabled"] = args ? args.enabled : undefined;
resourceInputs["filters"] = args ? args.filters : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["policyDescription"] = args ? args.policyDescription : undefined;
resourceInputs["suppress"] = args ? args.suppress : undefined;
resourceInputs["teamId"] = args ? args.teamId : undefined;
resourceInputs["timeRestrictions"] = args ? args.timeRestrictions : undefined;
}
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