@pulumi/opsgenie
Version:
A Pulumi package for creating and managing opsgenie cloud resources.
114 lines • 4.55 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.NotificationRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a Notification Rule within Opsgenie.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as opsgenie from "@pulumi/opsgenie";
*
* const test = new opsgenie.User("test", {
* username: "Example user",
* fullName: "Name Lastname",
* role: "User",
* });
* const testNotificationRule = new opsgenie.NotificationRule("test", {
* name: "Example notification rule",
* username: test.username,
* actionType: "schedule-end",
* notificationTimes: [
* "just-before",
* "15-minutes-ago",
* ],
* steps: [{
* contacts: [{
* method: "email",
* to: "example@user.com",
* }],
* }],
* });
* ```
*
* ## Import
*
* Notification policies can be imported using the `user_id/notification_rule_id`, e.g.
*
* ```sh
* $ pulumi import opsgenie:index/notificationRule:NotificationRule test user_id/notification_rule_id`
* ```
*/
class NotificationRule extends pulumi.CustomResource {
/**
* Get an existing NotificationRule 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 NotificationRule(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of NotificationRule. 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'] === NotificationRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["actionType"] = state?.actionType;
resourceInputs["criterias"] = state?.criterias;
resourceInputs["enabled"] = state?.enabled;
resourceInputs["name"] = state?.name;
resourceInputs["notificationTimes"] = state?.notificationTimes;
resourceInputs["order"] = state?.order;
resourceInputs["repeats"] = state?.repeats;
resourceInputs["schedules"] = state?.schedules;
resourceInputs["steps"] = state?.steps;
resourceInputs["timeRestrictions"] = state?.timeRestrictions;
resourceInputs["username"] = state?.username;
}
else {
const args = argsOrState;
if (args?.actionType === undefined && !opts.urn) {
throw new Error("Missing required property 'actionType'");
}
if (args?.username === undefined && !opts.urn) {
throw new Error("Missing required property 'username'");
}
resourceInputs["actionType"] = args?.actionType;
resourceInputs["criterias"] = args?.criterias;
resourceInputs["enabled"] = args?.enabled;
resourceInputs["name"] = args?.name;
resourceInputs["notificationTimes"] = args?.notificationTimes;
resourceInputs["order"] = args?.order;
resourceInputs["repeats"] = args?.repeats;
resourceInputs["schedules"] = args?.schedules;
resourceInputs["steps"] = args?.steps;
resourceInputs["timeRestrictions"] = args?.timeRestrictions;
resourceInputs["username"] = args?.username;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NotificationRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.NotificationRule = NotificationRule;
/** @internal */
NotificationRule.__pulumiType = 'opsgenie:index/notificationRule:NotificationRule';
//# sourceMappingURL=notificationRule.js.map