Skip to content

Commit

Permalink
Merge pull request aws#245 from iliapolo/feat-add-notification-to-exi…
Browse files Browse the repository at this point in the history
…sting-s3-bucket

chore: revert change to lambda event source
  • Loading branch information
michaelbrewer authored Jun 15, 2021
2 parents 02682d1 + 075fcb5 commit 453122c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 76 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda-event-sources/lib/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface S3EventSourceProps {
* Use S3 bucket notifications as an event source for AWS Lambda.
*/
export class S3EventSource implements lambda.IEventSource {
constructor(readonly bucket: s3.IBucket, private readonly props: S3EventSourceProps) {
constructor(readonly bucket: s3.Bucket, private readonly props: S3EventSourceProps) {

}

Expand Down
75 changes: 0 additions & 75 deletions packages/@aws-cdk/aws-lambda-event-sources/test/test.s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,81 +8,6 @@ import { TestFunction } from './test-function';
/* eslint-disable quote-props */

export = {
'sufficiently complex example for imported bucket'(test: Test) {
// GIVEN
const stack = new cdk.Stack();
const fn = new TestFunction(stack, 'Fn');
const bucket = s3.Bucket.fromBucketName(stack, 'B', 'mybucket');

// WHEN
fn.addEventSource(new sources.S3EventSource(bucket, {
events: [s3.EventType.OBJECT_CREATED, s3.EventType.OBJECT_REMOVED],
filters: [
{ prefix: 'prefix/' },
{ suffix: '.png' },
],
}));

// THEN
expect(stack).to(haveResource('Custom::S3BucketNotifications', {
'NotificationConfiguration': {
'LambdaFunctionConfigurations': [
{
'Events': [
's3:ObjectCreated:*',
],
'Filter': {
'Key': {
'FilterRules': [
{
'Name': 'prefix',
'Value': 'prefix/',
},
{
'Name': 'suffix',
'Value': '.png',
},
],
},
},
'LambdaFunctionArn': {
'Fn::GetAtt': [
'Fn9270CBC0',
'Arn',
],
},
},
{
'Events': [
's3:ObjectRemoved:*',
],
'Filter': {
'Key': {
'FilterRules': [
{
'Name': 'prefix',
'Value': 'prefix/',
},
{
'Name': 'suffix',
'Value': '.png',
},
],
},
},
'LambdaFunctionArn': {
'Fn::GetAtt': [
'Fn9270CBC0',
'Arn',
],
},
},
],
},
}));
test.done();
},

'sufficiently complex example'(test: Test) {
// GIVEN
const stack = new cdk.Stack();
Expand Down

0 comments on commit 453122c

Please sign in to comment.