serverless-plugin-existing-s3
Advanced tools
Comparing version 2.2.2 to 2.3.0
@@ -0,0 +0,0 @@ 'use strict' |
@@ -6,3 +6,3 @@ 'use strict'; | ||
const Transformer = require('./Transformer'); | ||
const BucketConfig = require('./BucketConfig') | ||
const BucketConfig = require('./BucketConfig'); | ||
@@ -18,3 +18,3 @@ | ||
this.s3Facade = new S3(this.serverless,this.options,this.provider); | ||
this.lambdaPermissions = new Permissions.Lambda(this.provider); | ||
this.lambdaPermissions = new Permissions.Lambda(this.options, this.provider); | ||
this.transformer = new Transformer(this.lambdaPermissions); | ||
@@ -21,0 +21,0 @@ this.commands = { |
{ | ||
"name": "serverless-plugin-existing-s3", | ||
"version": "2.2.2", | ||
"version": "2.3.0", | ||
"description": "Attach Lambda events to an existing S3 bucket, for Serverless.com 1.11.0+.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,3 +5,4 @@ 'use strict'; | ||
constructor(provider) { | ||
constructor(options, provider) { | ||
this.options = options; | ||
this.provider = provider; | ||
@@ -23,2 +24,5 @@ } | ||
SourceArn: `arn:aws:s3:::${bucketName}` | ||
}; | ||
if (this.options.alias) { | ||
payload['Qualifier'] = this.options.alias; | ||
} | ||
@@ -30,3 +34,7 @@ return this.provider.request('Lambda', 'addPermission', payload) | ||
getPolicy(functionName,passthrough) { | ||
return this.provider.request('Lambda', 'getPolicy', { FunctionName: functionName }) | ||
const payload = {FunctionName: functionName}; | ||
if (this.options.alias) { | ||
payload['Qualifier'] = this.options.alias; | ||
} | ||
return this.provider.request('Lambda', 'getPolicy', payload) | ||
.then( results => Object.assign({},{ statement: this.getStatement(this.asJson(results.Policy),passthrough), passthrough }) ) | ||
@@ -33,0 +41,0 @@ .catch( error => Object.assign({}, { error:error.message, passthrough } ) ); |
@@ -89,2 +89,11 @@ # Why? | ||
**Command line options** | ||
* `--alias`: Use this option to specify the lambda function's alias to be set as the event handler. This is optional and if omitted, the lambda function without a qualifier will be used (the `$LATEST` version). Here's an example on how to use it: | ||
``` | ||
> sls deploy --stage dev --alias dev | ||
> sls s3deploy --stage dev --alias dev | ||
``` | ||
# I haz an errawr | ||
@@ -91,0 +100,0 @@ |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ |
Sorry, the diff of this file is not supported yet
20238
361
111