@pulumi/opsgenie
Version:
A Pulumi package for creating and managing opsgenie cloud resources.
246 lines • 8.85 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.IntegrationAction = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(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 });
}
/** @internal */
static __pulumiType = 'opsgenie:index/integrationAction:IntegrationAction';
/**
* 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;
//# sourceMappingURL=integrationAction.js.map