UNPKG

@pulumi/opsgenie

Version:

A Pulumi package for creating and managing opsgenie cloud resources.

223 lines 7.79 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.IntegrationAction = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Manages advanced actions for Integrations within Opsgenie. This applies for the following resources: * * `opsgenie.ApiIntegration` * * `opsgenie.EmailIntegration` * * The actions that are supported are: * * `create` * * `close` * * `acknowledge` * * `addNote` * * `ignore` * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as opsgenie from "@pulumi/opsgenie"; * import * as std from "@pulumi/std"; * * const testAction = new opsgenie.IntegrationAction("test_action", { * integrationId: testOpsgenieApiIntegration.id, * creates: [ * { * name: "create action", * tags: [ * "CRITICAL", * "SEV-0", * ], * user: "Example-service", * note: "{{note}}", * alias: "{{alias}}", * source: "{{source}}", * message: "{{message}}", * description: "{{description}}", * entity: "{{entity}}", * alertActions: ["Runbook ID#342"], * filters: [{ * type: "match-all-conditions", * conditions: [{ * field: "priority", * operation: "equals", * expectedValue: "P1", * }], * }], * responders: [{ * id: test.id, * type: "team", * }], * }, * { * name: "create action with multiline description", * message: "{{message}}", * description: std.chomp({ * input: `This * is a multiline * description. * `, * }).then(invoke => invoke.result), * filters: [{ * type: "match-all-conditions", * conditions: [{ * field: "priority", * operation: "equals", * expectedValue: "P1", * }], * }], * }, * { * name: "Create medium priority alerts", * tags: [ * "SEVERE", * "SEV-1", * ], * priority: "P3", * filters: [{ * type: "match-all-conditions", * conditions: [{ * field: "priority", * operation: "equals", * expectedValue: "P2", * }], * }], * }, * { * name: "Create alert with priority from message", * customPriority: "{{message.substringAfter(\"[custom]\")}}", * filters: [{ * type: "match-all-conditions", * conditions: [ * { * field: "tags", * operation: "contains", * expectedValue: "P5", * }, * { * field: "message", * operation: "starts-with", * expectedValue: "[custom]", * }, * ], * }], * }, * ], * closes: [{ * name: "Low priority alerts", * filters: [{ * type: "match-any-condition", * conditions: [ * { * field: "priority", * operation: "equals", * expectedValue: "P5", * }, * { * field: "message", * operation: "contains", * expectedValue: "DEBUG", * }, * ], * }], * }], * acknowledges: [{ * name: "Auto-ack test alerts", * filters: [{ * type: "match-all-conditions", * conditions: [ * { * field: "message", * not: true, * operation: "contains", * expectedValue: "TEST", * }, * { * field: "priority", * operation: "equals", * expectedValue: "P5", * }, * ], * }], * }], * addNotes: [{ * name: "Add note to all alerts", * note: "Created from test integration", * filters: [{ * type: "match-all", * }], * }], * ignores: [{ * name: "Ignore alerts with ignore tag", * filters: [{ * type: "match-all-conditions", * conditions: [{ * field: "tags", * operation: "contains", * expectedValue: "ignore", * }], * }], * }], * }); * ``` */ class IntegrationAction extends pulumi.CustomResource { /** * Get an existing IntegrationAction 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 IntegrationAction(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of IntegrationAction. 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'] === IntegrationAction.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["acknowledges"] = state?.acknowledges; resourceInputs["addNotes"] = state?.addNotes; resourceInputs["closes"] = state?.closes; resourceInputs["creates"] = state?.creates; resourceInputs["ignores"] = state?.ignores; resourceInputs["integrationId"] = state?.integrationId; } else { const args = argsOrState; if (args?.integrationId === undefined && !opts.urn) { throw new Error("Missing required property 'integrationId'"); } resourceInputs["acknowledges"] = args?.acknowledges; resourceInputs["addNotes"] = args?.addNotes; resourceInputs["closes"] = args?.closes; resourceInputs["creates"] = args?.creates; resourceInputs["ignores"] = args?.ignores; resourceInputs["integrationId"] = args?.integrationId; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(IntegrationAction.__pulumiType, name, resourceInputs, opts); } } exports.IntegrationAction = IntegrationAction; /** @internal */ IntegrationAction.__pulumiType = 'opsgenie:index/integrationAction:IntegrationAction'; //# sourceMappingURL=integrationAction.js.map