@pagerduty/backstage-plugin-backend 0.1.3-next.7 → 0.1.3-next.9
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 +45 -21
- package/dist/index.cjs.js.map +1 -1
- package/package.json +1 -2
package/dist/index.cjs.js
CHANGED
|
@@ -116,9 +116,8 @@ async function createServiceIntegration(serviceId, vendorId) {
|
|
|
116
116
|
throw new Error(`Failed to parse service information: ${error}`);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
async function
|
|
119
|
+
async function getEscalationPolicies(offset, limit) {
|
|
120
120
|
let response;
|
|
121
|
-
const baseUrl = "https://api.pagerduty.com/escalation_policies";
|
|
122
121
|
const options = {
|
|
123
122
|
method: "GET",
|
|
124
123
|
headers: {
|
|
@@ -127,8 +126,9 @@ async function getAllEscalationPolicies() {
|
|
|
127
126
|
"Content-Type": "application/json"
|
|
128
127
|
}
|
|
129
128
|
};
|
|
129
|
+
const baseUrl = "https://api.pagerduty.com/escalation_policies";
|
|
130
130
|
try {
|
|
131
|
-
response = await fetch(`${baseUrl}?total=true&sort_by=name&limit
|
|
131
|
+
response = await fetch(`${baseUrl}?total=true&sort_by=name&offset=${offset}&limit=${limit}`, options);
|
|
132
132
|
} catch (error) {
|
|
133
133
|
throw new Error(`Failed to retrieve escalation policies: ${error}`);
|
|
134
134
|
}
|
|
@@ -145,34 +145,58 @@ async function getAllEscalationPolicies() {
|
|
|
145
145
|
let result;
|
|
146
146
|
try {
|
|
147
147
|
result = await response.json();
|
|
148
|
-
|
|
148
|
+
if (result.more) {
|
|
149
|
+
return [true, result.escalation_policies];
|
|
150
|
+
}
|
|
151
|
+
return [false, result.escalation_policies];
|
|
149
152
|
} catch (error) {
|
|
150
|
-
throw new
|
|
153
|
+
throw new HttpError(`Failed to parse escalation policy information: ${error}`, 500);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
let results;
|
|
157
|
+
async function getAllEscalationPolicies() {
|
|
158
|
+
const limit = 25;
|
|
159
|
+
const offset = 0;
|
|
160
|
+
results = [];
|
|
161
|
+
try {
|
|
162
|
+
const res = await getEscalationPolicies(offset, limit);
|
|
163
|
+
results.push(...res[1]);
|
|
164
|
+
if (res[0]) {
|
|
165
|
+
return results.concat((await getEscalationPolicies(offset + limit, limit))[1]);
|
|
166
|
+
}
|
|
167
|
+
return results;
|
|
168
|
+
} catch (error) {
|
|
169
|
+
throw new HttpError(`${error.message}`, error.status);
|
|
151
170
|
}
|
|
152
171
|
}
|
|
153
172
|
|
|
154
173
|
async function createRouter(options) {
|
|
155
174
|
const { logger, config } = options;
|
|
156
|
-
|
|
157
|
-
|
|
175
|
+
try {
|
|
176
|
+
process.env.PAGERDUTY_TOKEN = config.getString("pagerDuty.apiToken");
|
|
177
|
+
} catch (error) {
|
|
178
|
+
logger.error(`Failed to retrieve PagerDuty API token from config file: ${error}`);
|
|
179
|
+
throw error;
|
|
158
180
|
}
|
|
159
|
-
process.env.PAGERDUTY_TOKEN = `${config.getOptionalString("pagerDuty.apiToken")}`;
|
|
160
181
|
const router = Router__default["default"]();
|
|
161
182
|
router.use(express__default["default"].json());
|
|
162
183
|
router.get("/escalation_policies", async (_, response) => {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
184
|
+
if (process.env.PAGERDUTY_TOKEN === void 0) {
|
|
185
|
+
response.status(500).json("No PagerDuty API token was provided");
|
|
186
|
+
} else {
|
|
187
|
+
try {
|
|
188
|
+
const escalationPolicyList = await getAllEscalationPolicies();
|
|
189
|
+
const escalationPolicyDropDownOptions = escalationPolicyList.map((policy) => {
|
|
190
|
+
return {
|
|
191
|
+
label: policy.name,
|
|
192
|
+
value: policy.id
|
|
193
|
+
};
|
|
194
|
+
});
|
|
195
|
+
response.json(escalationPolicyDropDownOptions);
|
|
196
|
+
} catch (error) {
|
|
197
|
+
if (error instanceof HttpError) {
|
|
198
|
+
response.status(error.status).json(`${error.message}`);
|
|
199
|
+
}
|
|
176
200
|
}
|
|
177
201
|
}
|
|
178
202
|
});
|
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\n\n","import { PagerDutyCreateIntegrationResponse, PagerDutyCreateServiceResponse, PagerDutyEscalationPolicyListResponse, PagerDutyEscalationPolicy, HttpError } from \"../types\";\n\n// Supporting custom actions\n\nexport async function createService(name: string, description: string, escalationPolicyId: string): Promise<[string, 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 name: name,\n description: description,\n escalation_policy: {\n id: escalationPolicyId,\n type: 'escalation_policy_reference',\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, 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];\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\nexport async function getAllEscalationPolicies(): Promise<PagerDutyEscalationPolicy[]> {\n let response: Response;\n const baseUrl = 'https://api.pagerduty.com/escalation_policies';\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}?total=true&sort_by=name&limit=100`, 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.escalation_policies;\n\n } catch (error) {\n throw new Error(`Failed to parse escalation policy information: ${error}`);\n }\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 if (config.getOptionalString('pagerDuty.apiToken') === undefined) {\n throw new Error('No PagerDuty API token was provided.');\n }\n process.env.PAGERDUTY_TOKEN = `${config.getOptionalString('pagerDuty.apiToken')}`;\n\n const router = Router();\n router.use(express.json());\n\n router.get('/escalation_policies', async (_, response) => {\n logger.info('Getting escalation policies');\n\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 router.get('/health', async (_, response) => {\n response.status(200).json({ status: 'ok' });\n });\n\n router.use(errorHandler());\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 }>({\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 }),\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(ctx.input.name, ctx.input.description, ctx.input.escalationPolicyId);\n ctx.logger.info(`Service '${ctx.input.name}' created successfully!`);\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;;AC3FsB,eAAA,aAAA,CAAc,IAAc,EAAA,WAAA,EAAqB,kBAAuD,EAAA;AAC1H,EAAI,IAAA,QAAA,CAAA;AACJ,EAAA,MAAM,OAAU,GAAA,oCAAA,CAAA;AAChB,EAAA,MAAM,OAAuB,GAAA;AAAA,IACzB,MAAQ,EAAA,MAAA;AAAA,IACR,IAAA,EAAM,KAAK,SAAU,CAAA;AAAA,MACjB,IAAA;AAAA,MACA,WAAA;AAAA,MACA,iBAAmB,EAAA;AAAA,QACf,EAAI,EAAA,kBAAA;AAAA,QACJ,IAAM,EAAA,6BAAA;AAAA,OACV;AAAA,KACH,CAAA;AAAA,IACD,OAAS,EAAA;AAAA,MACL,aAAe,EAAA,CAAA,YAAA,EAAe,OAAQ,CAAA,GAAA,CAAI,eAAe,CAAA,CAAA;AAAA,MACzD,QAAU,EAAA,0CAAA;AAAA,MACV,cAAgB,EAAA,kBAAA;AAAA,KACpB;AAAA,GACJ,CAAA;AAE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f,MAAI,IAAA;AAEA,QAAA,MAAM,CAAC,SAAA,EAAW,UAAU,CAAA,GAAI,MAAMC,aAAI,CAAc,GAAI,CAAA,KAAA,CAAM,MAAM,GAAI,CAAA,KAAA,CAAM,WAAa,EAAA,GAAA,CAAI,MAAM,kBAAkB,CAAA,CAAA;AAC3H,QAAA,GAAA,CAAI,OAAO,IAAK,CAAA,CAAA,SAAA,EAAY,GAAI,CAAA,KAAA,CAAM,IAAI,CAAyB,uBAAA,CAAA,CAAA,CAAA;AAEnE,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\n\n","import { PagerDutyCreateIntegrationResponse, PagerDutyCreateServiceResponse, PagerDutyEscalationPolicyListResponse, PagerDutyEscalationPolicy, HttpError } from \"../types\";\n\n// Supporting custom actions\n\nexport async function createService(name: string, description: string, escalationPolicyId: string): Promise<[string, 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 name: name,\n description: description,\n escalation_policy: {\n id: escalationPolicyId,\n type: 'escalation_policy_reference',\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, 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];\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 if (result.more) {\n return [true, result.escalation_policies];\n }\n \n return [false, result.escalation_policies];\n \n } catch (error) {\n throw new HttpError(`Failed to parse escalation policy information: ${error}`, 500);\n }\n}\n\nlet results: PagerDutyEscalationPolicy[];\nexport async function getAllEscalationPolicies(): Promise<PagerDutyEscalationPolicy[]> {\n const limit = 25;\n const offset = 0;\n\n results = [];\n\n try {\n const res = await getEscalationPolicies(offset, limit);\n results.push(...res[1]);\n\n // if more results exist\n if (res[0]) {\n return results.concat((await getEscalationPolicies(offset+limit, limit))[1]);\n }\n\n return results;\n \n } catch (error) {\n \n throw new HttpError(`${((error as HttpError).message) }`, ((error as HttpError).status));\n }\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 if (process.env.PAGERDUTY_TOKEN === undefined) {\n response.status(500).json(\"No PagerDuty API token was provided\");\n }\n else {\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\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 }>({\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 }),\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(ctx.input.name, ctx.input.description, ctx.input.escalationPolicyId);\n ctx.logger.info(`Service '${ctx.input.name}' created successfully!`);\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;;AC3FsB,eAAA,aAAA,CAAc,IAAc,EAAA,WAAA,EAAqB,kBAAuD,EAAA;AAC1H,EAAI,IAAA,QAAA,CAAA;AACJ,EAAA,MAAM,OAAU,GAAA,oCAAA,CAAA;AAChB,EAAA,MAAM,OAAuB,GAAA;AAAA,IACzB,MAAQ,EAAA,MAAA;AAAA,IACR,IAAA,EAAM,KAAK,SAAU,CAAA;AAAA,MACjB,IAAA;AAAA,MACA,WAAA;AAAA,MACA,iBAAmB,EAAA;AAAA,QACf,EAAI,EAAA,kBAAA;AAAA,QACJ,IAAM,EAAA,6BAAA;AAAA,OACV;AAAA,KACH,CAAA;AAAA,IACD,OAAS,EAAA;AAAA,MACL,aAAe,EAAA,CAAA,YAAA,EAAe,OAAQ,CAAA,GAAA,CAAI,eAAe,CAAA,CAAA;AAAA,MACzD,QAAU,EAAA,0CAAA;AAAA,MACV,cAAgB,EAAA,kBAAA;AAAA,KACpB;AAAA,GACJ,CAAA;AAE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,MAAM,kBAAkB,CAAA,CAAA;AAC3H,QAAA,GAAA,CAAI,OAAO,IAAK,CAAA,CAAA,SAAA,EAAY,GAAI,CAAA,KAAA,CAAM,IAAI,CAAyB,uBAAA,CAAA,CAAA,CAAA;AAEnE,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;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagerduty/backstage-plugin-backend",
|
|
3
|
-
"version": "0.1.3-next.
|
|
3
|
+
"version": "0.1.3-next.9",
|
|
4
4
|
"main": "dist/index.cjs.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@backstage/cli": "^0.24.0",
|
|
41
|
-
"@backstage/test-utils": "^1.4.5",
|
|
42
41
|
"@types/node": "^20.9.2",
|
|
43
42
|
"@types/supertest": "^2.0.12",
|
|
44
43
|
"@types/webpack-env": "1.18.4",
|