@pulumi/pagerduty
Version:
A Pulumi package for creating and managing pagerduty cloud resources.
130 lines • 6.41 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.SlackConnection = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* A [slack connection](https://developer.pagerduty.com/api-reference/YXBpOjExMjA5NTQ0-pager-duty-slack-integration-api) allows you to connect a workspace in Slack to a PagerDuty service or team which allows you to acknowledge and resolve PagerDuty incidents from the Slack user interface.
*
* **NOTES for using this resource:**
* * To first use this resource you will need to [map your PagerDuty account to a valid Slack Workspace](https://support.pagerduty.com/docs/slack-integration-guide#integration-walkthrough). *This can only be done through the PagerDuty UI.*
* * This resource requires a PagerDuty [user-level API key](https://support.pagerduty.com/docs/generating-api-keys#section-generating-a-personal-rest-api-key). This can be set as the `userToken` on the provider tag or as the `PAGERDUTY_USER_TOKEN` environment variable.
* * This resource is for configuring Slack V2 Next Generation connections. If you configured your Slack integration (V1 or V2) prior to August 10, 2021, you may migrate to the Slack V2 Next Generation update using this [migration instructions](https://support.pagerduty.com/docs/slack-integration-guide#migrate-to-slack-v2-next-generation), but if you configured your Slack integration after that date, you will have access to the update out of the box.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pagerduty from "@pulumi/pagerduty";
*
* const foo = new pagerduty.Team("foo", {name: "Team Foo"});
* const p1 = pagerduty.getPriority({
* name: "P1",
* });
* const fooSlackConnection = new pagerduty.SlackConnection("foo", {
* sourceId: foo.id,
* sourceType: "team_reference",
* workspaceId: "T02A123LV1A",
* channelId: "C02CABCDAC9",
* notificationType: "responder",
* configs: [{
* events: [
* "incident.triggered",
* "incident.acknowledged",
* "incident.escalated",
* "incident.resolved",
* "incident.reassigned",
* "incident.annotated",
* "incident.unacknowledged",
* "incident.delegated",
* "incident.priority_updated",
* "incident.responder.added",
* "incident.responder.replied",
* "incident.status_update_published",
* "incident.reopened",
* ],
* priorities: [p1.then(p1 => p1.id)],
* }],
* });
* ```
*
* ## Import
*
* Slack connections can be imported using the related `workspace` ID and the `slack_connection` ID separated by a dot, e.g.
*
* ```sh
* $ pulumi import pagerduty:index/slackConnection:SlackConnection main T02A123LV1A.PUABCDL
* ```
*/
class SlackConnection extends pulumi.CustomResource {
/**
* Get an existing SlackConnection 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 SlackConnection(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of SlackConnection. 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'] === SlackConnection.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["channelId"] = state?.channelId;
resourceInputs["channelName"] = state?.channelName;
resourceInputs["configs"] = state?.configs;
resourceInputs["notificationType"] = state?.notificationType;
resourceInputs["sourceId"] = state?.sourceId;
resourceInputs["sourceName"] = state?.sourceName;
resourceInputs["sourceType"] = state?.sourceType;
resourceInputs["workspaceId"] = state?.workspaceId;
}
else {
const args = argsOrState;
if (args?.channelId === undefined && !opts.urn) {
throw new Error("Missing required property 'channelId'");
}
if (args?.configs === undefined && !opts.urn) {
throw new Error("Missing required property 'configs'");
}
if (args?.notificationType === undefined && !opts.urn) {
throw new Error("Missing required property 'notificationType'");
}
if (args?.sourceId === undefined && !opts.urn) {
throw new Error("Missing required property 'sourceId'");
}
if (args?.sourceType === undefined && !opts.urn) {
throw new Error("Missing required property 'sourceType'");
}
resourceInputs["channelId"] = args?.channelId;
resourceInputs["configs"] = args?.configs;
resourceInputs["notificationType"] = args?.notificationType;
resourceInputs["sourceId"] = args?.sourceId;
resourceInputs["sourceType"] = args?.sourceType;
resourceInputs["workspaceId"] = args?.workspaceId;
resourceInputs["channelName"] = undefined /*out*/;
resourceInputs["sourceName"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(SlackConnection.__pulumiType, name, resourceInputs, opts);
}
}
exports.SlackConnection = SlackConnection;
/** @internal */
SlackConnection.__pulumiType = 'pagerduty:index/slackConnection:SlackConnection';
//# sourceMappingURL=slackConnection.js.map