From ed6f3e2f2795a9d3b30b8e2decbe89d8e687e84c Mon Sep 17 00:00:00 2001 From: Charles Reid Date: Thu, 16 Sep 2021 16:29:53 -0700 Subject: [PATCH 1/5] remove hashes from directory names --- .../README.md | 0 .../cloud-watch-to-slack-testing.yaml | 0 .../deployment/index.js | 0 .../deployment/output-template.yaml | 0 .../deployment/package.json | 0 .../deployment/template.yaml | 0 .../README.md | 0 .../deployment/index.js | 0 .../edge-lambda-for-s3-404s.yaml | 0 .../README.md | 0 .../deployment/index.js | 0 .../deployment/output-template.yaml | 0 .../deployment/package.json | 0 .../deployment/template.yaml | 0 ...lessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y.yaml | 0 .../README.md | 0 .../deployment/index.js | 0 .../deployment/index.spec.js | 0 .../env.json | 0 .../events/event.json | 0 .../template.yaml | 0 .../README.md | 0 .../deployment/index.js | 0 .../deployment/output-template.yaml | 0 .../deployment/package.json | 0 .../deployment/template.yaml | 0 .../webhook-testing.yaml | 0 27 files changed, 0 insertions(+), 0 deletions(-) rename {cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8 => cloud-watch-to-slack-testing}/README.md (100%) rename {cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8 => cloud-watch-to-slack-testing}/cloud-watch-to-slack-testing.yaml (100%) rename {cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8 => cloud-watch-to-slack-testing}/deployment/index.js (100%) rename {cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8 => cloud-watch-to-slack-testing}/deployment/output-template.yaml (100%) rename {cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8 => cloud-watch-to-slack-testing}/deployment/package.json (100%) rename {cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8 => cloud-watch-to-slack-testing}/deployment/template.yaml (100%) rename {edge-lambda-for-s3-404s-4cbfb453-f95b-45d0-8568-fc17164c9a4c => edge-lambda-for-s3}/README.md (100%) rename {edge-lambda-for-s3-404s-4cbfb453-f95b-45d0-8568-fc17164c9a4c => edge-lambda-for-s3}/deployment/index.js (100%) rename {edge-lambda-for-s3-404s-4cbfb453-f95b-45d0-8568-fc17164c9a4c => edge-lambda-for-s3}/edge-lambda-for-s3-404s.yaml (100%) rename {serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d => serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack}/README.md (100%) rename {serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d => serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack}/deployment/index.js (100%) rename {serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d => serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack}/deployment/output-template.yaml (100%) rename {serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d => serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack}/deployment/package.json (100%) rename {serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d => serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack}/deployment/template.yaml (100%) rename {serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d => serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack}/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y.yaml (100%) rename {upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7 => upsertGitHubTag}/README.md (100%) rename {upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7 => upsertGitHubTag}/deployment/index.js (100%) rename {upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7 => upsertGitHubTag}/deployment/index.spec.js (100%) rename {upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7 => upsertGitHubTag}/env.json (100%) rename {upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7 => upsertGitHubTag}/events/event.json (100%) rename {upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7 => upsertGitHubTag}/template.yaml (100%) rename {webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda => webhook-testing}/README.md (100%) rename {webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda => webhook-testing}/deployment/index.js (100%) rename {webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda => webhook-testing}/deployment/output-template.yaml (100%) rename {webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda => webhook-testing}/deployment/package.json (100%) rename {webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda => webhook-testing}/deployment/template.yaml (100%) rename {webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda => webhook-testing}/webhook-testing.yaml (100%) diff --git a/cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8/README.md b/cloud-watch-to-slack-testing/README.md similarity index 100% rename from cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8/README.md rename to cloud-watch-to-slack-testing/README.md diff --git a/cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8/cloud-watch-to-slack-testing.yaml b/cloud-watch-to-slack-testing/cloud-watch-to-slack-testing.yaml similarity index 100% rename from cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8/cloud-watch-to-slack-testing.yaml rename to cloud-watch-to-slack-testing/cloud-watch-to-slack-testing.yaml diff --git a/cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8/deployment/index.js b/cloud-watch-to-slack-testing/deployment/index.js similarity index 100% rename from cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8/deployment/index.js rename to cloud-watch-to-slack-testing/deployment/index.js diff --git a/cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8/deployment/output-template.yaml b/cloud-watch-to-slack-testing/deployment/output-template.yaml similarity index 100% rename from cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8/deployment/output-template.yaml rename to cloud-watch-to-slack-testing/deployment/output-template.yaml diff --git a/cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8/deployment/package.json b/cloud-watch-to-slack-testing/deployment/package.json similarity index 100% rename from cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8/deployment/package.json rename to cloud-watch-to-slack-testing/deployment/package.json diff --git a/cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8/deployment/template.yaml b/cloud-watch-to-slack-testing/deployment/template.yaml similarity index 100% rename from cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8/deployment/template.yaml rename to cloud-watch-to-slack-testing/deployment/template.yaml diff --git a/edge-lambda-for-s3-404s-4cbfb453-f95b-45d0-8568-fc17164c9a4c/README.md b/edge-lambda-for-s3/README.md similarity index 100% rename from edge-lambda-for-s3-404s-4cbfb453-f95b-45d0-8568-fc17164c9a4c/README.md rename to edge-lambda-for-s3/README.md diff --git a/edge-lambda-for-s3-404s-4cbfb453-f95b-45d0-8568-fc17164c9a4c/deployment/index.js b/edge-lambda-for-s3/deployment/index.js similarity index 100% rename from edge-lambda-for-s3-404s-4cbfb453-f95b-45d0-8568-fc17164c9a4c/deployment/index.js rename to edge-lambda-for-s3/deployment/index.js diff --git a/edge-lambda-for-s3-404s-4cbfb453-f95b-45d0-8568-fc17164c9a4c/edge-lambda-for-s3-404s.yaml b/edge-lambda-for-s3/edge-lambda-for-s3-404s.yaml similarity index 100% rename from edge-lambda-for-s3-404s-4cbfb453-f95b-45d0-8568-fc17164c9a4c/edge-lambda-for-s3-404s.yaml rename to edge-lambda-for-s3/edge-lambda-for-s3-404s.yaml diff --git a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d/README.md b/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/README.md similarity index 100% rename from serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d/README.md rename to serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/README.md diff --git a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d/deployment/index.js b/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/index.js similarity index 100% rename from serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d/deployment/index.js rename to serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/index.js diff --git a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d/deployment/output-template.yaml b/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/output-template.yaml similarity index 100% rename from serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d/deployment/output-template.yaml rename to serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/output-template.yaml diff --git a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d/deployment/package.json b/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/package.json similarity index 100% rename from serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d/deployment/package.json rename to serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/package.json diff --git a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d/deployment/template.yaml b/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/template.yaml similarity index 100% rename from serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d/deployment/template.yaml rename to serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/template.yaml diff --git a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y.yaml b/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y.yaml similarity index 100% rename from serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y.yaml rename to serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y.yaml diff --git a/upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7/README.md b/upsertGitHubTag/README.md similarity index 100% rename from upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7/README.md rename to upsertGitHubTag/README.md diff --git a/upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7/deployment/index.js b/upsertGitHubTag/deployment/index.js similarity index 100% rename from upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7/deployment/index.js rename to upsertGitHubTag/deployment/index.js diff --git a/upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7/deployment/index.spec.js b/upsertGitHubTag/deployment/index.spec.js similarity index 100% rename from upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7/deployment/index.spec.js rename to upsertGitHubTag/deployment/index.spec.js diff --git a/upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7/env.json b/upsertGitHubTag/env.json similarity index 100% rename from upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7/env.json rename to upsertGitHubTag/env.json diff --git a/upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7/events/event.json b/upsertGitHubTag/events/event.json similarity index 100% rename from upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7/events/event.json rename to upsertGitHubTag/events/event.json diff --git a/upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7/template.yaml b/upsertGitHubTag/template.yaml similarity index 100% rename from upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7/template.yaml rename to upsertGitHubTag/template.yaml diff --git a/webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda/README.md b/webhook-testing/README.md similarity index 100% rename from webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda/README.md rename to webhook-testing/README.md diff --git a/webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda/deployment/index.js b/webhook-testing/deployment/index.js similarity index 100% rename from webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda/deployment/index.js rename to webhook-testing/deployment/index.js diff --git a/webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda/deployment/output-template.yaml b/webhook-testing/deployment/output-template.yaml similarity index 100% rename from webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda/deployment/output-template.yaml rename to webhook-testing/deployment/output-template.yaml diff --git a/webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda/deployment/package.json b/webhook-testing/deployment/package.json similarity index 100% rename from webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda/deployment/package.json rename to webhook-testing/deployment/package.json diff --git a/webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda/deployment/template.yaml b/webhook-testing/deployment/template.yaml similarity index 100% rename from webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda/deployment/template.yaml rename to webhook-testing/deployment/template.yaml diff --git a/webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda/webhook-testing.yaml b/webhook-testing/webhook-testing.yaml similarity index 100% rename from webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda/webhook-testing.yaml rename to webhook-testing/webhook-testing.yaml From 1eeb6a0ae496d272ae3ed1d6293cb7fc269f97bd Mon Sep 17 00:00:00 2001 From: Charles Reid Date: Thu, 16 Sep 2021 16:32:29 -0700 Subject: [PATCH 2/5] update github action --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 86cd98c..8ce82e5 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -28,7 +28,7 @@ jobs: python -m pip install --upgrade pip pip install aws-sam-cli - name: Test with SAM CLI - working-directory: ./upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7 + working-directory: ./upsertGitHubTag run: | sam local invoke HelloWorldFunction -e events/event.json -n env.json &> output.txt grep "Valid push event" output.txt From 8be3799b90bac1f2cca69b5c6570aa0f77712c76 Mon Sep 17 00:00:00 2001 From: Charles Reid Date: Thu, 16 Sep 2021 16:36:55 -0700 Subject: [PATCH 3/5] update circleci config --- .circleci/config.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 53f8197..86a3dc4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,19 +21,19 @@ jobs: - check_git_secrets - lint - create_zip_upload_to_s3: - lambdaFolder: "cloud-watch-to-slack-testing-58006136-c30b-43d1-880c-7b36f860e7c8/deployment" + lambdaFolder: "cloud-watch-to-slack-testing/deployment" s3BucketFolder: "cloudWatchToSlackTesting" - create_zip_upload_to_s3: - lambdaFolder: "edge-lambda-for-s3-404s-4cbfb453-f95b-45d0-8568-fc17164c9a4c/deployment" + lambdaFolder: "edge-lambda-for-s3/deployment" s3BucketFolder: "edgeLambdaForS3404s" - create_zip_upload_to_s3: - lambdaFolder: "serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y-5885aaa7-b2bf-4619-9a72-f63a06b9fd4d/deployment" + lambdaFolder: "serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment" s3BucketFolder: "serverlessRepoCloudwatchAlarmToSlack" - create_zip_upload_to_s3: - lambdaFolder: "upsertGitHubTag-f79c4f36-3e61-43f4-8f6c-0b2e0e9774d7/deployment" + lambdaFolder: "upsertGitHubTag/deployment" s3BucketFolder: "upsertGitHubTag" - create_zip_upload_to_s3: - lambdaFolder: "webhook-testing-bdf90c40-b8ea-409b-951a-3ee800a00dda/deployment" + lambdaFolder: "webhook-testing/deployment" s3BucketFolder: "webhookTesting" - create_fedramp_inventory_zip_upload_to_s3: lambdaFolder: "fedramp-integrated-inventory-workbook/deployment" @@ -99,7 +99,7 @@ commands: command: cd << parameters.lambdaFolder >> && sam build --use-container && sam package --s3-bucket ${AWS_BUCKET} --s3-prefix $(echo ${CIRCLE_TAG-$CIRCLE_BRANCH} | sed "s/\//_/g")-$(echo $CIRCLE_SHA1 | cut -c -7)/<< parameters.s3BucketFolder >> create_zip_upload_to_s3: - description: "Creates a deployment zip for a lambda and uploads to S3" + description: "Create a deployment zip for a lambda and upload to S3" parameters: lambdaFolder: type: string @@ -119,7 +119,7 @@ commands: --cache-control max-age=0 create_fedramp_inventory_zip_upload_to_s3: - description: "Creates a deployment zip for the fedramp inventory lambda and uploads to S3" + description: "Create a deployment zip for the fedramp inventory lambda and upload to S3" parameters: lambdaFolder: type: string @@ -144,7 +144,7 @@ commands: --cache-control max-age=0 check_git_secrets: - description: "Installs git-secrets and scan repository to check for secrets" + description: "Install git-secrets and scan repository to check for secrets" steps: - run: name: install npm packages @@ -154,7 +154,7 @@ commands: command: npm run install-git-secrets lint: - description: "Runs lint" + description: "Run lint" steps: - run: name: lint From c36a844bf744d50650a151c7a51889b31abfb9cb Mon Sep 17 00:00:00 2001 From: Charles Reid Date: Thu, 16 Sep 2021 16:38:20 -0700 Subject: [PATCH 4/5] remove unused directory --- .../README.md | 1 - .../deployment/index.js | 139 ------------------ .../deployment/output-template.yaml | 37 ----- .../deployment/package.json | 8 - .../deployment/template.yaml | 37 ----- ...a-cloudwatchalarmtoslack-60UO1LIXCS1Y.yaml | 38 ----- 6 files changed, 260 deletions(-) delete mode 100644 serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/README.md delete mode 100644 serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/index.js delete mode 100644 serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/output-template.yaml delete mode 100644 serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/package.json delete mode 100644 serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/template.yaml delete mode 100644 serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y.yaml diff --git a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/README.md b/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/README.md deleted file mode 100644 index 9baaa72..0000000 --- a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/README.md +++ /dev/null @@ -1 +0,0 @@ -This lambda handles relaying messages from AWS CloudWatch Alarms into Slack diff --git a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/index.js b/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/index.js deleted file mode 100644 index 43c9c4a..0000000 --- a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/index.js +++ /dev/null @@ -1,139 +0,0 @@ -"use strict"; - -/** - * Follow these steps to configure the webhook in Slack: - * - * 1. Navigate to https://.slack.com/services/new - * - * 2. Search for and select "Incoming WebHooks". - * - * 3. Choose the default channel where messages will be sent and click "Add Incoming WebHooks Integration". - * - * 4. Copy the webhook URL from the setup instructions and use it in the next section. - * - * - * To encrypt your secrets use the following steps: - * - * 1. Create or use an existing KMS Key - http://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html - * - * 2. Click the "Enable Encryption Helpers" checkbox - * - * 3. Paste into the kmsEncryptedHookUrl environment variable and click encrypt - * - * Note: You must exclude the protocol from the URL (e.g. "hooks.slack.com/services/abc123"). - * - * 4. Give your function's role permission for the kms:Decrypt action. - * Example: - -{ - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "Stmt1443036478000", - "Effect": "Allow", - "Action": [ - "kms:Decrypt" - ], - "Resource": [ - "" - ] - } - ] -} - - */ - -const AWS = require("aws-sdk"); -const url = require("url"); -const https = require("https"); - -// The base-64 encoded, encrypted key (CiphertextBlob) stored in the kmsEncryptedHookUrl environment variable -const kmsEncryptedHookUrl = process.env.kmsEncryptedHookUrl; -// The Slack channel to send a message to stored in the slackChannel environment variable -const slackChannel = process.env.slackChannel; -let hookUrl; - -function postMessage(message, callback) { - const body = JSON.stringify(message); - const options = url.parse(hookUrl); - options.method = "POST"; - options.headers = { - "Content-Type": "application/json", - "Content-Length": Buffer.byteLength(body), - }; - - const postReq = https.request(options, (res) => { - const chunks = []; - res.setEncoding("utf8"); - res.on("data", (chunk) => chunks.push(chunk)); - res.on("end", () => { - if (callback) { - callback({ - body: chunks.join(""), - statusCode: res.statusCode, - statusMessage: res.statusMessage, - }); - } - }); - return res; - }); - - postReq.write(body); - postReq.end(); -} - -function processEvent(event, callback) { - const message = JSON.parse(event.Records[0].Sns.Message); - - const alarmName = message.AlarmName; - //var oldState = message.OldStateValue; - const newState = message.NewStateValue; - const reason = message.NewStateReason; - - const slackMessage = { - channel: slackChannel, - text: `${alarmName} state is now ${newState}: ${reason}`, - }; - - postMessage(slackMessage, (response) => { - if (response.statusCode < 400) { - console.info("Message posted successfully on Slack"); - callback(null); - } else if (response.statusCode < 500) { - console.error( - `Error posting message to Slack API: ${response.statusCode} - ${response.statusMessage}` - ); - callback(null); // Don't retry because the error is due to a problem with the request - } else { - // Let Lambda retry - callback( - `Server error when processing message: ${response.statusCode} - ${response.statusMessage}` - ); - } - }); -} - -exports.handler = (event, context, callback) => { - if (hookUrl) { - // Container reuse, simply process the event with the key in memory - processEvent(event, callback); - } else if ( - kmsEncryptedHookUrl && - kmsEncryptedHookUrl !== "" - ) { - const encryptedBuf = new Buffer(kmsEncryptedHookUrl, "base64"); - const cipherText = { CiphertextBlob: encryptedBuf }; - - const kms = new AWS.KMS(); - kms.decrypt(cipherText, (err, data) => { - if (err) { - console.log("Decrypt error:", err); - return callback(err); - } - hookUrl = `https://${data.Plaintext.toString("ascii")}`; - processEvent(event, callback); - }); - } else { - callback("Hook URL has not been set."); - } -}; diff --git a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/output-template.yaml b/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/output-template.yaml deleted file mode 100644 index 7c9313f..0000000 --- a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/output-template.yaml +++ /dev/null @@ -1,37 +0,0 @@ -AWSTemplateFormatVersion: '2010-09-09' -Description: An Amazon SNS trigger that sends CloudWatch alarm notifications to Slack. -Parameters: - KeyIdParameter: - Type: String - kmsEncryptedHookUrlParameter: - Type: String - slackChannelParameter: - Type: String -Resources: - SNSTopic1: - Type: AWS::SNS::Topic - cloudwatchalarmtoslack: - Properties: - CodeUri: s3://aws-sar-publishing/376e2767f8cf796f8f7a36e41cb5ae7e - Description: An Amazon SNS trigger that sends CloudWatch alarm notifications - to Slack. - Environment: - Variables: - kmsEncryptedHookUrl: kmsEncryptedHookUrlParameter - slackChannel: slackChannelParameter - Events: - SNS1: - Properties: - Topic: - Ref: SNSTopic1 - Type: SNS - Handler: index.handler - MemorySize: 128 - Policies: - - KMSDecryptPolicy: - KeyId: - Ref: KeyIdParameter - Runtime: nodejs8.10 - Timeout: 3 - Type: AWS::Serverless::Function -Transform: AWS::Serverless-2016-10-31 diff --git a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/package.json b/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/package.json deleted file mode 100644 index 02d6a7d..0000000 --- a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "algorithmia-blueprint", - "version": "1.0.0", - "private": true, - "dependencies": { - "algorithmia": "^0.3.9" - } -} diff --git a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/template.yaml b/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/template.yaml deleted file mode 100644 index dd316e1..0000000 --- a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment/template.yaml +++ /dev/null @@ -1,37 +0,0 @@ -AWSTemplateFormatVersion: '2010-09-09' -Transform: 'AWS::Serverless-2016-10-31' -Description: An Amazon SNS trigger that sends CloudWatch alarm notifications to Slack. -Parameters: - KeyIdParameter: - Type: String - slackChannelParameter: - Type: String - kmsEncryptedHookUrlParameter: - Type: String -Resources: - cloudwatchalarmtoslack: - Type: 'AWS::Serverless::Function' - Properties: - Handler: index.handler - Runtime: nodejs8.10 - CodeUri: . - Description: >- - An Amazon SNS trigger that sends CloudWatch alarm notifications to - Slack. - MemorySize: 128 - Timeout: 3 - Policies: - - KMSDecryptPolicy: - KeyId: !Ref KeyIdParameter - Events: - SNS1: - Type: SNS - Properties: - Topic: - Ref: SNSTopic1 - Environment: - Variables: - slackChannel: slackChannelParameter - kmsEncryptedHookUrl: kmsEncryptedHookUrlParameter - SNSTopic1: - Type: 'AWS::SNS::Topic' diff --git a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y.yaml b/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y.yaml deleted file mode 100644 index 1ace44a..0000000 --- a/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack-60UO1LIXCS1Y.yaml +++ /dev/null @@ -1,38 +0,0 @@ -AWSTemplateFormatVersion: '2010-09-09' -Transform: 'AWS::Serverless-2016-10-31' -Description: >- - An Amazon SNS trigger that sends CloudWatch alarm notifications to Slack - #dockstore-alerts. -Resources: - serverlessrepocloudwatchacloudwatchalarmtoslack60UO1LIXCS1Y: - Type: 'AWS::Serverless::Function' - Properties: - Handler: index.handler - Runtime: nodejs8.10 - CodeUri: . - Description: >- - An Amazon SNS trigger that sends CloudWatch alarm notifications to Slack - #dockstore-alerts. - MemorySize: 128 - Timeout: 3 - Role: >- - arn:aws:iam::312767926603:role/serverlessrepo-cloudwatch-cloudwatchalarmtoslackRo-1MWUBBKPY1IYG - Events: - SNS1: - Type: SNS - Properties: - Topic: - Ref: SNSTopic1 - Environment: - Variables: - kmsEncryptedHookUrl: >- - AQICAHicSBs6aaXy8Lb+IjLRg6DV8EoauPSVsU5VmBT+1qT9lQHToZoua3KzPa1BecYrbyk0AAAApzCBpAYJKoZIhvcNAQcGoIGWMIGTAgEAMIGNBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDIzxlGCJcqy30dT8kwIBEIBg0zj3RpxntbX1izzXdPa2SoJL6TbCeHBSOpsxtF679Ywlq6DHG6NWHth+Zj1lnhUdHqoqZK7JilcqJN8L6inFjcgmgZEwPsiQN3QWOr4ExwlxrKl3zKaxBn5i0f7Un+K+ - slackChannel: dockstore-alerts - KmsKeyArn: >- - arn:aws:kms:us-east-1:312767926603:key/0a1d7811-1366-448c-a31d-ce61effcbf92 - Tags: - 'serverlessrepo:semanticVersion': 1.0.2 - 'serverlessrepo:applicationId': >- - arn:aws:serverlessrepo:us-east-1:077246666028:applications/cloudwatch-alarm-to-slack - SNSTopic1: - Type: 'AWS::SNS::Topic' From 9dc1535a6e61d324feefc89655e3617ac0263d76 Mon Sep 17 00:00:00 2001 From: Charles Reid Date: Thu, 16 Sep 2021 16:41:33 -0700 Subject: [PATCH 5/5] update circleci config --- .circleci/config.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 86a3dc4..077513f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,9 +26,6 @@ jobs: - create_zip_upload_to_s3: lambdaFolder: "edge-lambda-for-s3/deployment" s3BucketFolder: "edgeLambdaForS3404s" - - create_zip_upload_to_s3: - lambdaFolder: "serverlessrepo-cloudwatch-a-cloudwatchalarmtoslack/deployment" - s3BucketFolder: "serverlessRepoCloudwatchAlarmToSlack" - create_zip_upload_to_s3: lambdaFolder: "upsertGitHubTag/deployment" s3BucketFolder: "upsertGitHubTag"