Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(sns): move subscribers to aws-sns-subscribers #2804

Merged
merged 6 commits into from
Jun 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@aws-cdk/app-delivery/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/assert/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/assets-docker/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-autoscaling-common/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import autoscaling = require('@aws-cdk/aws-autoscaling');
import lambda = require('@aws-cdk/aws-lambda');
import sns = require('@aws-cdk/aws-sns');
import subs = require('@aws-cdk/aws-sns-subscriptions');
import { Construct } from '@aws-cdk/cdk';
import { TopicHook } from './topic-hook';

Expand All @@ -15,7 +16,7 @@ export class FunctionHook implements autoscaling.ILifecycleHookTarget {

public bind(scope: Construct, lifecycleHook: autoscaling.ILifecycleHook): autoscaling.LifecycleHookTargetConfig {
const topic = new sns.Topic(scope, 'Topic');
topic.subscribeLambda(this.fn);
topic.addSubscription(new subs.LambdaSubscription(this.fn));
return new TopicHook(topic).bind(scope, lifecycleHook);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion packages/@aws-cdk/aws-autoscaling-hooktargets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"@aws-cdk/aws-iam": "^0.34.0",
"@aws-cdk/aws-lambda": "^0.34.0",
"@aws-cdk/aws-sns": "^0.34.0",
"@aws-cdk/aws-sns-subscriptions": "^0.34.0",
"@aws-cdk/aws-sqs": "^0.34.0",
"@aws-cdk/cdk": "^0.34.0"
},
Expand All @@ -90,11 +91,12 @@
"@aws-cdk/aws-iam": "^0.34.0",
"@aws-cdk/aws-lambda": "^0.34.0",
"@aws-cdk/aws-sns": "^0.34.0",
"@aws-cdk/aws-sns-subscriptions": "^0.34.0",
"@aws-cdk/aws-sqs": "^0.34.0",
"@aws-cdk/cdk": "^0.34.0"
},
"engines": {
"node": ">= 8.10.0"
},
"stability": "experimental"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudformation/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudfront/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudtrail/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudwatch-actions/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codebuild/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codecommit/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import codepipeline = require('@aws-cdk/aws-codepipeline');
import sns = require('@aws-cdk/aws-sns');
import subs = require('@aws-cdk/aws-sns-subscriptions');
import cdk = require('@aws-cdk/cdk');

/**
Expand Down Expand Up @@ -62,7 +63,7 @@ export class ManualApprovalAction extends codepipeline.Action {
if (this._notificationTopic) {
this._notificationTopic.grantPublish(info.role);
for (const notifyEmail of this.props.notifyEmails || []) {
this._notificationTopic.subscribeEmail(`Subscription-${notifyEmail}`, notifyEmail);
this._notificationTopic.addSubscription(new subs.EmailSubscription(notifyEmail));
}
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion packages/@aws-cdk/aws-codepipeline-actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"@aws-cdk/aws-lambda": "^0.34.0",
"@aws-cdk/aws-s3": "^0.34.0",
"@aws-cdk/aws-sns": "^0.34.0",
"@aws-cdk/aws-sns-subscriptions": "^0.34.0",
"@aws-cdk/cdk": "^0.34.0"
},
"homepage": "https://github.com/awslabs/aws-cdk",
Expand All @@ -103,10 +104,11 @@
"@aws-cdk/aws-lambda": "^0.34.0",
"@aws-cdk/aws-s3": "^0.34.0",
"@aws-cdk/aws-sns": "^0.34.0",
"@aws-cdk/aws-sns-subscriptions": "^0.34.0",
"@aws-cdk/cdk": "^0.34.0"
},
"engines": {
"node": ">= 8.10.0"
},
"stability": "experimental"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
"PipelineApproveManualApprovalTopicResourceF5A35B20": {
"Type": "AWS::SNS::Topic"
},
"PipelineApproveManualApprovalTopicResourceSubscriptionadamruka85gmailcom76398FFA": {
"PipelineApproveManualApprovalTopicResourceadamruka85gmailcom202874CD": {
"Type": "AWS::SNS::Subscription",
"Properties": {
"Protocol": "email",
Expand All @@ -203,4 +203,4 @@
}
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ecs-patterns/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ecs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-events-targets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-events-targets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"@aws-cdk/aws-iam": "^0.34.0",
"@aws-cdk/aws-lambda": "^0.34.0",
"@aws-cdk/aws-sns": "^0.34.0",
"@aws-cdk/aws-sns-subscriptions": "^0.34.0",
"@aws-cdk/aws-stepfunctions": "^0.34.0",
"@aws-cdk/cdk": "^0.34.0"
},
Expand All @@ -103,6 +104,7 @@
"@aws-cdk/aws-iam": "^0.34.0",
"@aws-cdk/aws-lambda": "^0.34.0",
"@aws-cdk/aws-sns": "^0.34.0",
"@aws-cdk/aws-sns-subscriptions": "^0.34.0",
"@aws-cdk/aws-sqs": "^0.34.0",
"@aws-cdk/aws-stepfunctions": "^0.34.0",
"@aws-cdk/cdk": "^0.34.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import codebuild = require('@aws-cdk/aws-codebuild');
import codecommit = require('@aws-cdk/aws-codecommit');
import events = require('@aws-cdk/aws-events');
import sns = require('@aws-cdk/aws-sns');
import subs = require('@aws-cdk/aws-sns-subscriptions');
import sqs = require('@aws-cdk/aws-sqs');
import cdk = require('@aws-cdk/cdk');
import targets = require('../../lib');
Expand All @@ -19,7 +20,7 @@ const project = new codebuild.Project(stack, 'MyProject', {
const queue = new sqs.Queue(stack, 'MyQueue');

const topic = new sns.Topic(stack, 'MyTopic');
topic.subscribeQueue(queue);
topic.addSubscription(new subs.SqsSubscription(queue));

// this will send an email with the JSON event for every state change of this
// build project.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import events = require('@aws-cdk/aws-events');
import sns = require('@aws-cdk/aws-sns');
import subs = require('@aws-cdk/aws-sns-subscriptions');
import sqs = require('@aws-cdk/aws-sqs');
import cdk = require('@aws-cdk/cdk');
import targets = require('../../lib');
Expand All @@ -19,7 +20,7 @@ const event = new events.Rule(stack, 'EveryMinute', {
});

const queue = new sqs.Queue(stack, 'MyQueue');
topic.subscribeQueue(queue);
topic.addSubscription(new subs.SqsSubscription(queue));

event.addTarget(new targets.SnsTopic(topic));

Expand Down
5 changes: 3 additions & 2 deletions packages/@aws-cdk/aws-lambda-event-sources/lib/sns.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import lambda = require('@aws-cdk/aws-lambda');
import sns = require('@aws-cdk/aws-sns');
import subs = require('@aws-cdk/aws-sns-subscriptions');

/**
* Use an Amazon SNS topic as an event source for AWS Lambda.
Expand All @@ -9,6 +10,6 @@ export class SnsEventSource implements lambda.IEventSource {
}

public bind(target: lambda.IFunction) {
this.topic.subscribeLambda(target);
this.topic.addSubscription(new subs.LambdaSubscription(target));
}
}
}
4 changes: 3 additions & 1 deletion packages/@aws-cdk/aws-lambda-event-sources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"@aws-cdk/aws-s3": "^0.34.0",
"@aws-cdk/aws-s3-notifications": "^0.34.0",
"@aws-cdk/aws-sns": "^0.34.0",
"@aws-cdk/aws-sns-subscriptions": "^0.34.0",
"@aws-cdk/aws-sqs": "^0.34.0",
"@aws-cdk/cdk": "^0.34.0"
},
Expand All @@ -85,11 +86,12 @@
"@aws-cdk/aws-s3": "^0.34.0",
"@aws-cdk/aws-s3-notifications": "^0.34.0",
"@aws-cdk/aws-sns": "^0.34.0",
"@aws-cdk/aws-sns-subscriptions": "^0.34.0",
"@aws-cdk/aws-sqs": "^0.34.0",
"@aws-cdk/cdk": "^0.34.0"
},
"engines": {
"node": ">= 8.10.0"
},
"stability": "experimental"
}
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-logs-destinations/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-route53-targets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-route53/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-s3-notifications/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions packages/@aws-cdk/aws-sns-subscriptions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.js
tsconfig.json
tslint.json
*.js.map
*.d.ts
*.generated.ts
dist
lib/generated/resources.ts
.jsii

.LAST_BUILD
.nyc_output
coverage
.nycrc
.LAST_PACKAGE
*.snk
Loading