UNPKG

@pulumi/opsgenie

Version:

A Pulumi package for creating and managing opsgenie cloud resources.

147 lines 6.89 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.AlertPolicy = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Manages a Alert 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 testAlertPolicy = new opsgenie.AlertPolicy("test", { * filters: [{}], * name: "example policy", * teamId: test.id, * policyDescription: "This is sample policy", * message: "{{message}}", * timeRestrictions: [{ * type: "weekday-and-time-of-day", * restrictionList: [ * { * endDay: "monday", * endHour: 7, * endMin: 0, * startDay: "sunday", * startHour: 21, * startMin: 0, * }, * { * endDay: "tuesday", * endHour: 7, * endMin: 0, * startDay: "monday", * startHour: 22, * startMin: 0, * }, * ], * }], * }); * ``` * * ## Import * * Alert policies can be imported using the `team_id/policy_id`, e.g. * * ```sh * $ pulumi import opsgenie:index/alertPolicy:AlertPolicy test team_id/policy_id` * ``` * * You can import global polices using only policy identifier * * ```sh * $ pulumi import opsgenie:index/alertPolicy:AlertPolicy test policy_id` * ``` */ class AlertPolicy extends pulumi.CustomResource { /** * Get an existing AlertPolicy 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 AlertPolicy(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of AlertPolicy. 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'] === AlertPolicy.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["actions"] = state ? state.actions : undefined; resourceInputs["alertDescription"] = state ? state.alertDescription : undefined; resourceInputs["alias"] = state ? state.alias : undefined; resourceInputs["continuePolicy"] = state ? state.continuePolicy : undefined; resourceInputs["enabled"] = state ? state.enabled : undefined; resourceInputs["entity"] = state ? state.entity : undefined; resourceInputs["filters"] = state ? state.filters : undefined; resourceInputs["ignoreOriginalActions"] = state ? state.ignoreOriginalActions : undefined; resourceInputs["ignoreOriginalDetails"] = state ? state.ignoreOriginalDetails : undefined; resourceInputs["ignoreOriginalResponders"] = state ? state.ignoreOriginalResponders : undefined; resourceInputs["ignoreOriginalTags"] = state ? state.ignoreOriginalTags : undefined; resourceInputs["message"] = state ? state.message : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["policyDescription"] = state ? state.policyDescription : undefined; resourceInputs["priority"] = state ? state.priority : undefined; resourceInputs["responders"] = state ? state.responders : undefined; resourceInputs["source"] = state ? state.source : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["teamId"] = state ? state.teamId : undefined; resourceInputs["timeRestrictions"] = state ? state.timeRestrictions : undefined; } else { const args = argsOrState; if ((!args || args.message === undefined) && !opts.urn) { throw new Error("Missing required property 'message'"); } resourceInputs["actions"] = args ? args.actions : undefined; resourceInputs["alertDescription"] = args ? args.alertDescription : undefined; resourceInputs["alias"] = args ? args.alias : undefined; resourceInputs["continuePolicy"] = args ? args.continuePolicy : undefined; resourceInputs["enabled"] = args ? args.enabled : undefined; resourceInputs["entity"] = args ? args.entity : undefined; resourceInputs["filters"] = args ? args.filters : undefined; resourceInputs["ignoreOriginalActions"] = args ? args.ignoreOriginalActions : undefined; resourceInputs["ignoreOriginalDetails"] = args ? args.ignoreOriginalDetails : undefined; resourceInputs["ignoreOriginalResponders"] = args ? args.ignoreOriginalResponders : undefined; resourceInputs["ignoreOriginalTags"] = args ? args.ignoreOriginalTags : undefined; resourceInputs["message"] = args ? args.message : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["policyDescription"] = args ? args.policyDescription : undefined; resourceInputs["priority"] = args ? args.priority : undefined; resourceInputs["responders"] = args ? args.responders : undefined; resourceInputs["source"] = args ? args.source : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["teamId"] = args ? args.teamId : undefined; resourceInputs["timeRestrictions"] = args ? args.timeRestrictions : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(AlertPolicy.__pulumiType, name, resourceInputs, opts); } } exports.AlertPolicy = AlertPolicy; /** @internal */ AlertPolicy.__pulumiType = 'opsgenie:index/alertPolicy:AlertPolicy'; //# sourceMappingURL=alertPolicy.js.map