Skip to content

Commit 987ca2c

Browse files
authored
Merge pull request #6 from DataChefHQ/feature/securityhub-slack-alerts
feat: add security hub slack alerts
2 parents 06092d3 + 8bd7fce commit 987ca2c

File tree

6 files changed

+274
-41
lines changed

6 files changed

+274
-41
lines changed

API.md

Lines changed: 126 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/constructs/account-chatbots/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as chatbot from 'aws-cdk-lib/aws-chatbot';
33
import { SlackChannelConfigurationProps } from 'aws-cdk-lib/aws-chatbot/lib/slack-channel-configuration';
44
import { Construct } from 'constructs';
55

6-
export interface SlackChannelId {
6+
export interface SlackChannel {
77
readonly slackChannelConfigurationName: string;
88
readonly slackWorkspaceId: string;
99
readonly slackChannelId: string;
@@ -12,7 +12,7 @@ export interface SlackChannelId {
1212
export class AccountChatbots {
1313
public static slackChatBots: Record<string, chatbot.SlackChannelConfiguration> = {};
1414

15-
public static existsSlackChannel(scope: Construct, chatbotProps: SlackChannelId): boolean {
15+
public static existsSlackChannel(scope: Construct, chatbotProps: SlackChannel): boolean {
1616
const account = Stack.of(scope).account;
1717
const chatBotId = AccountChatbots.slackBotId(account, chatbotProps);
1818
return !!AccountChatbots.slackChatBots[chatBotId];
@@ -28,7 +28,7 @@ export class AccountChatbots {
2828
return AccountChatbots.slackChatBots[chatBotId];
2929
}
3030

31-
public static findSlackChannel(scope: Construct, chatbotProps: SlackChannelId) {
31+
public static findSlackChannel(scope: Construct, chatbotProps: SlackChannel) {
3232
const account = Stack.of(scope).account;
3333
const chatBotId = AccountChatbots.slackBotId(account, chatbotProps);
3434

@@ -37,7 +37,7 @@ export class AccountChatbots {
3737
return AccountChatbots.slackChatBots[chatBotId];
3838
}
3939

40-
private static slackBotId(account: string, chatbotProps: SlackChannelId): string {
40+
private static slackBotId(account: string, chatbotProps: SlackChannel): string {
4141
return [
4242
account,
4343
chatbotProps.slackWorkspaceId,

src/constructs/budget/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import * as iam from 'aws-cdk-lib/aws-iam';
33
import * as sns from 'aws-cdk-lib/aws-sns';
44
import * as subscriptions from 'aws-cdk-lib/aws-sns-subscriptions';
55
import { Construct } from 'constructs';
6-
import { AccountChatbots, SlackChannelId } from '../account-chatbots';
6+
import { AccountChatbots, SlackChannel } from '../account-chatbots';
77

88

99
export interface BudgetSubscribers {
1010
readonly emails?: string[];
11-
readonly slack?: SlackChannelId;
11+
readonly slack?: SlackChannel;
1212
}
1313

1414
export interface BudgetProps {
@@ -19,7 +19,7 @@ export interface BudgetProps {
1919
}
2020

2121
export class Budget {
22-
public readonly budget: budgets.CfnBudget;
22+
public readonly cfnBudget: budgets.CfnBudget;
2323
public readonly notificationTopic: sns.Topic;
2424

2525
constructor(scope: Construct, id: string, props: BudgetProps) {
@@ -47,7 +47,7 @@ export class Budget {
4747
slackChannel.addNotificationTopic(this.notificationTopic);
4848
}
4949

50-
this.budget = new budgets.CfnBudget(scope, id, {
50+
this.cfnBudget = new budgets.CfnBudget(scope, id, {
5151
budget: {
5252
budgetName: props.name,
5353
budgetType: 'COST',

0 commit comments

Comments
 (0)