@pagerduty/backstage-plugin-backend 0.2.1-next.8 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +85 -66
- package/dist/index.cjs.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -31,86 +31,100 @@ async function createService(name, description, escalationPolicyId, alertGroupin
|
|
|
31
31
|
let alertGroupingParameters = "null";
|
|
32
32
|
let response;
|
|
33
33
|
const baseUrl = "https://api.pagerduty.com/services";
|
|
34
|
-
let body
|
|
34
|
+
let body = JSON.stringify({
|
|
35
|
+
service: {
|
|
36
|
+
type: "service",
|
|
37
|
+
name,
|
|
38
|
+
description,
|
|
39
|
+
alert_creation: "create_alerts_and_incidents",
|
|
40
|
+
auto_pause_notifications_parameters: {
|
|
41
|
+
enabled: true,
|
|
42
|
+
timeout: 300
|
|
43
|
+
},
|
|
44
|
+
escalation_policy: {
|
|
45
|
+
id: escalationPolicyId,
|
|
46
|
+
type: "escalation_policy_reference"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
35
50
|
if (await isEventNoiseReductionEnabled() && alertGrouping !== void 0) {
|
|
36
51
|
alertGroupingParameters = alertGrouping;
|
|
37
52
|
switch (alertGroupingParameters) {
|
|
38
53
|
case "intelligent":
|
|
39
54
|
body = JSON.stringify({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
service: {
|
|
56
|
+
type: "service",
|
|
57
|
+
name,
|
|
58
|
+
description,
|
|
59
|
+
escalation_policy: {
|
|
60
|
+
id: escalationPolicyId,
|
|
61
|
+
type: "escalation_policy_reference"
|
|
62
|
+
},
|
|
63
|
+
alert_creation: "create_alerts_and_incidents",
|
|
64
|
+
alert_grouping_parameters: {
|
|
65
|
+
type: alertGroupingParameters
|
|
66
|
+
},
|
|
67
|
+
auto_pause_notifications_parameters: {
|
|
68
|
+
enabled: true,
|
|
69
|
+
timeout: 300
|
|
70
|
+
}
|
|
49
71
|
}
|
|
50
72
|
});
|
|
51
73
|
break;
|
|
52
74
|
case "time":
|
|
53
75
|
body = JSON.stringify({
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
service: {
|
|
77
|
+
type: "service",
|
|
78
|
+
name,
|
|
79
|
+
description,
|
|
80
|
+
escalation_policy: {
|
|
81
|
+
id: escalationPolicyId,
|
|
82
|
+
type: "escalation_policy_reference"
|
|
83
|
+
},
|
|
84
|
+
alert_creation: "create_alerts_and_incidents",
|
|
85
|
+
alert_grouping_parameters: {
|
|
86
|
+
type: alertGroupingParameters,
|
|
87
|
+
config: {
|
|
88
|
+
timeout: 0
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
auto_pause_notifications_parameters: {
|
|
92
|
+
enabled: true,
|
|
93
|
+
timeout: 300
|
|
65
94
|
}
|
|
66
95
|
}
|
|
67
96
|
});
|
|
68
97
|
break;
|
|
69
98
|
case "content_based":
|
|
70
99
|
body = JSON.stringify({
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
100
|
+
service: {
|
|
101
|
+
type: "service",
|
|
102
|
+
name,
|
|
103
|
+
description,
|
|
104
|
+
escalation_policy: {
|
|
105
|
+
id: escalationPolicyId,
|
|
106
|
+
type: "escalation_policy_reference"
|
|
107
|
+
},
|
|
108
|
+
alert_creation: "create_alerts_and_incidents",
|
|
109
|
+
alert_grouping_parameters: {
|
|
110
|
+
type: alertGroupingParameters,
|
|
111
|
+
config: {
|
|
112
|
+
aggregate: "all",
|
|
113
|
+
time_window: 0,
|
|
114
|
+
fields: [
|
|
115
|
+
"source",
|
|
116
|
+
"summary"
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
auto_pause_notifications_parameters: {
|
|
121
|
+
enabled: true,
|
|
122
|
+
timeout: 300
|
|
87
123
|
}
|
|
88
124
|
}
|
|
89
125
|
});
|
|
90
126
|
break;
|
|
91
|
-
default:
|
|
92
|
-
body = JSON.stringify({
|
|
93
|
-
name,
|
|
94
|
-
description,
|
|
95
|
-
escalation_policy: {
|
|
96
|
-
id: escalationPolicyId,
|
|
97
|
-
type: "escalation_policy_reference"
|
|
98
|
-
},
|
|
99
|
-
alert_creation: "create_alerts_and_incidents",
|
|
100
|
-
alert_grouping_parameters: null
|
|
101
|
-
});
|
|
102
|
-
break;
|
|
103
127
|
}
|
|
104
|
-
} else {
|
|
105
|
-
body = JSON.stringify({
|
|
106
|
-
name,
|
|
107
|
-
description,
|
|
108
|
-
escalation_policy: {
|
|
109
|
-
id: escalationPolicyId,
|
|
110
|
-
type: "escalation_policy_reference"
|
|
111
|
-
},
|
|
112
|
-
alert_creation: "create_alerts_and_incidents"
|
|
113
|
-
});
|
|
114
128
|
}
|
|
115
129
|
const options = {
|
|
116
130
|
method: "POST",
|
|
@@ -139,7 +153,12 @@ async function createService(name, description, escalationPolicyId, alertGroupin
|
|
|
139
153
|
let result;
|
|
140
154
|
try {
|
|
141
155
|
result = await response.json();
|
|
142
|
-
|
|
156
|
+
const createServiceResult = {
|
|
157
|
+
url: result.service.htmlUrl,
|
|
158
|
+
id: result.service.id,
|
|
159
|
+
alertGrouping: alertGroupingParameters
|
|
160
|
+
};
|
|
161
|
+
return createServiceResult;
|
|
143
162
|
} catch (error) {
|
|
144
163
|
throw new Error(`Failed to parse service information: ${error}`);
|
|
145
164
|
}
|
|
@@ -265,7 +284,7 @@ async function isEventNoiseReductionEnabled() {
|
|
|
265
284
|
let result;
|
|
266
285
|
try {
|
|
267
286
|
result = await response.json();
|
|
268
|
-
if (result.abilities.includes("
|
|
287
|
+
if (result.abilities.includes("preview_intelligent_alert_grouping") && result.abilities.includes("time_based_alert_grouping")) {
|
|
269
288
|
return true;
|
|
270
289
|
}
|
|
271
290
|
return false;
|
|
@@ -325,18 +344,18 @@ const createPagerDutyServiceAction = () => {
|
|
|
325
344
|
},
|
|
326
345
|
async handler(ctx) {
|
|
327
346
|
try {
|
|
328
|
-
const
|
|
347
|
+
const service = await createService(
|
|
329
348
|
ctx.input.name,
|
|
330
349
|
ctx.input.description,
|
|
331
350
|
ctx.input.escalationPolicyId,
|
|
332
351
|
ctx.input.alertGrouping
|
|
333
352
|
);
|
|
334
353
|
ctx.logger.info(`Service '${ctx.input.name}' created successfully!`);
|
|
335
|
-
ctx.logger.info(`Alert grouping set to '${
|
|
336
|
-
ctx.output("serviceUrl",
|
|
337
|
-
ctx.output("serviceId",
|
|
354
|
+
ctx.logger.info(`Alert grouping set to '${service.alertGrouping}'`);
|
|
355
|
+
ctx.output("serviceUrl", service.url);
|
|
356
|
+
ctx.output("serviceId", service.id);
|
|
338
357
|
const backstageIntegrationId = "PRO19CT";
|
|
339
|
-
const integrationKey = await createServiceIntegration(
|
|
358
|
+
const integrationKey = await createServiceIntegration(service.id, backstageIntegrationId);
|
|
340
359
|
ctx.logger.info(`Backstage Integration for service '${ctx.input.name}' created successfully!`);
|
|
341
360
|
ctx.output("integrationKey", integrationKey);
|
|
342
361
|
} catch (error) {
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/types.ts","../src/apis/pagerduty.ts","../src/service/router.ts","../src/actions/custom.ts"],"sourcesContent":["export type PagerDutyCreateServiceResponse = {\n service: PagerDutyService;\n};\n\nexport type PagerDutyService = {\n id: string;\n name: string;\n description: string;\n escalationPolicy: PagerDutyEscalationPolicy;\n alertCreation: string;\n incidentUrgencyRule: PagerDutyIncidentUrgencyRule;\n integrations: PagerDutyIntegrations[];\n teams: PagerDutyTeam[];\n status: string;\n type: string;\n summary: string;\n self: string;\n htmlUrl: string;\n};\n\nexport type PagerDutyTeam = {\n id: string;\n type: string;\n summary: string;\n self: string;\n htmlUrl: string;\n};\n\nexport type PagerDutyEscalationPolicy = {\n id: string;\n name: string;\n type: string;\n summary: string;\n self: string;\n htmlUrl: string;\n};\n\nexport type PagerDutyIncidentUrgencyRule = {\n type: string;\n urgency: string;\n};\n\nexport type PagerDutyIntegrations = {\n id: string;\n type: string;\n summary: string;\n self: string;\n htmlUrl: string;\n};\n\nexport type PagerDutyCreateIntegrationResponse = {\n integration: PagerDutyIntegration;\n};\n\nexport type PagerDutyIntegration = {\n id: string;\n type: string;\n summary: string;\n self: string;\n htmlUrl: string;\n name: string;\n service: PagerDutyService;\n createdAt: string;\n vendor: PagerDutyVendor;\n integration_key: string;\n};\n\nexport type PagerDutyVendor = {\n id: string;\n type: string;\n summary: string;\n self: string;\n htmlUrl: string;\n};\n\nexport type PagerDutyEscalationPolicyListResponse = {\n escalation_policies: PagerDutyEscalationPolicy[];\n limit: number;\n offset: number;\n more: boolean;\n total: number;\n};\n\nexport type PagerDutyEscalationPolicyDropDownOption = {\n label: string;\n value: string;\n};\n\nexport class HttpError extends Error {\n constructor(message: string, status: number) {\n super(message);\n this.status = status;\n }\n\n status: number;\n}\n\nexport type PagerDutyAbilitiesListResponse = {\n abilities: string[];\n};\n\n\n","import { PagerDutyCreateIntegrationResponse, PagerDutyCreateServiceResponse, PagerDutyEscalationPolicyListResponse, PagerDutyEscalationPolicy, HttpError, PagerDutyAbilitiesListResponse } from \"../types\";\n\n// Supporting custom actions\n\nexport async function createService(name: string, description: string, escalationPolicyId: string, alertGrouping?: string): Promise<[string, string, string]> {\n // Validate alert grouping parameters\n let alertGroupingParameters = \"null\";\n\n let response: Response;\n const baseUrl = 'https://api.pagerduty.com/services';\n let body;\n\n if (await isEventNoiseReductionEnabled() && alertGrouping !== undefined) {\n alertGroupingParameters = alertGrouping;\n\n switch (alertGroupingParameters) {\n case \"intelligent\":\n body = JSON.stringify({\n name: name,\n description: description,\n escalation_policy: {\n id: escalationPolicyId,\n type: 'escalation_policy_reference',\n },\n alert_creation: 'create_alerts_and_incidents',\n alert_grouping_parameters: {\n type: 'intelligent'\n }\n });\n break;\n case \"time\":\n body = JSON.stringify({\n name: name,\n description: description,\n escalation_policy: {\n id: escalationPolicyId,\n type: 'escalation_policy_reference',\n },\n alert_creation: 'create_alerts_and_incidents',\n alert_grouping_parameters: {\n type: 'time',\n config: {\n timeout: 0\n }\n }\n });\n break;\n case \"content_based\":\n body = JSON.stringify({\n name: name,\n description: description,\n escalation_policy: {\n id: escalationPolicyId,\n type: 'escalation_policy_reference',\n },\n alert_creation: 'create_alerts_and_incidents',\n alert_grouping_parameters: {\n type: 'content_based',\n config: {\n aggregate: \"all\",\n time_window: 0,\n fields: [\n \"source\",\n \"summary\"\n ]\n }\n }\n });\n break;\n default:\n body = JSON.stringify({\n name: name,\n description: description,\n escalation_policy: {\n id: escalationPolicyId,\n type: 'escalation_policy_reference',\n },\n alert_creation: 'create_alerts_and_incidents',\n alert_grouping_parameters: null\n });\n break;\n }\n \n } else {\n body = JSON.stringify({\n name: name,\n description: description,\n escalation_policy: {\n id: escalationPolicyId,\n type: 'escalation_policy_reference',\n },\n alert_creation: 'create_alerts_and_incidents',\n });\n }\n\n const options: RequestInit = {\n method: 'POST',\n body,\n headers: {\n Authorization: `Token token=${process.env.PAGERDUTY_TOKEN}`,\n 'Accept': 'application/vnd.pagerduty+json;version=2',\n 'Content-Type': 'application/json',\n },\n };\n\n try {\n response = await fetch(baseUrl, options);\n } catch (error) {\n throw new Error(`Failed to create service: ${error}`);\n }\n\n switch (response.status) {\n case 400:\n throw new Error(`Failed to create service. Caller provided invalid arguments.`);\n case 401:\n throw new Error(`Failed to create service. Caller did not supply credentials or did not provide the correct credentials.`);\n case 402:\n throw new Error(`Failed to create service. Account does not have the abilities to perform the action.`);\n case 403:\n throw new Error(`Failed to create service. Caller is not authorized to view the requested resource.`);\n default: // 201\n break;\n }\n\n let result: PagerDutyCreateServiceResponse;\n try {\n result = await response.json();\n\n return [result.service.id, result.service.htmlUrl, alertGroupingParameters];\n } catch (error) {\n throw new Error(`Failed to parse service information: ${error}`);\n }\n}\n\nexport async function createServiceIntegration(serviceId: string, vendorId: string): Promise<string> {\n let response: Response;\n const baseUrl = 'https://api.pagerduty.com/services';\n const options: RequestInit = {\n method: 'POST',\n body: JSON.stringify({\n integration: {\n name: 'Backstage',\n service: {\n id: serviceId,\n type: 'service_reference',\n },\n vendor: {\n id: vendorId,\n type: 'vendor_reference',\n }\n }\n }),\n headers: {\n Authorization: `Token token=${process.env.PAGERDUTY_TOKEN}`,\n 'Accept': 'application/vnd.pagerduty+json;version=2',\n 'Content-Type': 'application/json',\n },\n };\n\n try {\n response = await fetch(`${baseUrl}/${serviceId}/integrations`, options);\n } catch (error) {\n throw new Error(`Failed to create service: ${error}`);\n }\n\n switch (response.status) {\n case 400:\n throw new Error(`Failed to create service integration. Caller provided invalid arguments.`);\n case 401:\n throw new Error(`Failed to create service integration. Caller did not supply credentials or did not provide the correct credentials.`);\n case 403:\n throw new Error(`Failed to create service integration. Caller is not authorized to view the requested resource.`);\n case 429:\n throw new Error(`Failed to create service integration. Rate limit exceeded.`);\n default: // 201\n break;\n }\n\n let result: PagerDutyCreateIntegrationResponse;\n try {\n result = await response.json();\n\n return result.integration.integration_key;\n\n } catch (error) {\n throw new Error(`Failed to parse service information: ${error}`);\n }\n}\n\n// Supporting router\n\nasync function getEscalationPolicies(offset: number, limit: number): Promise<[Boolean, PagerDutyEscalationPolicy[]]> {\n let response: Response;\n const options: RequestInit = {\n method: 'GET',\n headers: {\n Authorization: `Token token=${process.env.PAGERDUTY_TOKEN}`,\n 'Accept': 'application/vnd.pagerduty+json;version=2',\n 'Content-Type': 'application/json',\n },\n };\n const baseUrl = 'https://api.pagerduty.com/escalation_policies';\n\n try {\n response = await fetch(`${baseUrl}?total=true&sort_by=name&offset=${offset}&limit=${limit}`, options);\n } catch (error) {\n throw new Error(`Failed to retrieve escalation policies: ${error}`);\n }\n\n switch (response.status) {\n case 400:\n throw new HttpError(\"Failed to list escalation policies. Caller provided invalid arguments.\", 400);\n case 401:\n throw new HttpError(\"Failed to list escalation policies. Caller did not supply credentials or did not provide the correct credentials.\", 401);\n case 403:\n throw new HttpError(\"Failed to list escalation policies. Caller is not authorized to view the requested resource.\", 403);\n case 429:\n throw new HttpError(\"Failed to list escalation policies. Rate limit exceeded.\", 429);\n default: // 200\n break;\n }\n\n let result: PagerDutyEscalationPolicyListResponse;\n try {\n result = await response.json();\n\n return [result.more, result.escalation_policies];\n\n } catch (error) {\n throw new HttpError(`Failed to parse escalation policy information: ${error}`, 500);\n }\n}\n\nexport async function getAllEscalationPolicies(offset: number = 0): Promise<PagerDutyEscalationPolicy[]> {\n const limit = 50;\n\n try {\n const res = await getEscalationPolicies(offset, limit);\n const results = res[1];\n\n // if more results exist\n if (res[0]) {\n return results.concat((await getAllEscalationPolicies(offset + limit)));\n }\n\n return results;\n } catch (error) {\n\n throw new HttpError(`${((error as HttpError).message)}`, ((error as HttpError).status));\n }\n}\n\nexport async function isEventNoiseReductionEnabled(): Promise<boolean> {\n let response: Response;\n const baseUrl = 'https://api.pagerduty.com';\n const options: RequestInit = {\n method: 'GET',\n headers: {\n Authorization: `Token token=${process.env.PAGERDUTY_TOKEN}`,\n 'Accept': 'application/vnd.pagerduty+json;version=2',\n 'Content-Type': 'application/json',\n },\n };\n\n try {\n response = await fetch(`${baseUrl}/abilities`, options);\n } catch (error) {\n throw new Error(`Failed to read abilities: ${error}`);\n }\n\n switch (response.status) {\n case 401:\n throw new Error(`Failed to read abilities. Caller did not supply credentials or did not provide the correct credentials.`);\n case 403:\n throw new Error(`Failed to read abilities. Caller is not authorized to view the requested resource.`);\n case 429:\n throw new Error(`Failed to read abilities. Rate limit exceeded.`);\n default: // 200\n break;\n }\n\n let result: PagerDutyAbilitiesListResponse;\n try {\n result = await response.json();\n\n if (result.abilities.includes('using_alerts_on_any_service')\n && result.abilities.includes('preview_intelligent_alert_grouping')\n && result.abilities.includes('time_based_alert_grouping')) {\n return true;\n }\n\n return false;\n\n } catch (error) {\n throw new Error(`Failed to parse abilities information: ${error}`);\n }\n}","import { errorHandler } from '@backstage/backend-common';\nimport { Config } from '@backstage/config';\nimport express from 'express';\nimport Router from 'express-promise-router';\nimport { Logger } from 'winston';\nimport { getAllEscalationPolicies } from '../apis/pagerduty';\nimport { HttpError } from '../types';\n\nexport interface RouterOptions {\n logger: Logger;\n config: Config;\n}\n\nexport async function createRouter(\n options: RouterOptions\n): Promise<express.Router> {\n const { logger, config } = options;\n\n // Set the PagerDuty API token as an environment variable if it exists in the config file\n try {\n process.env.PAGERDUTY_TOKEN = config.getString('pagerDuty.apiToken');\n }\n catch (error) {\n logger.error(`Failed to retrieve PagerDuty API token from config file: ${error}`);\n throw error;\n }\n \n // Create the router\n const router = Router();\n router.use(express.json());\n\n // Add routes\n // GET /escalation_policies\n router.get('/escalation_policies', async (_, response) => { \n try {\n const escalationPolicyList = await getAllEscalationPolicies();\n const escalationPolicyDropDownOptions = escalationPolicyList.map((policy) => {\n return {\n label: policy.name,\n value: policy.id,\n };\n });\n\n response.json(escalationPolicyDropDownOptions);\n } catch (error) {\n if (error instanceof HttpError) {\n response.status(error.status).json(`${error.message}`);\n }\n }\n });\n\n // GET /health\n router.get('/health', async (_, response) => {\n response.status(200).json({ status: 'ok' });\n });\n\n // Add error handler\n router.use(errorHandler());\n\n // Return the router\n return router;\n}","import { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { z } from 'zod';\nimport * as api from '../apis/pagerduty';\n\nexport const createPagerDutyServiceAction = () => {\n\n return createTemplateAction<{\n name: string;\n description: string;\n escalationPolicyId: string;\n alertGrouping?: string;\n }>({\n id: 'pagerduty:service:create',\n schema: {\n input: z.object({\n name: z.string().min(1, \"name is required\").describe('Name of the service'),\n description: z.string().min(1, \"description is required\").describe('Description of the service'),\n escalationPolicyId: z.string().min(1, \"Escalation policy is required\").describe('Escalation policy ID'),\n alertGrouping: z.string().optional().describe('Alert grouping parameters'),\n }),\n output: z.object({\n serviceUrl: z.string().describe('PagerDuty Service URL'),\n serviceId: z.string().describe('PagerDuty Service ID'),\n integrationKey: z.string().describe('Backstage Integration Key'),\n }),\n },\n\n async handler(ctx) {\n try {\n // Create service in PagerDuty\n const [serviceId, serviceUrl] = await api.createService(\n ctx.input.name, \n ctx.input.description, \n ctx.input.escalationPolicyId, \n ctx.input.alertGrouping);\n ctx.logger.info(`Service '${ctx.input.name}' created successfully!`);\n ctx.logger.info(`Alert grouping set to '${ctx.input.alertGrouping}'`);\n\n ctx.output('serviceUrl', serviceUrl);\n ctx.output('serviceId', serviceId);\n\n // Create Backstage Integration in PagerDuty service\n const backstageIntegrationId = 'PRO19CT'; // ID for Backstage integration\n const integrationKey = await api.createServiceIntegration(serviceId, backstageIntegrationId);\n ctx.logger.info(`Backstage Integration for service '${ctx.input.name}' created successfully!`);\n\n ctx.output('integrationKey', integrationKey);\n } catch (error) {\n ctx.logger.error(`${error}`);\n }\n\n }\n });\n};\n"],"names":["Router","express","errorHandler","createTemplateAction","z","api.createService","api.createServiceIntegration"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwFO,MAAM,kBAAkB,KAAM,CAAA;AAAA,EACjC,WAAA,CAAY,SAAiB,MAAgB,EAAA;AACzC,IAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AAIjB,IAAA,aAAA,CAAA,IAAA,EAAA,QAAA,CAAA,CAAA;AAHI,IAAA,IAAA,CAAK,MAAS,GAAA,MAAA,CAAA;AAAA,GAClB;AAGJ;;AC3FA,eAAsB,aAAc,CAAA,IAAA,EAAc,WAAqB,EAAA,kBAAA,EAA4B,aAA2D,EAAA;AAE1J,EAAA,IAAI,uBAA0B,GAAA,MAAA,CAAA;AAE9B,E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AEpE,QAAI,GAAA,CAAA,MAAA,CAAO,cAAc,UAAU,CAAA,CAAA;AACnC,QAAI,GAAA,CAAA,MAAA,CAAO,aAAa,SAAS,CAAA,CAAA;AAGjC,QAAA,MAAM,sBAAyB,GAAA,SAAA,CAAA;AAC/B,QAAA,MAAM,cAAiB,GAAA,MAAMC,wBAAI,CAAyB,WAAW,sBAAsB,CAAA,CAAA;AAC3F,QAAA,GAAA,CAAI,OAAO,IAAK,CAAA,CAAA,mCAAA,EAAsC,GAAI,CAAA,KAAA,CAAM,IAAI,CAAyB,uBAAA,CAAA,CAAA,CAAA;AAE7F,QAAI,GAAA,CAAA,MAAA,CAAO,kBAAkB,cAAc,CAAA,CAAA;AAAA,eACtC,KAAO,EAAA;AACZ,QAAA,GAAA,CAAI,MAAO,CAAA,KAAA,CAAM,CAAG,EAAA,KAAK,CAAE,CAAA,CAAA,CAAA;AAAA,OAC/B;AAAA,KAEJ;AAAA,GACH,CAAA,CAAA;AACL;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/types.ts","../src/apis/pagerduty.ts","../src/service/router.ts","../src/actions/custom.ts"],"sourcesContent":["export type PagerDutyCreateServiceResponse = {\n service: PagerDutyService;\n};\n\nexport type PagerDutyService = {\n id: string;\n name: string;\n description: string;\n escalationPolicy: PagerDutyEscalationPolicy;\n alertCreation: string;\n incidentUrgencyRule: PagerDutyIncidentUrgencyRule;\n integrations: PagerDutyIntegrations[];\n teams: PagerDutyTeam[];\n status: string;\n type: string;\n summary: string;\n self: string;\n htmlUrl: string;\n};\n\nexport type PagerDutyTeam = {\n id: string;\n type: string;\n summary: string;\n self: string;\n htmlUrl: string;\n};\n\nexport type PagerDutyEscalationPolicy = {\n id: string;\n name: string;\n type: string;\n summary: string;\n self: string;\n htmlUrl: string;\n};\n\nexport type PagerDutyIncidentUrgencyRule = {\n type: string;\n urgency: string;\n};\n\nexport type PagerDutyIntegrations = {\n id: string;\n type: string;\n summary: string;\n self: string;\n htmlUrl: string;\n};\n\nexport type PagerDutyCreateIntegrationResponse = {\n integration: PagerDutyIntegration;\n};\n\nexport type PagerDutyIntegration = {\n id: string;\n type: string;\n summary: string;\n self: string;\n htmlUrl: string;\n name: string;\n service: PagerDutyService;\n createdAt: string;\n vendor: PagerDutyVendor;\n integration_key: string;\n};\n\nexport type PagerDutyVendor = {\n id: string;\n type: string;\n summary: string;\n self: string;\n htmlUrl: string;\n};\n\nexport type PagerDutyEscalationPolicyListResponse = {\n escalation_policies: PagerDutyEscalationPolicy[];\n limit: number;\n offset: number;\n more: boolean;\n total: number;\n};\n\nexport type PagerDutyEscalationPolicyDropDownOption = {\n label: string;\n value: string;\n};\n\nexport class HttpError extends Error {\n constructor(message: string, status: number) {\n super(message);\n this.status = status;\n }\n\n status: number;\n}\n\nexport type PagerDutyAbilitiesListResponse = {\n abilities: string[];\n};\n\n\nexport type CreateServiceResponse = {\n id: string;\n url: string;\n alertGrouping: string;\n};\n","import { PagerDutyCreateIntegrationResponse, PagerDutyCreateServiceResponse, PagerDutyEscalationPolicyListResponse, PagerDutyEscalationPolicy, HttpError, PagerDutyAbilitiesListResponse, CreateServiceResponse } from \"../types\";\n\n// Supporting custom actions\n\nexport async function createService(name: string, description: string, escalationPolicyId: string, alertGrouping?: string): Promise<CreateServiceResponse> {\n let alertGroupingParameters = \"null\";\n let response: Response;\n const baseUrl = 'https://api.pagerduty.com/services';\n\n // Set default body\n let body = JSON.stringify({\n service: {\n type: 'service',\n name: name,\n description: description,\n alert_creation: 'create_alerts_and_incidents',\n auto_pause_notifications_parameters: {\n enabled: true,\n timeout: 300,\n },\n escalation_policy: {\n id: escalationPolicyId,\n type: 'escalation_policy_reference',\n },\n },\n });\n\n // Override body if alert grouping is enabled and passed as parameter\n if (await isEventNoiseReductionEnabled() && alertGrouping !== undefined) {\n alertGroupingParameters = alertGrouping;\n\n switch (alertGroupingParameters) {\n case \"intelligent\":\n body = JSON.stringify({\n service: {\n type: 'service',\n name: name,\n description: description,\n escalation_policy: {\n id: escalationPolicyId,\n type: 'escalation_policy_reference',\n },\n alert_creation: 'create_alerts_and_incidents',\n alert_grouping_parameters: {\n type: alertGroupingParameters,\n },\n auto_pause_notifications_parameters: {\n enabled: true,\n timeout: 300,\n },\n },\n });\n break;\n case \"time\":\n body = JSON.stringify({\n service: {\n type: 'service',\n name: name,\n description: description,\n escalation_policy: {\n id: escalationPolicyId,\n type: 'escalation_policy_reference',\n },\n alert_creation: 'create_alerts_and_incidents',\n alert_grouping_parameters: {\n type: alertGroupingParameters,\n config: {\n timeout: 0,\n },\n },\n auto_pause_notifications_parameters: {\n enabled: true,\n timeout: 300,\n },\n },\n });\n break;\n case \"content_based\":\n body = JSON.stringify({\n service: {\n type: 'service',\n name: name,\n description: description,\n escalation_policy: {\n id: escalationPolicyId,\n type: 'escalation_policy_reference',\n },\n alert_creation: 'create_alerts_and_incidents',\n alert_grouping_parameters: {\n type: alertGroupingParameters,\n config: {\n aggregate: 'all',\n time_window: 0,\n fields: [\n 'source',\n 'summary',\n ],\n },\n },\n auto_pause_notifications_parameters: {\n enabled: true,\n timeout: 300,\n },\n },\n });\n break;\n default:\n break;\n }\n }\n\n const options: RequestInit = {\n method: 'POST',\n body: body,\n headers: {\n Authorization: `Token token=${process.env.PAGERDUTY_TOKEN}`,\n 'Accept': 'application/vnd.pagerduty+json;version=2',\n 'Content-Type': 'application/json',\n },\n };\n\n try {\n response = await fetch(baseUrl, options);\n } catch (error) {\n throw new Error(`Failed to create service: ${error}`);\n }\n\n switch (response.status) {\n case 400:\n throw new Error(`Failed to create service. Caller provided invalid arguments.`);\n case 401:\n throw new Error(`Failed to create service. Caller did not supply credentials or did not provide the correct credentials.`);\n case 402:\n throw new Error(`Failed to create service. Account does not have the abilities to perform the action.`);\n case 403:\n throw new Error(`Failed to create service. Caller is not authorized to view the requested resource.`);\n default: // 201\n break;\n }\n\n let result: PagerDutyCreateServiceResponse;\n try {\n result = await response.json();\n\n const createServiceResult: CreateServiceResponse = {\n url: result.service.htmlUrl,\n id: result.service.id,\n alertGrouping: alertGroupingParameters,\n };\n\n return createServiceResult;\n\n } catch (error) {\n throw new Error(`Failed to parse service information: ${error}`);\n }\n}\n\nexport async function createServiceIntegration(serviceId: string, vendorId: string): Promise<string> {\n let response: Response;\n const baseUrl = 'https://api.pagerduty.com/services';\n const options: RequestInit = {\n method: 'POST',\n body: JSON.stringify({\n integration: {\n name: 'Backstage',\n service: {\n id: serviceId,\n type: 'service_reference',\n },\n vendor: {\n id: vendorId,\n type: 'vendor_reference',\n }\n }\n }),\n headers: {\n Authorization: `Token token=${process.env.PAGERDUTY_TOKEN}`,\n 'Accept': 'application/vnd.pagerduty+json;version=2',\n 'Content-Type': 'application/json',\n },\n };\n\n try {\n response = await fetch(`${baseUrl}/${serviceId}/integrations`, options);\n } catch (error) {\n throw new Error(`Failed to create service: ${error}`);\n }\n\n switch (response.status) {\n case 400:\n throw new Error(`Failed to create service integration. Caller provided invalid arguments.`);\n case 401:\n throw new Error(`Failed to create service integration. Caller did not supply credentials or did not provide the correct credentials.`);\n case 403:\n throw new Error(`Failed to create service integration. Caller is not authorized to view the requested resource.`);\n case 429:\n throw new Error(`Failed to create service integration. Rate limit exceeded.`);\n default: // 201\n break;\n }\n\n let result: PagerDutyCreateIntegrationResponse;\n try {\n result = await response.json();\n\n return result.integration.integration_key;\n\n } catch (error) {\n throw new Error(`Failed to parse service information: ${error}`);\n }\n}\n\n// Supporting router\n\nasync function getEscalationPolicies(offset: number, limit: number): Promise<[Boolean, PagerDutyEscalationPolicy[]]> {\n let response: Response;\n const options: RequestInit = {\n method: 'GET',\n headers: {\n Authorization: `Token token=${process.env.PAGERDUTY_TOKEN}`,\n 'Accept': 'application/vnd.pagerduty+json;version=2',\n 'Content-Type': 'application/json',\n },\n };\n const baseUrl = 'https://api.pagerduty.com/escalation_policies';\n\n try {\n response = await fetch(`${baseUrl}?total=true&sort_by=name&offset=${offset}&limit=${limit}`, options);\n } catch (error) {\n throw new Error(`Failed to retrieve escalation policies: ${error}`);\n }\n\n switch (response.status) {\n case 400:\n throw new HttpError(\"Failed to list escalation policies. Caller provided invalid arguments.\", 400);\n case 401:\n throw new HttpError(\"Failed to list escalation policies. Caller did not supply credentials or did not provide the correct credentials.\", 401);\n case 403:\n throw new HttpError(\"Failed to list escalation policies. Caller is not authorized to view the requested resource.\", 403);\n case 429:\n throw new HttpError(\"Failed to list escalation policies. Rate limit exceeded.\", 429);\n default: // 200\n break;\n }\n\n let result: PagerDutyEscalationPolicyListResponse;\n try {\n result = await response.json();\n\n return [result.more, result.escalation_policies];\n\n } catch (error) {\n throw new HttpError(`Failed to parse escalation policy information: ${error}`, 500);\n }\n}\n\nexport async function getAllEscalationPolicies(offset: number = 0): Promise<PagerDutyEscalationPolicy[]> {\n const limit = 50;\n\n try {\n const res = await getEscalationPolicies(offset, limit);\n const results = res[1];\n\n // if more results exist\n if (res[0]) {\n return results.concat((await getAllEscalationPolicies(offset + limit)));\n }\n\n return results;\n } catch (error) {\n\n throw new HttpError(`${((error as HttpError).message)}`, ((error as HttpError).status));\n }\n}\n\nexport async function isEventNoiseReductionEnabled(): Promise<boolean> {\n let response: Response;\n const baseUrl = 'https://api.pagerduty.com';\n const options: RequestInit = {\n method: 'GET',\n headers: {\n Authorization: `Token token=${process.env.PAGERDUTY_TOKEN}`,\n 'Accept': 'application/vnd.pagerduty+json;version=2',\n 'Content-Type': 'application/json',\n },\n };\n\n try {\n response = await fetch(`${baseUrl}/abilities`, options);\n } catch (error) {\n throw new Error(`Failed to read abilities: ${error}`);\n }\n\n switch (response.status) {\n case 401:\n throw new Error(`Failed to read abilities. Caller did not supply credentials or did not provide the correct credentials.`);\n case 403:\n throw new Error(`Failed to read abilities. Caller is not authorized to view the requested resource.`);\n case 429:\n throw new Error(`Failed to read abilities. Rate limit exceeded.`);\n default: // 200\n break;\n }\n\n let result: PagerDutyAbilitiesListResponse;\n try {\n result = await response.json();\n\n if (result.abilities.includes('preview_intelligent_alert_grouping')\n && result.abilities.includes('time_based_alert_grouping')) {\n return true;\n }\n\n return false;\n\n } catch (error) {\n throw new Error(`Failed to parse abilities information: ${error}`);\n }\n}","import { errorHandler } from '@backstage/backend-common';\nimport { Config } from '@backstage/config';\nimport express from 'express';\nimport Router from 'express-promise-router';\nimport { Logger } from 'winston';\nimport { getAllEscalationPolicies } from '../apis/pagerduty';\nimport { HttpError } from '../types';\n\nexport interface RouterOptions {\n logger: Logger;\n config: Config;\n}\n\nexport async function createRouter(\n options: RouterOptions\n): Promise<express.Router> {\n const { logger, config } = options;\n\n // Set the PagerDuty API token as an environment variable if it exists in the config file\n try {\n process.env.PAGERDUTY_TOKEN = config.getString('pagerDuty.apiToken');\n }\n catch (error) {\n logger.error(`Failed to retrieve PagerDuty API token from config file: ${error}`);\n throw error;\n }\n \n // Create the router\n const router = Router();\n router.use(express.json());\n\n // Add routes\n // GET /escalation_policies\n router.get('/escalation_policies', async (_, response) => { \n try {\n const escalationPolicyList = await getAllEscalationPolicies();\n const escalationPolicyDropDownOptions = escalationPolicyList.map((policy) => {\n return {\n label: policy.name,\n value: policy.id,\n };\n });\n\n response.json(escalationPolicyDropDownOptions);\n } catch (error) {\n if (error instanceof HttpError) {\n response.status(error.status).json(`${error.message}`);\n }\n }\n });\n\n // GET /health\n router.get('/health', async (_, response) => {\n response.status(200).json({ status: 'ok' });\n });\n\n // Add error handler\n router.use(errorHandler());\n\n // Return the router\n return router;\n}","import { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { z } from 'zod';\nimport * as api from '../apis/pagerduty';\nimport { CreateServiceResponse } from '../types';\n\nexport const createPagerDutyServiceAction = () => {\n\n return createTemplateAction<{\n name: string;\n description: string;\n escalationPolicyId: string;\n alertGrouping?: string;\n }>({\n id: 'pagerduty:service:create',\n schema: {\n input: z.object({\n name: z.string().min(1, \"name is required\").describe('Name of the service'),\n description: z.string().min(1, \"description is required\").describe('Description of the service'),\n escalationPolicyId: z.string().min(1, \"Escalation policy is required\").describe('Escalation policy ID'),\n alertGrouping: z.string().optional().describe('Alert grouping parameters'),\n }),\n output: z.object({\n serviceUrl: z.string().describe('PagerDuty Service URL'),\n serviceId: z.string().describe('PagerDuty Service ID'),\n integrationKey: z.string().describe('Backstage Integration Key'),\n }),\n },\n\n async handler(ctx) {\n try {\n // Create service in PagerDuty\n const service: CreateServiceResponse = await api.createService(\n ctx.input.name, \n ctx.input.description, \n ctx.input.escalationPolicyId, \n ctx.input.alertGrouping);\n ctx.logger.info(`Service '${ctx.input.name}' created successfully!`);\n ctx.logger.info(`Alert grouping set to '${service.alertGrouping}'`);\n\n ctx.output('serviceUrl', service.url);\n ctx.output('serviceId', service.id);\n\n // Create Backstage Integration in PagerDuty service\n const backstageIntegrationId = 'PRO19CT'; // ID for Backstage integration\n const integrationKey = await api.createServiceIntegration(service.id, backstageIntegrationId);\n ctx.logger.info(`Backstage Integration for service '${ctx.input.name}' created successfully!`);\n\n ctx.output('integrationKey', integrationKey);\n } catch (error) {\n ctx.logger.error(`${error}`);\n }\n\n }\n });\n};\n"],"names":["Router","express","errorHandler","createTemplateAction","z","api.createService","api.createServiceIntegration"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwFO,MAAM,kBAAkB,KAAM,CAAA;AAAA,EACjC,WAAA,CAAY,SAAiB,MAAgB,EAAA;AACzC,IAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AAIjB,IAAA,aAAA,CAAA,IAAA,EAAA,QAAA,CAAA,CAAA;AAHI,IAAA,IAAA,CAAK,MAAS,GAAA,MAAA,CAAA;AAAA,GAClB;AAGJ;;AC3FA,eAAsB,aAAc,CAAA,IAAA,EAAc,WAAqB,EAAA,kBAAA,EAA4B,aAAwD,EAAA;AACvJ,EAAA,IAAI,uBAA0B,GAAA,MAAA,CAAA;AAC9B,EAAI,IAAA,QAAA,CAAA;AACJ,EAAA,MAAM,OAAU,GAAA,oCAAA,CAAA;AAGhB,EAAI,IAAA,IAAA,GAAO,KAAK,SAAU,CAAA;AAAA,IACtB,OAAS,EAAA;AA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