From df25e0af4871e99bbfe6ddd038f35287bbe42ed7 Mon Sep 17 00:00:00 2001 From: Philipp Muens Date: Fri, 10 Jun 2016 11:21:18 +0200 Subject: [PATCH] Remove namespacing of S3 event bucket This way users are not confused if they won't find their bucket because of the namespacing that was previously applied. --- .../awsCompileS3Events/awsCompileS3Events.js | 6 ++---- .../awsCompileS3Events/tests/awsCompileS3Events.js | 14 +++++--------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/lib/plugins/awsCompileS3Events/awsCompileS3Events.js b/lib/plugins/awsCompileS3Events/awsCompileS3Events.js index e1ce32277..c5fccb32a 100644 --- a/lib/plugins/awsCompileS3Events/awsCompileS3Events.js +++ b/lib/plugins/awsCompileS3Events/awsCompileS3Events.js @@ -3,9 +3,8 @@ const merge = require('lodash').merge; class AwsCompileS3Events { - constructor(serverless, options) { + constructor(serverless) { this.serverless = serverless; - this.options = options; this.hooks = { 'deploy:compileEvents': this.compileS3Events.bind(this), @@ -48,8 +47,7 @@ class AwsCompileS3Events { s3BucketObject.events.aws.s3.forEach((bucketName) => { // 1. create the S3 bucket with the corresponding notification const newS3Bucket = JSON.parse(bucketTemplate); - newS3Bucket.Properties.BucketName = `${this.serverless.service.service}-${bucketName}-${ - this.options.stage}-${this.options.region}`; + newS3Bucket.Properties.BucketName = bucketName; newS3Bucket.Properties.NotificationConfiguration = { LambdaConfigurations: [ { diff --git a/lib/plugins/awsCompileS3Events/tests/awsCompileS3Events.js b/lib/plugins/awsCompileS3Events/tests/awsCompileS3Events.js index 1ef38fc9b..145697c15 100644 --- a/lib/plugins/awsCompileS3Events/tests/awsCompileS3Events.js +++ b/lib/plugins/awsCompileS3Events/tests/awsCompileS3Events.js @@ -12,11 +12,7 @@ describe('awsCompileS3Events', () => { serverless = new Serverless(); serverless.init(); serverless.service.resources = { aws: { Resources: {} } }; - const options = { - stage: 'dev', - region: 'us-east-1', - }; - awsCompileS3Events = new AwsCompileS3Events(serverless, options); + awsCompileS3Events = new AwsCompileS3Events(serverless); awsCompileS3Events.serverless.service.service = 'new-service'; }); @@ -55,7 +51,7 @@ describe('awsCompileS3Events', () => { firstfunctionbucket1: { Type: 'AWS::S3::Bucket', Properties: { - BucketName: 'new-service-first-function-bucket1-dev-us-east-1', + BucketName: 'first-function-bucket1', NotificationConfiguration: { LambdaConfigurations: [ { @@ -88,7 +84,7 @@ describe('awsCompileS3Events', () => { firstfunctionbucket2: { Type: 'AWS::S3::Bucket', Properties: { - BucketName: 'new-service-first-function-bucket2-dev-us-east-1', + BucketName: 'first-function-bucket2', NotificationConfiguration: { LambdaConfigurations: [ { @@ -121,7 +117,7 @@ describe('awsCompileS3Events', () => { secondfunctionbucket1: { Type: 'AWS::S3::Bucket', Properties: { - BucketName: 'new-service-second-function-bucket1-dev-us-east-1', + BucketName: 'second-function-bucket1', NotificationConfiguration: { LambdaConfigurations: [ { @@ -154,7 +150,7 @@ describe('awsCompileS3Events', () => { secondfunctionbucket2: { Type: 'AWS::S3::Bucket', Properties: { - BucketName: 'new-service-second-function-bucket2-dev-us-east-1', + BucketName: 'second-function-bucket2', NotificationConfiguration: { LambdaConfigurations: [ {