-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from mbc-net/develop
[core]: Publish an SNS event when a Step Function gets error
- Loading branch information
Showing
17 changed files
with
170 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 11 additions & 9 deletions
20
packages/cli/templates/infra-local/cognito-local/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -642,6 +642,9 @@ exports[`snapshot test for InfraStack 1`] = ` | |
}, | ||
"SES_FROM_EMAIL": "[email protected]", | ||
"SFN_COMMAND_ARN": "arn:aws:states:ap-northeast-1:101010101010:stateMachine:dev-cdk-test-deploy-command-handler", | ||
"SNS_ALARM_TOPIC_ARN": { | ||
"Ref": "alarmsnsFB7BBC3B", | ||
}, | ||
"SNS_TOPIC_ARN": { | ||
"Ref": "mainsnsC0381B34", | ||
}, | ||
|
@@ -994,6 +997,13 @@ exports[`snapshot test for InfraStack 1`] = ` | |
"Ref": "mainsnsC0381B34", | ||
}, | ||
}, | ||
{ | ||
"Action": "sns:Publish", | ||
"Effect": "Allow", | ||
"Resource": { | ||
"Ref": "alarmsnsFB7BBC3B", | ||
}, | ||
}, | ||
{ | ||
"Action": [ | ||
"sqs:SendMessage", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { Global, Module } from '@nestjs/common' | ||
|
||
import { SnsService } from './sns.service' | ||
import { SnsClientFactory } from './sns-client-factory' | ||
|
||
@Global() | ||
@Module({ | ||
providers: [SnsService], | ||
providers: [SnsService, SnsClientFactory], | ||
exports: [SnsService], | ||
}) | ||
export class QueueModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { SNSClient } from '@aws-sdk/client-sns' | ||
import { Injectable } from '@nestjs/common' | ||
import { ConfigService } from '@nestjs/config' | ||
|
||
@Injectable() | ||
export class SnsClientFactory { | ||
private clients = new Map<string, SNSClient>() | ||
|
||
constructor(private readonly config: ConfigService) {} | ||
|
||
getClient(topicArn: string): SNSClient { | ||
if (!this.clients.has(topicArn)) { | ||
const snsClient = new SNSClient({ | ||
endpoint: this.config.get<string>('SNS_ENDPOINT'), | ||
region: this.config.get<string>('SNS_REGION'), | ||
}) | ||
this.clients.set(topicArn, snsClient) | ||
} | ||
return this.clients.get(topicArn) | ||
} | ||
} |
Oops, something went wrong.