lambda-utils.js
function updateEventSourceMapping(lambda, params, logger) {
  logger = logger || console;
  const functionName = params.FunctionName;
  const uuid = params.UUID;
  const updateEventSourceMappingAsync = Promises.wrap(lambda.updateEventSourceMapping);
  const startMs = Date.now();
  return updateEventSourceMappingAsync.call(lambda, params).then(
    result => {
      logger.info(`Updated event source mapping (${uuid}) for function (${functionName}) - took ${Date.now() - startMs} ms - result (${JSON.stringify(result)})`);
      return result;
    },
    err => {
      logger.error(`Failed to update event source mapping (${uuid}) for function (${functionName}) -  took ${Date.now() - startMs} ms`, err);
      throw err;
    }
  );
}
function updateEventSourceMapping(lambda, params, logger) {
  logger = logger || console;
  const functionName = params.FunctionName;
  const uuid = params.UUID;
  const updateEventSourceMappingAsync = Promises.wrap(lambda.updateEventSourceMapping);
  const startMs = Date.now();
  return updateEventSourceMappingAsync.call(lambda, params).then(
    result => {
      logger.info(`Updated event source mapping (${uuid}) for function (${functionName}) - took ${Date.now() - startMs} ms - result (${JSON.stringify(result)})`);
      return result;
    },
    err => {
      logger.error(`Failed to update event source mapping (${uuid}) for function (${functionName}) -  took ${Date.now() - startMs} ms`, err);
      throw err;
    }
  );
}
function updateEventSourceMapping ( lambda , params , logger ) { logger = logger || console ; const functionName = params . FunctionName ; const uuid = params . UUID ; const updateEventSourceMappingAsync = Promises . wrap ( lambda . updateEventSourceMapping ) ; const startMs = Date . now ( ) ; return updateEventSourceMappingAsync . call ( lambda , params ) . then ( result => { logger . info ( ` ${ uuid } ${ functionName } ${ Date . now ( ) - startMs } ${ JSON . stringify ( result ) } ` ) ; return result ; } , err => { logger . error ( ` ${ uuid } ${ functionName } ${ Date . now ( ) - startMs } ` , err ) ; throw err ; } ) ; }
Updates the Lambda function event source mapping identified by the given parameters with the given parameter values.
@param {AWS.Lambda|AwsLambda} lambda - the AWS.Lambda instance to use
@param {UpdateEventSourceMappingParams} params - the parameters to use
@param {Logger|console|undefined} [logger] - the logger to use (defaults to console if omitted)
@returns {Promise.<*>} a promise of the result returned by AWS Lambda
Updates the Lambda function event source mapping identified by the given parameters with the given parameter values .