Skip to content

Commit

Permalink
Include account in notification
Browse files Browse the repository at this point in the history
  • Loading branch information
farski committed Jun 28, 2024
1 parent b882d8b commit 6331530
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/slack-notifications/accounts.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export default function accounts(accountId) {
switch (accountId) {
case "561178107736":
return "PRX Legacy";
case "578003269847":
return "PRX DevOps";
case "048723829744":
return "PRX Main";
case "856014627802":
return "PRX Feed CDN Staging";
case "838846856186":
return "PRX Feed CDN Production";
case "976680550710":
return "The World";
case "151502348212":
return "PRX Data Production";
case "639773875692":
return "PRX publicmedia.social";
case "874261868300":
return "PRX Dovetail CDN Staging";
case "485319730460":
return "PRX Dovetail CDN Production";
case "127213743756":
return "PRX IT Services";
default:
return accountId;
}
}
3 changes: 3 additions & 0 deletions src/slack-notifications/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
EventBridgeClient,
PutEventsCommand,
} from "@aws-sdk/client-eventbridge";
import accountName from "./accounts.mjs";

const eventbridge = new EventBridgeClient({ apiVersion: "2015-10-07" });

Expand Down Expand Up @@ -34,6 +35,7 @@ export const handler = async (event) => {
}),
);

const accountId = event.detail.affectedAccount;
const region = event.detail.eventRegion;
const { service } = event.detail;
const code = event.detail.eventTypeCode;
Expand Down Expand Up @@ -68,6 +70,7 @@ export const handler = async (event) => {
text: [
`*Service:* ${service}`,
`*Region:* ${region}`,
`*Account:* ${accountName(accountId)}`,
`*Event Code:* ${code}`,
"\n",
`*Started:* ${timeSince(new Date(startTs))} ago`,
Expand Down

0 comments on commit 6331530

Please sign in to comment.