@pulumi/pagerduty
Version:
A Pulumi package for creating and managing pagerduty cloud resources.
213 lines • 8.37 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.ServiceIntegration = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* A [service integration](https://developer.pagerduty.com/api-reference/reference/REST/openapiv3.json/paths/~1services~1%7Bid%7D~1integrations/post) is an integration that belongs to a service.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pagerduty from "@pulumi/pagerduty";
*
* const example = new pagerduty.User("example", {
* name: "Earline Greenholt",
* email: "125.greenholt.earline@graham.name",
* teams: [examplePagerdutyTeam.id],
* });
* const foo = new pagerduty.EscalationPolicy("foo", {
* name: "Engineering Escalation Policy",
* numLoops: 2,
* rules: [{
* escalationDelayInMinutes: 10,
* targets: [{
* type: "user",
* id: example.id,
* }],
* }],
* });
* const exampleService = new pagerduty.Service("example", {
* name: "My Web App",
* autoResolveTimeout: "14400",
* acknowledgementTimeout: "600",
* escalationPolicy: examplePagerdutyEscalationPolicy.id,
* });
* const exampleServiceIntegration = new pagerduty.ServiceIntegration("example", {
* name: "Generic API Service Integration",
* type: "generic_events_api_inbound_integration",
* service: exampleService.id,
* });
* const apiv2 = new pagerduty.ServiceIntegration("apiv2", {
* name: "API V2",
* type: "events_api_v2_inbound_integration",
* service: exampleService.id,
* });
* const emailX = new pagerduty.ServiceIntegration("email_x", {
* name: "Email X",
* type: "generic_email_inbound_integration",
* integrationEmail: "ecommerce@subdomain.pagerduty.com",
* service: exampleService.id,
* });
* const datadog = pagerduty.getVendor({
* name: "Datadog",
* });
* const datadogServiceIntegration = new pagerduty.ServiceIntegration("datadog", {
* name: datadog.then(datadog => datadog.name),
* service: exampleService.id,
* vendor: datadog.then(datadog => datadog.id),
* });
* const cloudwatch = pagerduty.getVendor({
* name: "Cloudwatch",
* });
* const cloudwatchServiceIntegration = new pagerduty.ServiceIntegration("cloudwatch", {
* name: cloudwatch.then(cloudwatch => cloudwatch.name),
* service: exampleService.id,
* vendor: cloudwatch.then(cloudwatch => cloudwatch.id),
* });
* const email = pagerduty.getVendor({
* name: "Email",
* });
* const emailServiceIntegration = new pagerduty.ServiceIntegration("email", {
* name: email.then(email => email.name),
* service: exampleService.id,
* vendor: email.then(email => email.id),
* integrationEmail: "s1@your_account.pagerduty.com",
* emailIncidentCreation: "use_rules",
* emailFilterMode: "and-rules-email",
* emailFilters: [
* {
* bodyMode: "always",
* bodyRegex: null,
* fromEmailMode: "match",
* fromEmailRegex: "(@foo.test*)",
* subjectMode: "match",
* subjectRegex: "(CRITICAL*)",
* },
* {
* bodyMode: "always",
* bodyRegex: null,
* fromEmailMode: "match",
* fromEmailRegex: "(@bar.com*)",
* subjectMode: "match",
* subjectRegex: "(CRITICAL*)",
* },
* ],
* emailParsers: [{
* action: "resolve",
* matchPredicate: {
* type: "any",
* predicates: [
* {
* matcher: "foo",
* part: "subject",
* type: "contains",
* },
* {
* type: "not",
* predicates: [{
* matcher: "(bar*)",
* part: "body",
* type: "regex",
* }],
* },
* ],
* },
* valueExtractors: [
* {
* endsBefore: "end",
* part: "subject",
* startsAfter: "start",
* type: "between",
* valueName: "incident_key",
* },
* {
* endsBefore: "end",
* part: "subject",
* startsAfter: "start",
* type: "between",
* valueName: "FieldName1",
* },
* ],
* }],
* });
* ```
*
* ## Import
*
* Services can be imported using their related `service` id and service integration `id` separated by a dot, e.g.
*
* ```sh
* $ pulumi import pagerduty:index/serviceIntegration:ServiceIntegration main PLSSSSS.PLIIIII
* ```
*/
class ServiceIntegration extends pulumi.CustomResource {
/**
* Get an existing ServiceIntegration 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 ServiceIntegration(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of ServiceIntegration. 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'] === ServiceIntegration.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["emailFilterMode"] = state?.emailFilterMode;
resourceInputs["emailFilters"] = state?.emailFilters;
resourceInputs["emailIncidentCreation"] = state?.emailIncidentCreation;
resourceInputs["emailParsers"] = state?.emailParsers;
resourceInputs["emailParsingFallback"] = state?.emailParsingFallback;
resourceInputs["htmlUrl"] = state?.htmlUrl;
resourceInputs["integrationEmail"] = state?.integrationEmail;
resourceInputs["integrationKey"] = state?.integrationKey;
resourceInputs["name"] = state?.name;
resourceInputs["service"] = state?.service;
resourceInputs["type"] = state?.type;
resourceInputs["vendor"] = state?.vendor;
}
else {
const args = argsOrState;
if (args?.service === undefined && !opts.urn) {
throw new Error("Missing required property 'service'");
}
resourceInputs["emailFilterMode"] = args?.emailFilterMode;
resourceInputs["emailFilters"] = args?.emailFilters;
resourceInputs["emailIncidentCreation"] = args?.emailIncidentCreation;
resourceInputs["emailParsers"] = args?.emailParsers;
resourceInputs["emailParsingFallback"] = args?.emailParsingFallback;
resourceInputs["integrationEmail"] = args?.integrationEmail;
resourceInputs["integrationKey"] = args?.integrationKey;
resourceInputs["name"] = args?.name;
resourceInputs["service"] = args?.service;
resourceInputs["type"] = args?.type;
resourceInputs["vendor"] = args?.vendor;
resourceInputs["htmlUrl"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ServiceIntegration.__pulumiType, name, resourceInputs, opts);
}
}
exports.ServiceIntegration = ServiceIntegration;
/** @internal */
ServiceIntegration.__pulumiType = 'pagerduty:index/serviceIntegration:ServiceIntegration';
//# sourceMappingURL=serviceIntegration.js.map