Skip to content

Commit

Permalink
rough draft
Browse files Browse the repository at this point in the history
  • Loading branch information
svonworl committed Jan 16, 2024
1 parent 6eb8130 commit a7cd781
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion cloud-watch-to-slack-testing/deployment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,22 @@ function s3ActivityMessageText(message) {
return `${userName} generated S3 event ${eventName} from region ${awsRegion} for bucket ${bucketName} in Dockstore ${dockstoreEnvironment}`;
}

function ecsActivityMessageText(message) {
if (message["detail-type"] === "ECS Task State Change") {
return ecsTaskStateChangeMessageText(message);
} else {
return ecsAutoScalingMessageText(message);
}
}

function ecsTaskStateChangeMessageText(message) {
const taskArn = message.resources[0];
const clusterArn = message.detail.clusterArn;
const lastStatus = message.detail.lastStatus;
console.log(`Task ${taskArn} in cluster ${clusterArn} is now ${lastStatus}`);
return `Task is now ${lastStatus}`;
}

function ecsAutoScalingMessageText(message) {
const serviceName = message.detail.requestParameters.service;
const newDesiredCount = message.detail.requestParameters.desiredCount;
Expand All @@ -268,7 +284,7 @@ function messageTextFromMessageObject(message) {
} else if (message.source === "dockstore.deployer") {
return dockstoreDeployerMessageText(message);
} else if (message.source === "aws.ecs") {
return ecsAutoScalingMessageText(message);
return ecsActivityMessageText(message);
} else if (message.source === "aws.cloudwatch") {
return cloudWatchEventBridgeAlarmMessageText(message);
} else {
Expand Down

0 comments on commit a7cd781

Please sign in to comment.