UNPKG

@pulumi/opsgenie

Version:

A Pulumi package for creating and managing opsgenie cloud resources.

114 lines 5.01 kB
"use strict"; // *** 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, Object.assign(Object.assign({}, 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 ? state.actionType : undefined; resourceInputs["criterias"] = state ? state.criterias : undefined; resourceInputs["enabled"] = state ? state.enabled : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["notificationTimes"] = state ? state.notificationTimes : undefined; resourceInputs["order"] = state ? state.order : undefined; resourceInputs["repeats"] = state ? state.repeats : undefined; resourceInputs["schedules"] = state ? state.schedules : undefined; resourceInputs["steps"] = state ? state.steps : undefined; resourceInputs["timeRestrictions"] = state ? state.timeRestrictions : undefined; resourceInputs["username"] = state ? state.username : undefined; } else { const args = argsOrState; if ((!args || args.actionType === undefined) && !opts.urn) { throw new Error("Missing required property 'actionType'"); } if ((!args || args.username === undefined) && !opts.urn) { throw new Error("Missing required property 'username'"); } resourceInputs["actionType"] = args ? args.actionType : undefined; resourceInputs["criterias"] = args ? args.criterias : undefined; resourceInputs["enabled"] = args ? args.enabled : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["notificationTimes"] = args ? args.notificationTimes : undefined; resourceInputs["order"] = args ? args.order : undefined; resourceInputs["repeats"] = args ? args.repeats : undefined; resourceInputs["schedules"] = args ? args.schedules : undefined; resourceInputs["steps"] = args ? args.steps : undefined; resourceInputs["timeRestrictions"] = args ? args.timeRestrictions : undefined; resourceInputs["username"] = args ? args.username : undefined; } 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