mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
FunctionDeploy: Add event properties to comments
This commit is contained in:
parent
d8bce0ecb9
commit
94b60fd36b
@ -79,6 +79,7 @@ class EndpointBuildApiGateway extends JawsPlugin {
|
||||
.then(_this._manageLambdaAccessPolicy)
|
||||
.then(_this._createEndpointMethodResponses)
|
||||
.then(_this._createEndpointMethodIntegResponses)
|
||||
.then(_this._manageLambdaAccessPolicy)
|
||||
.then(function() {
|
||||
|
||||
evt.url = 'https://'
|
||||
@ -317,7 +318,7 @@ class EndpointBuildApiGateway extends JawsPlugin {
|
||||
|
||||
// Method exists. Delete and recreate it.
|
||||
|
||||
// First, save integration's Lambda alias, if any
|
||||
// First, save integration's Lambda endpointAlias, if any
|
||||
if (response.methodIntegration) {
|
||||
evt.prevIntegration = response.methodIntegration;
|
||||
}
|
||||
@ -408,21 +409,21 @@ class EndpointBuildApiGateway extends JawsPlugin {
|
||||
evt.lambda = lambda;
|
||||
|
||||
// Alias Lambda, default ot $LATEST
|
||||
let alias = '';
|
||||
if (evt.alias) alias = evt.alias;
|
||||
let alias;
|
||||
if (evt.endpointAlias) alias = evt.endpointAlias;
|
||||
else alias = '$LATEST';
|
||||
|
||||
// If no alias, and previous function exists, check if it has an alias
|
||||
if (!evt.alias &&
|
||||
// If no endpointAlias, and previous function exists, check if it has an endpointAlias
|
||||
if (!evt.endpointAlias &&
|
||||
evt.prevIntegration &&
|
||||
evt.prevIntegration.uri &&
|
||||
evt.prevIntegration.uri.indexOf('function:') != -1) {
|
||||
|
||||
let prevLambda = '';
|
||||
prevLambda = evt.prevIntegration.uri.split('function:')[1];
|
||||
prevLambda = prevLambda.replace('/invocations');
|
||||
|
||||
// Check if previous lambda has alias already
|
||||
prevLambda = prevLambda.replace('/invocations', '');
|
||||
prevLambda = prevLambda.replace(/undefined/gi, '');
|
||||
// Check if previous lambda has endpointAlias already
|
||||
if (prevLambda.indexOf(':') != -1) {
|
||||
alias = prevLambda.split(':')[1];
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ class EndpointProvisionApiGateway extends JawsPlugin {
|
||||
endpointProvisionApiGateway(evt) {
|
||||
|
||||
let _this = this;
|
||||
console.log("HERE: ", evt);
|
||||
|
||||
// Load AWS Service Instances
|
||||
let awsConfig = {
|
||||
region: evt.region.region,
|
||||
|
||||
@ -7,6 +7,15 @@
|
||||
* - Loops sequentially through each Region in specified Stage
|
||||
* - Passes Function paths to Sub-Actions for deployment
|
||||
* - Handles concurrent processing of Sub-Actions for faster deploys
|
||||
*
|
||||
* Event Properties:
|
||||
* - queued.type: (String) "code", "endpoint", "all". The type of Function Deploy.
|
||||
* - queued.stage: (String) The stage to deploy to
|
||||
* - queued.regions: (Array) The region(s) in the stage to deploy to
|
||||
* - queued.noExeCf: (Boolean) Don't execute CloudFormation
|
||||
* - queued.paths: (Array) Array of function paths to deploy. Format: 'users/show', 'users/create'
|
||||
* - queued.functions: (Array) Array of function JSONs from fun.sl.json
|
||||
* - uploaded: (Object) Contains regions and the functions that have been uploaded to the S3 bucket in that region
|
||||
*/
|
||||
|
||||
const JawsPlugin = require('../../JawsPlugin'),
|
||||
@ -65,9 +74,9 @@ class FunctionDeploy extends JawsPlugin {
|
||||
shortcut: 'c',
|
||||
description: 'Don\'t execute CloudFormation, just generate it',
|
||||
}, {
|
||||
option: 'alias',
|
||||
shortcut: 'a',
|
||||
description: 'Optional, endpoint only. Alias the lambda on selected endpoints'
|
||||
option: 'endpointAlias',
|
||||
shortcut: 'ea',
|
||||
description: 'Optional, endpoint only. Point the endpoint to a Lambda with a specific endpointAlias'
|
||||
}
|
||||
],
|
||||
});
|
||||
@ -154,8 +163,7 @@ class FunctionDeploy extends JawsPlugin {
|
||||
|
||||
JawsUtils.jawsDebug('Queued regions: ' + evt.queued.regions);
|
||||
|
||||
// Get full paths using the getFunctions() utility
|
||||
|
||||
// If CLI and paths are missing, get paths from CWD, and return
|
||||
if (_this.Jaws.cli) {
|
||||
if (!evt.queued.paths || !evt.queued.paths.length) {
|
||||
|
||||
@ -254,7 +262,8 @@ class FunctionDeploy extends JawsPlugin {
|
||||
})
|
||||
.then(function() {
|
||||
|
||||
// If type "code" or "all", trigger CloudFormation
|
||||
// If type "code" or "all", trigger Lambda CloudFormation Stack Update
|
||||
// Perform across all Stage Regions concurrently
|
||||
if (['code', 'all'].indexOf(evt.queued.type) > -1) {
|
||||
return _this._deployCodeAllRegions(evt);
|
||||
} else {
|
||||
@ -269,7 +278,6 @@ class FunctionDeploy extends JawsPlugin {
|
||||
*/
|
||||
|
||||
_prepareCodeByRegion(evt, region) {
|
||||
|
||||
let _this = this;
|
||||
|
||||
return new BbPromise(function(resolve, reject) {
|
||||
@ -325,7 +333,6 @@ class FunctionDeploy extends JawsPlugin {
|
||||
_deployCodeAllRegions(evt) {
|
||||
|
||||
let _this = this;
|
||||
|
||||
return new BbPromise(function(resolve, reject) {
|
||||
|
||||
// If type is "endpoint", skip
|
||||
@ -493,7 +500,7 @@ class FunctionDeploy extends JawsPlugin {
|
||||
evt.queued.stage,
|
||||
region),
|
||||
path: func.path,
|
||||
alias: evt.alias,
|
||||
endpointAlias: evt.endpointAlias,
|
||||
};
|
||||
|
||||
return _this.Jaws.actions.endpointPackageApiGateway(evtClone)
|
||||
@ -501,8 +508,7 @@ class FunctionDeploy extends JawsPlugin {
|
||||
|
||||
return new BbPromise(function (resolveTwo, reject) {
|
||||
|
||||
// A function can have multiple endpoints
|
||||
// Process all endpoints for this Function
|
||||
// A function can have multiple endpoints. Process all endpoints for this Function
|
||||
async.eachSeries(evtClone.endpoints, function (endpoint, eCb) {
|
||||
|
||||
// Set endpoint property
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user