mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
style: Prettier
This commit is contained in:
parent
9e558eefd6
commit
8d56d0e520
@ -35,9 +35,9 @@ const filterIrreleventEventConfigurationErrors = (resultErrorsSet) => {
|
||||
delete eventEventTypeErrorsByTypeIndex.root;
|
||||
|
||||
// 3.3 Resolve eventual type configuration errors for intended event type
|
||||
const eventConfiguredEventTypeErrors = Object.entries(
|
||||
eventEventTypeErrorsByTypeIndex
|
||||
).find(([, errors]) => errors.every(({ keyword }) => keyword !== 'required'));
|
||||
const eventConfiguredEventTypeErrors = Object.entries(eventEventTypeErrorsByTypeIndex).find(
|
||||
([, errors]) => errors.every(({ keyword }) => keyword !== 'required')
|
||||
);
|
||||
|
||||
if (!eventConfiguredEventTypeErrors) {
|
||||
// 3.4 If there are no event type configuration errors for intended event type
|
||||
|
||||
@ -476,11 +476,14 @@ class Variables {
|
||||
match = quotedWordSyntax.exec(input);
|
||||
}
|
||||
const commaReplacements = [];
|
||||
const contained = (
|
||||
commaMatch // curry the current commaMatch
|
||||
) => (
|
||||
stringMatch // check whether stringMatch containing the commaMatch
|
||||
) => stringMatch.start < commaMatch.index && this.overwriteSyntax.lastIndex < stringMatch.end;
|
||||
const contained =
|
||||
(
|
||||
commaMatch // curry the current commaMatch
|
||||
) =>
|
||||
(
|
||||
stringMatch // check whether stringMatch containing the commaMatch
|
||||
) =>
|
||||
stringMatch.start < commaMatch.index && this.overwriteSyntax.lastIndex < stringMatch.end;
|
||||
match = this.overwriteSyntax.exec(input);
|
||||
while (match) {
|
||||
const matchContained = contained(match);
|
||||
|
||||
@ -25,14 +25,8 @@ const getCommandSuggestion = (command, commandsSchema) => {
|
||||
};
|
||||
|
||||
module.exports = (configuration = null) => {
|
||||
const {
|
||||
command,
|
||||
options,
|
||||
commandSchema,
|
||||
commandsSchema,
|
||||
isContainerCommand,
|
||||
isHelpRequest,
|
||||
} = resolveInput();
|
||||
const { command, options, commandSchema, commandsSchema, isContainerCommand, isHelpRequest } =
|
||||
resolveInput();
|
||||
|
||||
if (!commandSchema && !isContainerCommand) {
|
||||
throw new ServerlessError(
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
|
||||
const ServerlessError = require('../serverless-error');
|
||||
|
||||
const paramRe = /^-(?:-(?<fullName>[a-zA-Z][A-Za-z0-9:_-]+)|(?<aliasNames>[a-z]+))(?:=(?<value>.*)|$)/;
|
||||
const paramRe =
|
||||
/^-(?:-(?<fullName>[a-zA-Z][A-Za-z0-9:_-]+)|(?<aliasNames>[a-z]+))(?:=(?<value>.*)|$)/;
|
||||
const isParamName = RegExp.prototype.test.bind(paramRe);
|
||||
|
||||
module.exports = (
|
||||
|
||||
@ -36,19 +36,24 @@ async function addCustomResourceToService(awsProvider, resourceName, iamRoleStat
|
||||
if (resourceName === 's3') {
|
||||
functionName = awsProvider.naming.getCustomResourceS3HandlerFunctionName();
|
||||
Handler = 's3/handler.handler';
|
||||
customResourceFunctionLogicalId = awsProvider.naming.getCustomResourceS3HandlerFunctionLogicalId();
|
||||
customResourceFunctionLogicalId =
|
||||
awsProvider.naming.getCustomResourceS3HandlerFunctionLogicalId();
|
||||
} else if (resourceName === 'cognitoUserPool') {
|
||||
functionName = awsProvider.naming.getCustomResourceCognitoUserPoolHandlerFunctionName();
|
||||
Handler = 'cognitoUserPool/handler.handler';
|
||||
customResourceFunctionLogicalId = awsProvider.naming.getCustomResourceCognitoUserPoolHandlerFunctionLogicalId();
|
||||
customResourceFunctionLogicalId =
|
||||
awsProvider.naming.getCustomResourceCognitoUserPoolHandlerFunctionLogicalId();
|
||||
} else if (resourceName === 'eventBridge') {
|
||||
functionName = awsProvider.naming.getCustomResourceEventBridgeHandlerFunctionName();
|
||||
Handler = 'eventBridge/handler.handler';
|
||||
customResourceFunctionLogicalId = awsProvider.naming.getCustomResourceEventBridgeHandlerFunctionLogicalId();
|
||||
customResourceFunctionLogicalId =
|
||||
awsProvider.naming.getCustomResourceEventBridgeHandlerFunctionLogicalId();
|
||||
} else if (resourceName === 'apiGatewayCloudWatchRole') {
|
||||
functionName = awsProvider.naming.getCustomResourceApiGatewayAccountCloudWatchRoleHandlerFunctionName();
|
||||
functionName =
|
||||
awsProvider.naming.getCustomResourceApiGatewayAccountCloudWatchRoleHandlerFunctionName();
|
||||
Handler = 'apiGatewayCloudWatchRole/handler.handler';
|
||||
customResourceFunctionLogicalId = awsProvider.naming.getCustomResourceApiGatewayAccountCloudWatchRoleHandlerFunctionLogicalId();
|
||||
customResourceFunctionLogicalId =
|
||||
awsProvider.naming.getCustomResourceApiGatewayAccountCloudWatchRoleHandlerFunctionLogicalId();
|
||||
} else {
|
||||
throw new ServerlessError(
|
||||
`No implementation found for Custom Resource "${resourceName}"`,
|
||||
|
||||
@ -48,9 +48,10 @@ async function updateConfiguration(config) {
|
||||
|
||||
return getConfiguration(config).then((NotificationConfiguration) => {
|
||||
// remove configurations for this specific function
|
||||
NotificationConfiguration.LambdaFunctionConfigurations = NotificationConfiguration.LambdaFunctionConfigurations.filter(
|
||||
(conf) => !conf.Id.startsWith(functionName)
|
||||
);
|
||||
NotificationConfiguration.LambdaFunctionConfigurations =
|
||||
NotificationConfiguration.LambdaFunctionConfigurations.filter(
|
||||
(conf) => !conf.Id.startsWith(functionName)
|
||||
);
|
||||
|
||||
// add the events to the existing NotificationConfiguration
|
||||
bucketConfigs.forEach((bucketConfig) => {
|
||||
@ -84,9 +85,10 @@ async function removeConfiguration(config) {
|
||||
|
||||
return getConfiguration(config).then((NotificationConfiguration) => {
|
||||
// remove configurations for this specific function
|
||||
NotificationConfiguration.LambdaFunctionConfigurations = NotificationConfiguration.LambdaFunctionConfigurations.filter(
|
||||
(conf) => !conf.Id.startsWith(functionName)
|
||||
);
|
||||
NotificationConfiguration.LambdaFunctionConfigurations =
|
||||
NotificationConfiguration.LambdaFunctionConfigurations.filter(
|
||||
(conf) => !conf.Id.startsWith(functionName)
|
||||
);
|
||||
|
||||
const payload = {
|
||||
Bucket,
|
||||
|
||||
@ -89,8 +89,8 @@ class AwsDeployFunction {
|
||||
|
||||
checkIfFunctionChangesBetweenImageAndHandler() {
|
||||
const functionObject = this.serverless.service.getFunction(this.options.function);
|
||||
const remoteFunctionPackageType = this.serverless.service.provider.remoteFunctionData
|
||||
.Configuration.PackageType;
|
||||
const remoteFunctionPackageType =
|
||||
this.serverless.service.provider.remoteFunctionData.Configuration.PackageType;
|
||||
|
||||
if (functionObject.handler && remoteFunctionPackageType === 'Image') {
|
||||
throw new ServerlessError(
|
||||
@ -171,8 +171,8 @@ class AwsDeployFunction {
|
||||
const functionObj = this.options.functionObj;
|
||||
const serviceObj = this.serverless.service.serviceObject;
|
||||
const providerObj = this.serverless.service.provider;
|
||||
const remoteFunctionConfiguration = this.serverless.service.provider.remoteFunctionData
|
||||
.Configuration;
|
||||
const remoteFunctionConfiguration =
|
||||
this.serverless.service.provider.remoteFunctionData.Configuration;
|
||||
const params = {
|
||||
FunctionName: functionObj.name,
|
||||
};
|
||||
@ -365,8 +365,8 @@ class AwsDeployFunction {
|
||||
const { functionImageUri, functionImageSha } = await this.provider.resolveImageUriAndSha(
|
||||
this.options.function
|
||||
);
|
||||
const remoteImageSha = this.serverless.service.provider.remoteFunctionData.Configuration
|
||||
.CodeSha256;
|
||||
const remoteImageSha =
|
||||
this.serverless.service.provider.remoteFunctionData.Configuration.CodeSha256;
|
||||
if (remoteImageSha === functionImageSha && !this.options.force) {
|
||||
this.serverless.cli.log('Image did not change. Skipping function deployment.');
|
||||
return;
|
||||
@ -383,8 +383,8 @@ class AwsDeployFunction {
|
||||
|
||||
const data = fs.readFileSync(artifactFilePath);
|
||||
|
||||
const remoteHash = this.serverless.service.provider.remoteFunctionData.Configuration
|
||||
.CodeSha256;
|
||||
const remoteHash =
|
||||
this.serverless.service.provider.remoteFunctionData.Configuration.CodeSha256;
|
||||
const localHash = crypto.createHash('sha256').update(data).digest('base64');
|
||||
|
||||
if (remoteHash === localHash && !this.options.force) {
|
||||
|
||||
@ -502,16 +502,11 @@ class AwsInvokeLocal {
|
||||
const envVarsDockerArgs = _.flatMap(envVars, (value, key) => ['--env', `${key}=${value}`]);
|
||||
|
||||
const dockerArgsFromOptions = this.getDockerArgsFromOptions();
|
||||
const dockerArgs = [
|
||||
'run',
|
||||
'--rm',
|
||||
'-v',
|
||||
`${artifactPath}:/var/task:ro,delegated`,
|
||||
].concat(envVarsDockerArgs, dockerArgsFromOptions, [
|
||||
imageName,
|
||||
handler,
|
||||
JSON.stringify(this.options.data),
|
||||
]);
|
||||
const dockerArgs = ['run', '--rm', '-v', `${artifactPath}:/var/task:ro,delegated`].concat(
|
||||
envVarsDockerArgs,
|
||||
dockerArgsFromOptions,
|
||||
[imageName, handler, JSON.stringify(this.options.data)]
|
||||
);
|
||||
|
||||
try {
|
||||
const { stdBuffer } = await spawnExt('docker', dockerArgs);
|
||||
|
||||
@ -8,12 +8,10 @@ module.exports = {
|
||||
this.validated.events.forEach((event) => {
|
||||
const { functionName, albId, multiValueHeaders } = event;
|
||||
|
||||
const albPermissionLogicalId = this.provider.naming.getLambdaAlbPermissionLogicalId(
|
||||
functionName
|
||||
);
|
||||
const registerTargetPermissionLogicalId = this.provider.naming.getLambdaRegisterTargetPermissionLogicalId(
|
||||
functionName
|
||||
);
|
||||
const albPermissionLogicalId =
|
||||
this.provider.naming.getLambdaAlbPermissionLogicalId(functionName);
|
||||
const registerTargetPermissionLogicalId =
|
||||
this.provider.naming.getLambdaRegisterTargetPermissionLogicalId(functionName);
|
||||
const targetGroupLogicalId = this.provider.naming.getAlbTargetGroupLogicalId(
|
||||
functionName,
|
||||
albId,
|
||||
|
||||
@ -28,9 +28,8 @@ module.exports = {
|
||||
albId,
|
||||
multiValueHeaders
|
||||
);
|
||||
const registerTargetPermissionLogicalId = this.provider.naming.getLambdaRegisterTargetPermissionLogicalId(
|
||||
functionName
|
||||
);
|
||||
const registerTargetPermissionLogicalId =
|
||||
this.provider.naming.getLambdaRegisterTargetPermissionLogicalId(functionName);
|
||||
|
||||
const healthCheckProperties = { HealthCheckEnabled: healthCheckDefaults.HealthCheckEnabled };
|
||||
if (healthCheck) {
|
||||
|
||||
@ -77,10 +77,11 @@ class AwsCompileAlexaSkillEvents {
|
||||
permissionTemplate.Properties.EventSourceToken = appId.replace(/\\n|\\r/g, '');
|
||||
}
|
||||
|
||||
const lambdaPermissionLogicalId = this.provider.naming.getLambdaAlexaSkillPermissionLogicalId(
|
||||
functionName,
|
||||
alexaSkillNumberInFunction
|
||||
);
|
||||
const lambdaPermissionLogicalId =
|
||||
this.provider.naming.getLambdaAlexaSkillPermissionLogicalId(
|
||||
functionName,
|
||||
alexaSkillNumberInFunction
|
||||
);
|
||||
|
||||
const permissionCloudForamtionResource = {
|
||||
[lambdaPermissionLogicalId]: permissionTemplate,
|
||||
|
||||
@ -63,10 +63,11 @@ class AwsCompileAlexaSmartHomeEvents {
|
||||
},
|
||||
};
|
||||
|
||||
const lambdaPermissionLogicalId = this.provider.naming.getLambdaAlexaSmartHomePermissionLogicalId(
|
||||
functionName,
|
||||
alexaSmartHomeNumberInFunction
|
||||
);
|
||||
const lambdaPermissionLogicalId =
|
||||
this.provider.naming.getLambdaAlexaSmartHomePermissionLogicalId(
|
||||
functionName,
|
||||
alexaSmartHomeNumberInFunction
|
||||
);
|
||||
|
||||
const permissionCloudFormationResource = {
|
||||
[lambdaPermissionLogicalId]: permissionTemplate,
|
||||
|
||||
@ -329,8 +329,8 @@ class AwsCompileApigEvents {
|
||||
// TODO should be removed once AWS fixes the removal via CloudFormation
|
||||
'before:remove:remove': async () => {
|
||||
const globalValidate = require('../../../../lib/validate').validate;
|
||||
const disassociateUsagePlan = require('./lib/hack/disassociateUsagePlan')
|
||||
.disassociateUsagePlan;
|
||||
const disassociateUsagePlan =
|
||||
require('./lib/hack/disassociateUsagePlan').disassociateUsagePlan;
|
||||
|
||||
return BbPromise.bind(this).then(globalValidate).then(disassociateUsagePlan);
|
||||
},
|
||||
|
||||
@ -7,9 +7,8 @@ module.exports = {
|
||||
const cfResources = this.serverless.service.provider.compiledCloudFormationTemplate.Resources;
|
||||
this.permissionMapping.forEach(
|
||||
({ lambdaLogicalId, lambdaAliasName, lambdaAliasLogicalId, event }) => {
|
||||
const lambdaPermissionLogicalId = this.provider.naming.getLambdaApiGatewayPermissionLogicalId(
|
||||
event.functionName
|
||||
);
|
||||
const lambdaPermissionLogicalId =
|
||||
this.provider.naming.getLambdaApiGatewayPermissionLogicalId(event.functionName);
|
||||
|
||||
const functionArnGetter = { 'Fn::GetAtt': [lambdaLogicalId, 'Arn'] };
|
||||
Object.assign(cfResources, {
|
||||
@ -44,9 +43,8 @@ module.exports = {
|
||||
|
||||
if (event.http.authorizer && event.http.authorizer.arn) {
|
||||
const authorizer = event.http.authorizer;
|
||||
const authorizerPermissionLogicalId = this.provider.naming.getLambdaApiGatewayPermissionLogicalId(
|
||||
authorizer.name
|
||||
);
|
||||
const authorizerPermissionLogicalId =
|
||||
this.provider.naming.getLambdaApiGatewayPermissionLogicalId(authorizer.name);
|
||||
|
||||
if (
|
||||
(authorizer.type || '').toUpperCase() === 'COGNITO_USER_POOLS' ||
|
||||
|
||||
@ -17,9 +17,10 @@ module.exports = {
|
||||
let validatorName;
|
||||
|
||||
if (event.http.request && event.http.request.schemas) {
|
||||
const template = this.serverless.service.provider.compiledCloudFormationTemplate.Resources[
|
||||
methodLogicalId
|
||||
];
|
||||
const template =
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Resources[
|
||||
methodLogicalId
|
||||
];
|
||||
for (const [contentType, schemaConfig] of _.entries(event.http.request.schemas)) {
|
||||
let modelLogicalId;
|
||||
|
||||
@ -89,9 +90,10 @@ module.exports = {
|
||||
}
|
||||
} else if (event.http.request && event.http.request.schema) {
|
||||
// Old functionality
|
||||
const template = this.serverless.service.provider.compiledCloudFormationTemplate.Resources[
|
||||
methodLogicalId
|
||||
];
|
||||
const template =
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Resources[
|
||||
methodLogicalId
|
||||
];
|
||||
for (const [contentType, schema] of _.entries(event.http.request.schema)) {
|
||||
const modelLogicalId = this.provider.naming.getEndpointModelLogicalId(
|
||||
resourceName,
|
||||
@ -180,17 +182,16 @@ module.exports = {
|
||||
const validatorName = `${
|
||||
this.serverless.service.service
|
||||
}-${this.provider.getStage()} | Validate request body and querystring parameters`;
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Resources[
|
||||
validatorLogicalId
|
||||
] = {
|
||||
Type: 'AWS::ApiGateway::RequestValidator',
|
||||
Properties: {
|
||||
RestApiId: this.provider.getApiGatewayRestApiId(),
|
||||
ValidateRequestBody: true,
|
||||
ValidateRequestParameters: true,
|
||||
Name: validatorName,
|
||||
},
|
||||
};
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Resources[validatorLogicalId] =
|
||||
{
|
||||
Type: 'AWS::ApiGateway::RequestValidator',
|
||||
Properties: {
|
||||
RestApiId: this.provider.getApiGatewayRestApiId(),
|
||||
ValidateRequestBody: true,
|
||||
ValidateRequestParameters: true,
|
||||
Name: validatorName,
|
||||
},
|
||||
};
|
||||
return {
|
||||
validatorLogicalId,
|
||||
validatorName,
|
||||
|
||||
@ -317,9 +317,11 @@ class AwsCompileCloudFrontEvents {
|
||||
}
|
||||
|
||||
compileCloudFrontEvents() {
|
||||
this.cloudFrontDistributionLogicalId = this.provider.naming.getCloudFrontDistributionLogicalId();
|
||||
this.cloudFrontDistributionLogicalId =
|
||||
this.provider.naming.getCloudFrontDistributionLogicalId();
|
||||
|
||||
this.cloudFrontDistributionDomainNameLogicalId = this.provider.naming.getCloudFrontDistributionDomainNameLogicalId();
|
||||
this.cloudFrontDistributionDomainNameLogicalId =
|
||||
this.provider.naming.getCloudFrontDistributionDomainNameLogicalId();
|
||||
|
||||
const lambdaAtEdgeFunctions = [];
|
||||
|
||||
@ -582,9 +584,10 @@ class AwsCompileCloudFrontEvents {
|
||||
|
||||
const lambdaInvokePermissions = lambdaAtEdgeFunctions.reduce(
|
||||
(permissions, lambdaAtEdgeFunction) => {
|
||||
const invokePermissionName = this.provider.naming.getLambdaAtEdgeInvokePermissionLogicalId(
|
||||
lambdaAtEdgeFunction.functionName
|
||||
);
|
||||
const invokePermissionName =
|
||||
this.provider.naming.getLambdaAtEdgeInvokePermissionLogicalId(
|
||||
lambdaAtEdgeFunction.functionName
|
||||
);
|
||||
const invokePermission = {
|
||||
Type: 'AWS::Lambda::Permission',
|
||||
Properties: {
|
||||
@ -628,9 +631,10 @@ class AwsCompileCloudFrontEvents {
|
||||
)
|
||||
);
|
||||
} else {
|
||||
const lambdaAssumeStatement = Resources.IamRoleLambdaExecution.Properties.AssumeRolePolicyDocument.Statement.find(
|
||||
(statement) => statement.Principal.Service.includes('lambda.amazonaws.com')
|
||||
);
|
||||
const lambdaAssumeStatement =
|
||||
Resources.IamRoleLambdaExecution.Properties.AssumeRolePolicyDocument.Statement.find(
|
||||
(statement) => statement.Principal.Service.includes('lambda.amazonaws.com')
|
||||
);
|
||||
if (lambdaAssumeStatement) {
|
||||
lambdaAssumeStatement.Principal.Service.push('edgelambda.amazonaws.com');
|
||||
}
|
||||
|
||||
@ -91,10 +91,11 @@ class AwsCompileCloudWatchEventEvents {
|
||||
functionName,
|
||||
cloudWatchEventNumberInFunction
|
||||
);
|
||||
const lambdaPermissionLogicalId = this.provider.naming.getLambdaCloudWatchEventPermissionLogicalId(
|
||||
functionName,
|
||||
cloudWatchEventNumberInFunction
|
||||
);
|
||||
const lambdaPermissionLogicalId =
|
||||
this.provider.naming.getLambdaCloudWatchEventPermissionLogicalId(
|
||||
functionName,
|
||||
cloudWatchEventNumberInFunction
|
||||
);
|
||||
const cloudWatchId = this.provider.naming.getCloudWatchEventId(functionName);
|
||||
|
||||
const cloudWatchEventRuleTemplate = `
|
||||
|
||||
@ -69,9 +69,8 @@ class AwsCompileCloudWatchLogEvents {
|
||||
functionName,
|
||||
cloudWatchLogNumberInFunction
|
||||
);
|
||||
const lambdaPermissionLogicalId = this.provider.naming.getLambdaCloudWatchLogPermissionLogicalId(
|
||||
functionName
|
||||
);
|
||||
const lambdaPermissionLogicalId =
|
||||
this.provider.naming.getLambdaCloudWatchLogPermissionLogicalId(functionName);
|
||||
|
||||
// unescape quotes once when the first quote is detected escaped
|
||||
const idxFirstSlash = FilterPattern.indexOf('\\');
|
||||
|
||||
@ -97,11 +97,12 @@ class AwsCompileCognitoUserPoolEvents {
|
||||
},
|
||||
},
|
||||
};
|
||||
const lambdaPermissionLogicalId = this.provider.naming.getLambdaCognitoUserPoolPermissionLogicalId(
|
||||
cognitoUserPoolTriggerFunction.functionName,
|
||||
cognitoUserPoolTriggerFunction.poolName,
|
||||
cognitoUserPoolTriggerFunction.triggerSource
|
||||
);
|
||||
const lambdaPermissionLogicalId =
|
||||
this.provider.naming.getLambdaCognitoUserPoolPermissionLogicalId(
|
||||
cognitoUserPoolTriggerFunction.functionName,
|
||||
cognitoUserPoolTriggerFunction.poolName,
|
||||
cognitoUserPoolTriggerFunction.triggerSource
|
||||
);
|
||||
const permissionCFResource = {
|
||||
[lambdaPermissionLogicalId]: permissionTemplate,
|
||||
};
|
||||
@ -155,10 +156,10 @@ class AwsCompileCognitoUserPoolEvents {
|
||||
}
|
||||
|
||||
const eventFunctionLogicalId = this.provider.naming.getLambdaLogicalId(functionName);
|
||||
const customResourceFunctionLogicalId = this.provider.naming.getCustomResourceCognitoUserPoolHandlerFunctionLogicalId();
|
||||
const customPoolResourceLogicalId = this.provider.naming.getCustomResourceCognitoUserPoolResourceLogicalId(
|
||||
functionName
|
||||
);
|
||||
const customResourceFunctionLogicalId =
|
||||
this.provider.naming.getCustomResourceCognitoUserPoolHandlerFunctionLogicalId();
|
||||
const customPoolResourceLogicalId =
|
||||
this.provider.naming.getCustomResourceCognitoUserPoolResourceLogicalId(functionName);
|
||||
|
||||
// store how often the custom Cognito User Pool resource is used
|
||||
if (poolResources[pool]) {
|
||||
|
||||
@ -219,11 +219,10 @@ class AwsCompileEventBridgeEvents {
|
||||
}
|
||||
|
||||
const eventFunctionLogicalId = this.provider.naming.getLambdaLogicalId(functionName);
|
||||
const customResourceFunctionLogicalId = this.provider.naming.getCustomResourceEventBridgeHandlerFunctionLogicalId();
|
||||
const customEventBridgeResourceLogicalId = this.provider.naming.getCustomResourceEventBridgeResourceLogicalId(
|
||||
functionName,
|
||||
idx
|
||||
);
|
||||
const customResourceFunctionLogicalId =
|
||||
this.provider.naming.getCustomResourceEventBridgeHandlerFunctionLogicalId();
|
||||
const customEventBridgeResourceLogicalId =
|
||||
this.provider.naming.getCustomResourceEventBridgeResourceLogicalId(functionName, idx);
|
||||
|
||||
const customEventBridge = {
|
||||
Type: 'Custom::EventBridge',
|
||||
@ -246,9 +245,8 @@ class AwsCompileEventBridgeEvents {
|
||||
},
|
||||
};
|
||||
|
||||
compiledCloudFormationTemplate.Resources[
|
||||
customEventBridgeResourceLogicalId
|
||||
] = customEventBridge;
|
||||
compiledCloudFormationTemplate.Resources[customEventBridgeResourceLogicalId] =
|
||||
customEventBridge;
|
||||
|
||||
if (!hasEventBusesIamRoleStatement && eventBusName && eventBusName !== 'default') {
|
||||
iamRoleStatements.push({
|
||||
@ -349,9 +347,8 @@ class AwsCompileEventBridgeEvents {
|
||||
};
|
||||
// If this stack is creating the event bus the rule must depend on it to ensure stack can be removed
|
||||
if (shouldCreateEventBus) {
|
||||
eventRuleResource.DependsOn = this.provider.naming.getEventBridgeEventBusLogicalId(
|
||||
eventBusName
|
||||
);
|
||||
eventRuleResource.DependsOn =
|
||||
this.provider.naming.getEventBridgeEventBusLogicalId(eventBusName);
|
||||
}
|
||||
|
||||
const ruleNameLogicalIdStub = makeRuleName({
|
||||
|
||||
@ -266,9 +266,8 @@ class HttpApiEvents {
|
||||
}
|
||||
|
||||
compileAuthorizerLambdaPermission({ functionName, functionArn, name, functionObject }) {
|
||||
const authorizerPermissionLogicalId = this.provider.naming.getLambdaAuthorizerHttpApiPermissionLogicalId(
|
||||
name
|
||||
);
|
||||
const authorizerPermissionLogicalId =
|
||||
this.provider.naming.getLambdaAuthorizerHttpApiPermissionLogicalId(name);
|
||||
const permissionResource = {
|
||||
Type: 'AWS::Lambda::Permission',
|
||||
Properties: {
|
||||
@ -295,9 +294,8 @@ class HttpApiEvents {
|
||||
};
|
||||
|
||||
if (functionObject && functionObject.targetAlias) {
|
||||
permissionResource.Properties.DependsOn = this.provider.naming.getLambdaLogicalId(
|
||||
functionName
|
||||
);
|
||||
permissionResource.Properties.DependsOn =
|
||||
this.provider.naming.getLambdaLogicalId(functionName);
|
||||
}
|
||||
this.cfTemplate.Resources[authorizerPermissionLogicalId] = permissionResource;
|
||||
}
|
||||
@ -536,10 +534,9 @@ Object.defineProperties(
|
||||
if (method === '*') {
|
||||
method = 'ANY';
|
||||
if (
|
||||
Array.from(
|
||||
allowedMethods,
|
||||
(allowedMethod) => `${allowedMethod} ${path}`
|
||||
).some((duplicateRouteKey) => routes.has(duplicateRouteKey))
|
||||
Array.from(allowedMethods, (allowedMethod) => `${allowedMethod} ${path}`).some(
|
||||
(duplicateRouteKey) => routes.has(duplicateRouteKey)
|
||||
)
|
||||
) {
|
||||
throw new ServerlessError(
|
||||
`Duplicate method for "${path}" path in function ${functionName} for httpApi event in serverless.yml`,
|
||||
|
||||
@ -42,12 +42,10 @@ class AwsCompileIotFleetProvisioningEvents {
|
||||
const templateBody = event.iotFleetProvisioning.templateBody;
|
||||
|
||||
const lambdaLogicalId = this.provider.naming.getLambdaLogicalId(functionName);
|
||||
const iotFleetProvisioningLogicalId = this.provider.naming.getIotFleetProvisioningLogicalId(
|
||||
functionName
|
||||
);
|
||||
const lambdaPermissionLogicalId = this.provider.naming.getLambdaIotFleetProvisioningPermissionLogicalId(
|
||||
functionName
|
||||
);
|
||||
const iotFleetProvisioningLogicalId =
|
||||
this.provider.naming.getIotFleetProvisioningLogicalId(functionName);
|
||||
const lambdaPermissionLogicalId =
|
||||
this.provider.naming.getLambdaIotFleetProvisioningPermissionLogicalId(functionName);
|
||||
|
||||
const provisioningTemplateResource = {
|
||||
Type: 'AWS::IoT::ProvisioningTemplate',
|
||||
|
||||
@ -18,8 +18,10 @@ module.exports = memoize(async (provider) =>
|
||||
}
|
||||
|
||||
const cfTemplate = provider.serverless.service.provider.compiledCloudFormationTemplate;
|
||||
const customResourceLogicalId = provider.naming.getCustomResourceApiGatewayAccountCloudWatchRoleResourceLogicalId();
|
||||
const customResourceFunctionLogicalId = provider.naming.getCustomResourceApiGatewayAccountCloudWatchRoleHandlerFunctionLogicalId();
|
||||
const customResourceLogicalId =
|
||||
provider.naming.getCustomResourceApiGatewayAccountCloudWatchRoleResourceLogicalId();
|
||||
const customResourceFunctionLogicalId =
|
||||
provider.naming.getCustomResourceApiGatewayAccountCloudWatchRoleHandlerFunctionLogicalId();
|
||||
|
||||
cfTemplate.Resources[customResourceLogicalId] = {
|
||||
Type: 'Custom::ApiGatewayAccountRole',
|
||||
|
||||
@ -294,10 +294,10 @@ class AwsCompileS3Events {
|
||||
});
|
||||
|
||||
const eventFunctionLogicalId = this.provider.naming.getLambdaLogicalId(functionName);
|
||||
const customResourceFunctionLogicalId = this.provider.naming.getCustomResourceS3HandlerFunctionLogicalId();
|
||||
const customS3ResourceLogicalId = this.provider.naming.getCustomResourceS3ResourceLogicalId(
|
||||
functionName
|
||||
);
|
||||
const customResourceFunctionLogicalId =
|
||||
this.provider.naming.getCustomResourceS3HandlerFunctionLogicalId();
|
||||
const customS3ResourceLogicalId =
|
||||
this.provider.naming.getCustomResourceS3ResourceLogicalId(functionName);
|
||||
|
||||
// store how often the custom S3 resource is used
|
||||
if (bucketResources[bucket]) {
|
||||
|
||||
@ -121,10 +121,11 @@ class AwsCompileScheduledEvents {
|
||||
functionName,
|
||||
scheduleNumberInFunction
|
||||
);
|
||||
const lambdaPermissionLogicalId = this.provider.naming.getLambdaSchedulePermissionLogicalId(
|
||||
functionName,
|
||||
scheduleNumberInFunction
|
||||
);
|
||||
const lambdaPermissionLogicalId =
|
||||
this.provider.naming.getLambdaSchedulePermissionLogicalId(
|
||||
functionName,
|
||||
scheduleNumberInFunction
|
||||
);
|
||||
const scheduleId = this.provider.naming.getScheduleId(functionName);
|
||||
|
||||
const scheduleTemplate = `
|
||||
|
||||
@ -103,11 +103,8 @@ class AwsCompileSNSEvents {
|
||||
}
|
||||
|
||||
if (event.sns.redrivePolicy) {
|
||||
const {
|
||||
deadLetterTargetArn,
|
||||
deadLetterTargetRef,
|
||||
deadLetterTargetImport,
|
||||
} = event.sns.redrivePolicy;
|
||||
const { deadLetterTargetArn, deadLetterTargetRef, deadLetterTargetImport } =
|
||||
event.sns.redrivePolicy;
|
||||
let targetArn;
|
||||
let targetUrl;
|
||||
|
||||
|
||||
@ -72,9 +72,8 @@ class AwsCompileSQSEvents {
|
||||
const queueLogicalId = this.provider.naming.getQueueLogicalId(functionName, queueName);
|
||||
|
||||
const dependsOn = [];
|
||||
const functionIamRoleResourceName = this.provider.resolveFunctionIamRoleResourceName(
|
||||
functionObj
|
||||
);
|
||||
const functionIamRoleResourceName =
|
||||
this.provider.resolveFunctionIamRoleResourceName(functionObj);
|
||||
if (functionIamRoleResourceName) {
|
||||
dependsOn.push(functionIamRoleResourceName);
|
||||
}
|
||||
@ -117,8 +116,9 @@ class AwsCompileSQSEvents {
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Resources
|
||||
.IamRoleLambdaExecution
|
||||
) {
|
||||
const statement = this.serverless.service.provider.compiledCloudFormationTemplate
|
||||
.Resources.IamRoleLambdaExecution.Properties.Policies[0].PolicyDocument.Statement;
|
||||
const statement =
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Resources
|
||||
.IamRoleLambdaExecution.Properties.Policies[0].PolicyDocument.Statement;
|
||||
if (sqsStatement.Resource.length) {
|
||||
statement.push(sqsStatement);
|
||||
}
|
||||
|
||||
@ -188,9 +188,8 @@ class AwsCompileStreamEvents {
|
||||
);
|
||||
|
||||
const dependsOn = [];
|
||||
const functionIamRoleResourceName = this.provider.resolveFunctionIamRoleResourceName(
|
||||
functionObj
|
||||
);
|
||||
const functionIamRoleResourceName =
|
||||
this.provider.resolveFunctionIamRoleResourceName(functionObj);
|
||||
if (functionIamRoleResourceName) {
|
||||
dependsOn.push(functionIamRoleResourceName);
|
||||
}
|
||||
@ -285,9 +284,8 @@ class AwsCompileStreamEvents {
|
||||
ConsumerName: consumerName,
|
||||
},
|
||||
};
|
||||
const consumerLogicalId = this.provider.naming.getStreamConsumerLogicalId(
|
||||
consumerName
|
||||
);
|
||||
const consumerLogicalId =
|
||||
this.provider.naming.getStreamConsumerLogicalId(consumerName);
|
||||
newStreamObject[consumerLogicalId] = consumerResource;
|
||||
if (Array.isArray(streamResource.DependsOn)) {
|
||||
streamResource.DependsOn.push(consumerLogicalId);
|
||||
@ -318,8 +316,9 @@ class AwsCompileStreamEvents {
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Resources
|
||||
.IamRoleLambdaExecution
|
||||
) {
|
||||
const statement = this.serverless.service.provider.compiledCloudFormationTemplate
|
||||
.Resources.IamRoleLambdaExecution.Properties.Policies[0].PolicyDocument.Statement;
|
||||
const statement =
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Resources
|
||||
.IamRoleLambdaExecution.Properties.Policies[0].PolicyDocument.Statement;
|
||||
if (dynamodbStreamStatement.Resource.length) {
|
||||
statement.push(dynamodbStreamStatement);
|
||||
}
|
||||
|
||||
@ -30,8 +30,10 @@ module.exports = {
|
||||
},
|
||||
});
|
||||
|
||||
const defaultRoleResource = this.serverless.service.provider.compiledCloudFormationTemplate
|
||||
.Resources[this.provider.naming.getRoleLogicalId()];
|
||||
const defaultRoleResource =
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Resources[
|
||||
this.provider.naming.getRoleLogicalId()
|
||||
];
|
||||
|
||||
if (defaultRoleResource) {
|
||||
// insert policy that allows functions to postToConnection
|
||||
|
||||
@ -24,9 +24,8 @@ module.exports = {
|
||||
.createHash('sha256')
|
||||
.update(JSON.stringify(websocketsTemplatePart))
|
||||
.digest('base64');
|
||||
this.websocketsDeploymentLogicalId = this.provider.naming.getWebsocketsDeploymentLogicalId(
|
||||
cfTemplateHash
|
||||
);
|
||||
this.websocketsDeploymentLogicalId =
|
||||
this.provider.naming.getWebsocketsDeploymentLogicalId(cfTemplateHash);
|
||||
|
||||
const resources = this.serverless.service.provider.compiledCloudFormationTemplate.Resources;
|
||||
_.merge(resources, {
|
||||
|
||||
@ -8,9 +8,8 @@ module.exports = {
|
||||
const websocketApiId = this.provider.getApiGatewayWebsocketApiId();
|
||||
const lambdaLogicalId = this.provider.naming.getLambdaLogicalId(event.functionName);
|
||||
|
||||
const websocketsPermissionLogicalId = this.provider.naming.getLambdaWebsocketsPermissionLogicalId(
|
||||
event.functionName
|
||||
);
|
||||
const websocketsPermissionLogicalId =
|
||||
this.provider.naming.getLambdaWebsocketsPermissionLogicalId(event.functionName);
|
||||
|
||||
_.merge(this.serverless.service.provider.compiledCloudFormationTemplate.Resources, {
|
||||
[websocketsPermissionLogicalId]: {
|
||||
@ -27,9 +26,8 @@ module.exports = {
|
||||
});
|
||||
|
||||
if (event.authorizer) {
|
||||
const websocketsAuthorizerPermissionLogicalId = this.provider.naming.getLambdaWebsocketsPermissionLogicalId(
|
||||
event.authorizer.name
|
||||
);
|
||||
const websocketsAuthorizerPermissionLogicalId =
|
||||
this.provider.naming.getLambdaWebsocketsPermissionLogicalId(event.authorizer.name);
|
||||
|
||||
const authorizerPermissionTemplate = {
|
||||
[websocketsAuthorizerPermissionLogicalId]: {
|
||||
|
||||
@ -7,9 +7,8 @@ module.exports = {
|
||||
return;
|
||||
}
|
||||
|
||||
const websocketsRouteResponseLogicalId = this.provider.naming.getWebsocketsRouteResponseLogicalId(
|
||||
event.route
|
||||
);
|
||||
const websocketsRouteResponseLogicalId =
|
||||
this.provider.naming.getWebsocketsRouteResponseLogicalId(event.route);
|
||||
|
||||
const websocketsRouteLogicalId = this.provider.naming.getWebsocketsRouteLogicalId(
|
||||
event.route
|
||||
|
||||
@ -533,9 +533,8 @@ class AwsCompileFunctions {
|
||||
Object.assign(cfTemplate.Resources, newVersionObject);
|
||||
|
||||
// Add function versions to Outputs section
|
||||
const functionVersionOutputLogicalId = this.provider.naming.getLambdaVersionOutputLogicalId(
|
||||
functionName
|
||||
);
|
||||
const functionVersionOutputLogicalId =
|
||||
this.provider.naming.getLambdaVersionOutputLogicalId(functionName);
|
||||
const newVersionOutput = this.cfOutputLatestVersionTemplate();
|
||||
|
||||
newVersionOutput.Value = { Ref: versionLogicalId };
|
||||
@ -548,9 +547,8 @@ class AwsCompileFunctions {
|
||||
if (!shouldVersionFunction) delete versionResource.DeletionPolicy;
|
||||
|
||||
const provisionedConcurrency = Number(functionObject.provisionedConcurrency);
|
||||
const aliasLogicalId = this.provider.naming.getLambdaProvisionedConcurrencyAliasLogicalId(
|
||||
functionName
|
||||
);
|
||||
const aliasLogicalId =
|
||||
this.provider.naming.getLambdaProvisionedConcurrencyAliasLogicalId(functionName);
|
||||
const aliasName = this.provider.naming.getLambdaProvisionedConcurrencyAliasName();
|
||||
|
||||
functionObject.targetAlias = { name: aliasName, logicalId: aliasLogicalId };
|
||||
@ -637,8 +635,9 @@ class AwsCompileFunctions {
|
||||
|
||||
// Memoized in a constructor
|
||||
ensureTargetExecutionPermission(functionAddress) {
|
||||
const iamPolicyStatements = this.serverless.service.provider.compiledCloudFormationTemplate
|
||||
.Resources.IamRoleLambdaExecution.Properties.Policies[0].PolicyDocument.Statement;
|
||||
const iamPolicyStatements =
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Resources
|
||||
.IamRoleLambdaExecution.Properties.Policies[0].PolicyDocument.Statement;
|
||||
|
||||
const action = (() => {
|
||||
if (!functionAddress.startsWith('arn:') || functionAddress.includes(':function:')) {
|
||||
|
||||
@ -99,15 +99,13 @@ class AwsCompileLayers {
|
||||
|
||||
newLayerOutput.Value = { Ref: layerLogicalId };
|
||||
|
||||
const layerHashOutputLogicalId = this.provider.naming.getLambdaLayerHashOutputLogicalId(
|
||||
layerName
|
||||
);
|
||||
const layerHashOutputLogicalId =
|
||||
this.provider.naming.getLambdaLayerHashOutputLogicalId(layerName);
|
||||
const newLayerHashOutput = this.cfOutputLayerHashTemplate();
|
||||
newLayerHashOutput.Value = sha;
|
||||
|
||||
const layerS3KeyOutputLogicalId = this.provider.naming.getLambdaLayerS3KeyOutputLogicalId(
|
||||
layerName
|
||||
);
|
||||
const layerS3KeyOutputLogicalId =
|
||||
this.provider.naming.getLambdaLayerS3KeyOutputLogicalId(layerName);
|
||||
const newLayerS3KeyOutput = this.cfOutputLayerS3KeyTemplate();
|
||||
newLayerS3KeyOutput.Value = newLayer.Properties.Content.S3Key;
|
||||
|
||||
@ -121,25 +119,23 @@ class AwsCompileLayers {
|
||||
|
||||
async compareWithLastLayer(layerName) {
|
||||
const stackName = this.provider.naming.getStackName();
|
||||
const layerHashOutputLogicalId = this.provider.naming.getLambdaLayerHashOutputLogicalId(
|
||||
layerName
|
||||
);
|
||||
const layerHashOutputLogicalId =
|
||||
this.provider.naming.getLambdaLayerHashOutputLogicalId(layerName);
|
||||
|
||||
return this.provider.request('CloudFormation', 'describeStacks', { StackName: stackName }).then(
|
||||
(data) => {
|
||||
const lastHash = data.Stacks[0].Outputs.find(
|
||||
(output) => output.OutputKey === layerHashOutputLogicalId
|
||||
);
|
||||
const compiledCloudFormationTemplate = this.serverless.service.provider
|
||||
.compiledCloudFormationTemplate;
|
||||
const compiledCloudFormationTemplate =
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate;
|
||||
const newSha = compiledCloudFormationTemplate.Outputs[layerHashOutputLogicalId].Value;
|
||||
if (lastHash == null || lastHash.OutputValue !== newSha) {
|
||||
return;
|
||||
}
|
||||
|
||||
const layerS3keyOutputLogicalId = this.provider.naming.getLambdaLayerS3KeyOutputLogicalId(
|
||||
layerName
|
||||
);
|
||||
const layerS3keyOutputLogicalId =
|
||||
this.provider.naming.getLambdaLayerS3KeyOutputLogicalId(layerName);
|
||||
const lastS3Key = data.Stacks[0].Outputs.find(
|
||||
(output) => output.OutputKey === layerS3keyOutputLogicalId
|
||||
);
|
||||
|
||||
@ -6,16 +6,17 @@ const ServerlessError = require('../../../../serverless-error');
|
||||
|
||||
module.exports = {
|
||||
generateCoreTemplate() {
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate = this.serverless.utils.readFileSync(
|
||||
path.join(
|
||||
this.serverless.config.serverlessPath,
|
||||
'plugins',
|
||||
'aws',
|
||||
'package',
|
||||
'lib',
|
||||
'core-cloudformation-template.json'
|
||||
)
|
||||
);
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate =
|
||||
this.serverless.utils.readFileSync(
|
||||
path.join(
|
||||
this.serverless.config.serverlessPath,
|
||||
'plugins',
|
||||
'aws',
|
||||
'package',
|
||||
'lib',
|
||||
'core-cloudformation-template.json'
|
||||
)
|
||||
);
|
||||
|
||||
const bucketName = this.serverless.service.provider.deploymentBucket;
|
||||
|
||||
@ -60,7 +61,8 @@ module.exports = {
|
||||
}
|
||||
|
||||
if (deploymentBucketObject.skipPolicySetup) {
|
||||
const deploymentBucketPolicyLogicalId = this.provider.naming.getDeploymentBucketPolicyLogicalId();
|
||||
const deploymentBucketPolicyLogicalId =
|
||||
this.provider.naming.getDeploymentBucketPolicyLogicalId();
|
||||
delete this.serverless.service.provider.compiledCloudFormationTemplate.Resources[
|
||||
deploymentBucketPolicyLogicalId
|
||||
];
|
||||
@ -86,7 +88,8 @@ module.exports = {
|
||||
}
|
||||
this.bucketName = bucketName;
|
||||
this.serverless.service.package.deploymentBucket = bucketName;
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Outputs.ServerlessDeploymentBucketName.Value = bucketName;
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Outputs.ServerlessDeploymentBucketName.Value =
|
||||
bucketName;
|
||||
|
||||
delete this.serverless.service.provider.compiledCloudFormationTemplate.Resources
|
||||
.ServerlessDeploymentBucket;
|
||||
@ -107,9 +110,10 @@ module.exports = {
|
||||
}
|
||||
);
|
||||
// keep track of acceleration status via CloudFormation Output
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Outputs.ServerlessDeploymentBucketAccelerated = {
|
||||
Value: true,
|
||||
};
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Outputs.ServerlessDeploymentBucketAccelerated =
|
||||
{
|
||||
Value: true,
|
||||
};
|
||||
} else if (isS3TransferAccelerationDisabled && isS3TransferAccelerationSupported) {
|
||||
// explicitly disable acceleration via CloudFormation
|
||||
Object.assign(
|
||||
|
||||
@ -86,10 +86,12 @@ module.exports = {
|
||||
} else if (iamRole.permissionBoundary) {
|
||||
iamRoleLambdaExecutionTemplate.Properties.PermissionsBoundary = iamRole.permissionBoundary;
|
||||
} else if (this.serverless.service.provider.rolePermissionsBoundary) {
|
||||
iamRoleLambdaExecutionTemplate.Properties.PermissionsBoundary = this.serverless.service.provider.rolePermissionsBoundary;
|
||||
iamRoleLambdaExecutionTemplate.Properties.PermissionsBoundary =
|
||||
this.serverless.service.provider.rolePermissionsBoundary;
|
||||
}
|
||||
|
||||
iamRoleLambdaExecutionTemplate.Properties.Policies[0].PolicyName = this.provider.naming.getPolicyName();
|
||||
iamRoleLambdaExecutionTemplate.Properties.Policies[0].PolicyName =
|
||||
this.provider.naming.getPolicyName();
|
||||
|
||||
_.merge(this.serverless.service.provider.compiledCloudFormationTemplate.Resources, {
|
||||
[this.provider.naming.getRoleLogicalId()]: iamRoleLambdaExecutionTemplate,
|
||||
@ -100,19 +102,18 @@ module.exports = {
|
||||
}-${this.provider.getStage()}`;
|
||||
const logGroupsPrefix = this.provider.naming.getLogGroupName(canonicalFunctionNamePrefix);
|
||||
|
||||
const policyDocumentStatements = this.serverless.service.provider.compiledCloudFormationTemplate
|
||||
.Resources[this.provider.naming.getRoleLogicalId()].Properties.Policies[0].PolicyDocument
|
||||
.Statement;
|
||||
const policyDocumentStatements =
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Resources[
|
||||
this.provider.naming.getRoleLogicalId()
|
||||
].Properties.Policies[0].PolicyDocument.Statement;
|
||||
|
||||
let hasOneOrMoreCanonicallyNamedFunctions = false;
|
||||
const disableLogsCanonicallyNamedFunctions = [];
|
||||
|
||||
// Ensure policies for functions with custom name resolution
|
||||
this.serverless.service.getAllFunctions().forEach((functionName) => {
|
||||
const {
|
||||
name: resolvedFunctionName,
|
||||
disableLogs: areLogsDisabled,
|
||||
} = this.serverless.service.getFunction(functionName);
|
||||
const { name: resolvedFunctionName, disableLogs: areLogsDisabled } =
|
||||
this.serverless.service.getFunction(functionName);
|
||||
if (!resolvedFunctionName || resolvedFunctionName.startsWith(canonicalFunctionNamePrefix)) {
|
||||
if (areLogsDisabled) {
|
||||
disableLogsCanonicallyNamedFunctions.push(resolvedFunctionName);
|
||||
@ -123,9 +124,8 @@ module.exports = {
|
||||
}
|
||||
|
||||
if (!areLogsDisabled) {
|
||||
const customFunctionNamelogGroupsPrefix = this.provider.naming.getLogGroupName(
|
||||
resolvedFunctionName
|
||||
);
|
||||
const customFunctionNamelogGroupsPrefix =
|
||||
this.provider.naming.getLogGroupName(resolvedFunctionName);
|
||||
|
||||
policyDocumentStatements[0].Resource.push({
|
||||
'Fn::Sub':
|
||||
@ -214,9 +214,10 @@ module.exports = {
|
||||
|
||||
mergeManagedPolicies(managedPolicies) {
|
||||
if (!managedPolicies.length) return;
|
||||
const resource = this.serverless.service.provider.compiledCloudFormationTemplate.Resources[
|
||||
this.provider.naming.getRoleLogicalId()
|
||||
].Properties;
|
||||
const resource =
|
||||
this.serverless.service.provider.compiledCloudFormationTemplate.Resources[
|
||||
this.provider.naming.getRoleLogicalId()
|
||||
].Properties;
|
||||
if (!Array.isArray(resource.ManagedPolicyArns)) {
|
||||
resource.ManagedPolicyArns = [];
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@
|
||||
"mock-require": "^3.0.3",
|
||||
"nyc": "^15.1.0",
|
||||
"pkg": "^4.5.1",
|
||||
"prettier": "^2.2.1",
|
||||
"prettier": "^2.3.0",
|
||||
"process-utils": "^4.0.0",
|
||||
"proxyquire": "^2.1.3",
|
||||
"semver-regex": "^3.1.2",
|
||||
|
||||
@ -415,9 +415,8 @@ const processSpanPromise = (async () => {
|
||||
{ providerName: providerName || 'aws', configuration }
|
||||
);
|
||||
resolveInput.clear();
|
||||
({ command, commands, options, isHelpRequest, commandSchema } = resolveInput(
|
||||
commandsSchema
|
||||
));
|
||||
({ command, commands, options, isHelpRequest, commandSchema } =
|
||||
resolveInput(commandsSchema));
|
||||
serverless.processedInput.commands = serverless.pluginManager.cliCommands = commands;
|
||||
serverless.processedInput.options = serverless.pluginManager.cliOptions = options;
|
||||
hasFinalCommandSchema = true;
|
||||
@ -479,9 +478,8 @@ const processSpanPromise = (async () => {
|
||||
}
|
||||
|
||||
// Register serverless instance and AWS provider specific variable sources
|
||||
resolverConfiguration.sources.sls = require('../lib/configuration/variables/sources/instance-dependent/get-sls')(
|
||||
serverless
|
||||
);
|
||||
resolverConfiguration.sources.sls =
|
||||
require('../lib/configuration/variables/sources/instance-dependent/get-sls')(serverless);
|
||||
resolverConfiguration.fulfilledSources.add('sls');
|
||||
|
||||
if (providerName === 'aws') {
|
||||
@ -580,9 +578,8 @@ const processSpanPromise = (async () => {
|
||||
}
|
||||
|
||||
// Report unrecognized variable sources found in variables configured in service config
|
||||
const unresolvedSources = require('../lib/configuration/variables/resolve-unresolved-source-types')(
|
||||
variablesMeta
|
||||
);
|
||||
const unresolvedSources =
|
||||
require('../lib/configuration/variables/resolve-unresolved-source-types')(variablesMeta);
|
||||
if (!(configuration.variablesResolutionMode >= 20210326)) {
|
||||
unresolvedSources.delete('opt');
|
||||
const legacyCfVarPropertyPaths = new Set();
|
||||
|
||||
@ -131,11 +131,12 @@ describe('ConfigSchemaHandler', () => {
|
||||
command: 'info',
|
||||
});
|
||||
|
||||
const existingEventDefinition = serverless.serverless.configSchemaHandler.schema.properties.functions.patternProperties[
|
||||
FUNCTION_NAME_PATTERN
|
||||
].properties.events.items.anyOf.find(
|
||||
(definition) => definition.required[0] === 'existingEvent'
|
||||
).properties.existingEvent;
|
||||
const existingEventDefinition =
|
||||
serverless.serverless.configSchemaHandler.schema.properties.functions.patternProperties[
|
||||
FUNCTION_NAME_PATTERN
|
||||
].properties.events.items.anyOf.find(
|
||||
(definition) => definition.required[0] === 'existingEvent'
|
||||
).properties.existingEvent;
|
||||
|
||||
expect(existingEventDefinition.properties).to.have.deep.property(
|
||||
'somePluginAdditionalEventProp',
|
||||
@ -152,11 +153,12 @@ describe('ConfigSchemaHandler', () => {
|
||||
command: 'info',
|
||||
});
|
||||
|
||||
const existingEventDefinition = serverless.serverless.configSchemaHandler.schema.properties.functions.patternProperties[
|
||||
FUNCTION_NAME_PATTERN
|
||||
].properties.events.items.anyOf.find(
|
||||
(definition) => definition.required[0] === 'existingComplexEvent'
|
||||
).properties.existingComplexEvent;
|
||||
const existingEventDefinition =
|
||||
serverless.serverless.configSchemaHandler.schema.properties.functions.patternProperties[
|
||||
FUNCTION_NAME_PATTERN
|
||||
].properties.events.items.anyOf.find(
|
||||
(definition) => definition.required[0] === 'existingComplexEvent'
|
||||
).properties.existingComplexEvent;
|
||||
|
||||
expect(existingEventDefinition).to.deep.equal({
|
||||
anyOf: [
|
||||
|
||||
@ -400,16 +400,14 @@ describe('test/unit/lib/plugins/aws/deploy/index.test.js', () => {
|
||||
const listObjectsV2Stub = sinon.stub().resolves({
|
||||
Contents: [
|
||||
{
|
||||
Key:
|
||||
'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/compiled-cloudformation-template.json',
|
||||
Key: 'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/compiled-cloudformation-template.json',
|
||||
LastModified: new Date(),
|
||||
ETag: '"5102a4cf710cae6497dba9e61b85d0a4"',
|
||||
Size: 356,
|
||||
StorageClass: 'STANDARD',
|
||||
},
|
||||
{
|
||||
Key:
|
||||
'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/my-own.zip',
|
||||
Key: 'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/my-own.zip',
|
||||
LastModified: new Date(),
|
||||
ETag: '"5102a4cf710cae6497dba9e61b85d0a4"',
|
||||
Size: 356,
|
||||
@ -421,8 +419,7 @@ describe('test/unit/lib/plugins/aws/deploy/index.test.js', () => {
|
||||
s3HeadObjectStub
|
||||
.withArgs({
|
||||
Bucket: 's3-bucket-resource',
|
||||
Key:
|
||||
'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/compiled-cloudformation-template.json',
|
||||
Key: 'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/compiled-cloudformation-template.json',
|
||||
})
|
||||
.returns({
|
||||
Metadata: { filesha256: 'qxp+iwSTMhcRUfHzka4AE4XAWawS8GnEyBh1WpGb7Vw=' },
|
||||
@ -430,8 +427,7 @@ describe('test/unit/lib/plugins/aws/deploy/index.test.js', () => {
|
||||
s3HeadObjectStub
|
||||
.withArgs({
|
||||
Bucket: 's3-bucket-resource',
|
||||
Key:
|
||||
'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/my-own.zip',
|
||||
Key: 'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/my-own.zip',
|
||||
})
|
||||
.returns({
|
||||
Metadata: { filesha256: 'T0qEYHOE4Xv2E8Ar03xGogAlElcdf/dQh/lh9ao7Glo=' },
|
||||
|
||||
@ -601,8 +601,7 @@ describe('checkForChanges #2', () => {
|
||||
listObjectsV2: {
|
||||
Contents: [
|
||||
{
|
||||
Key:
|
||||
'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/artifact.zip',
|
||||
Key: 'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/artifact.zip',
|
||||
LastModified: new Date(),
|
||||
ETag: '"5102a4cf710cae6497dba9e61b85d0a4"',
|
||||
Size: 356,
|
||||
@ -1041,8 +1040,7 @@ describe('test/unit/lib/plugins/aws/deploy/lib/checkForChanges.test.js', () => {
|
||||
headObjectStub
|
||||
.withArgs({
|
||||
Bucket: 'deployment-bucket',
|
||||
Key:
|
||||
'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/compiled-cloudformation-template.json',
|
||||
Key: 'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/compiled-cloudformation-template.json',
|
||||
})
|
||||
.returns({
|
||||
Metadata: { filesha256: 'pZOdrt6qijT7ITsLQjPP9QwgMAfKA2RuUUSTW+l8wWs=' },
|
||||
@ -1051,8 +1049,7 @@ describe('test/unit/lib/plugins/aws/deploy/lib/checkForChanges.test.js', () => {
|
||||
headObjectStub
|
||||
.withArgs({
|
||||
Bucket: 'deployment-bucket',
|
||||
Key:
|
||||
'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/my-own.zip',
|
||||
Key: 'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/my-own.zip',
|
||||
})
|
||||
.returns({
|
||||
Metadata: { filesha256: 'T0qEYHOE4Xv2E8Ar03xGogAlElcdf/dQh/lh9ao7Glo=' },
|
||||
@ -1063,16 +1060,14 @@ describe('test/unit/lib/plugins/aws/deploy/lib/checkForChanges.test.js', () => {
|
||||
listObjectsV2: {
|
||||
Contents: [
|
||||
{
|
||||
Key:
|
||||
'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/compiled-cloudformation-template.json',
|
||||
Key: 'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/compiled-cloudformation-template.json',
|
||||
LastModified: new Date(),
|
||||
ETag: '"5102a4cf710cae6497dba9e61b85d0a4"',
|
||||
Size: 356,
|
||||
StorageClass: 'STANDARD',
|
||||
},
|
||||
{
|
||||
Key:
|
||||
'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/my-own.zip',
|
||||
Key: 'serverless/test-package-artifact/dev/1589988704359-2020-05-20T15:31:44.359Z/my-own.zip',
|
||||
LastModified: new Date(),
|
||||
ETag: '"5102a4cf710cae6497dba9e61b85d0a4"',
|
||||
Size: 356,
|
||||
|
||||
@ -355,62 +355,63 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
],
|
||||
},
|
||||
};
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
},
|
||||
},
|
||||
IamRoleLambdaExecution: {
|
||||
Type: 'AWS::IAM::Role',
|
||||
Properties: {
|
||||
AssumeRolePolicyDocument: {
|
||||
Version: '2012-10-17',
|
||||
Statement: [
|
||||
{
|
||||
Effect: 'Allow',
|
||||
Principal: {
|
||||
Service: ['lambda.amazonaws.com'],
|
||||
},
|
||||
Action: ['sts:AssumeRole'],
|
||||
},
|
||||
],
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
Policies: [
|
||||
{
|
||||
PolicyName: {
|
||||
'Fn::Join': ['-', ['dev', 'first', 'lambda']],
|
||||
},
|
||||
PolicyDocument: {
|
||||
Version: '2012-10-17',
|
||||
Statement: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
Path: '/',
|
||||
RoleName: {
|
||||
'Fn::Join': [
|
||||
'-',
|
||||
[
|
||||
'first',
|
||||
'dev',
|
||||
},
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
},
|
||||
},
|
||||
IamRoleLambdaExecution: {
|
||||
Type: 'AWS::IAM::Role',
|
||||
Properties: {
|
||||
AssumeRolePolicyDocument: {
|
||||
Version: '2012-10-17',
|
||||
Statement: [
|
||||
{
|
||||
Ref: 'AWS::Region',
|
||||
Effect: 'Allow',
|
||||
Principal: {
|
||||
Service: ['lambda.amazonaws.com'],
|
||||
},
|
||||
Action: ['sts:AssumeRole'],
|
||||
},
|
||||
'lambdaRole',
|
||||
],
|
||||
},
|
||||
Policies: [
|
||||
{
|
||||
PolicyName: {
|
||||
'Fn::Join': ['-', ['dev', 'first', 'lambda']],
|
||||
},
|
||||
PolicyDocument: {
|
||||
Version: '2012-10-17',
|
||||
Statement: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
Path: '/',
|
||||
RoleName: {
|
||||
'Fn::Join': [
|
||||
'-',
|
||||
[
|
||||
'first',
|
||||
'dev',
|
||||
{
|
||||
Ref: 'AWS::Region',
|
||||
},
|
||||
'lambdaRole',
|
||||
],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
expect(() => awsCompileCloudFrontEvents.compileCloudFrontEvents()).to.throw(
|
||||
/to the us-east-1 region/
|
||||
@ -431,62 +432,63 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
],
|
||||
},
|
||||
};
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
},
|
||||
},
|
||||
IamRoleLambdaExecution: {
|
||||
Type: 'AWS::IAM::Role',
|
||||
Properties: {
|
||||
AssumeRolePolicyDocument: {
|
||||
Version: '2012-10-17',
|
||||
Statement: [
|
||||
{
|
||||
Effect: 'Allow',
|
||||
Principal: {
|
||||
Service: ['lambda.amazonaws.com'],
|
||||
},
|
||||
Action: ['sts:AssumeRole'],
|
||||
},
|
||||
],
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
Policies: [
|
||||
{
|
||||
PolicyName: {
|
||||
'Fn::Join': ['-', ['dev', 'first', 'lambda']],
|
||||
},
|
||||
PolicyDocument: {
|
||||
Version: '2012-10-17',
|
||||
Statement: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
Path: '/',
|
||||
RoleName: {
|
||||
'Fn::Join': [
|
||||
'-',
|
||||
[
|
||||
'first',
|
||||
'dev',
|
||||
},
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
},
|
||||
},
|
||||
IamRoleLambdaExecution: {
|
||||
Type: 'AWS::IAM::Role',
|
||||
Properties: {
|
||||
AssumeRolePolicyDocument: {
|
||||
Version: '2012-10-17',
|
||||
Statement: [
|
||||
{
|
||||
Ref: 'AWS::Region',
|
||||
Effect: 'Allow',
|
||||
Principal: {
|
||||
Service: ['lambda.amazonaws.com'],
|
||||
},
|
||||
Action: ['sts:AssumeRole'],
|
||||
},
|
||||
'lambdaRole',
|
||||
],
|
||||
},
|
||||
Policies: [
|
||||
{
|
||||
PolicyName: {
|
||||
'Fn::Join': ['-', ['dev', 'first', 'lambda']],
|
||||
},
|
||||
PolicyDocument: {
|
||||
Version: '2012-10-17',
|
||||
Statement: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
Path: '/',
|
||||
RoleName: {
|
||||
'Fn::Join': [
|
||||
'-',
|
||||
[
|
||||
'first',
|
||||
'dev',
|
||||
{
|
||||
Ref: 'AWS::Region',
|
||||
},
|
||||
'lambdaRole',
|
||||
],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
|
||||
@ -607,20 +609,21 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
|
||||
@ -677,20 +680,21 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
|
||||
@ -744,14 +748,15 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
|
||||
@ -807,20 +812,21 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
|
||||
@ -863,14 +869,15 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
|
||||
@ -936,20 +943,21 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
|
||||
@ -1001,20 +1009,21 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
expect(() => {
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
@ -1048,32 +1057,33 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
},
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'SecondLambdaFunction' },
|
||||
SecondLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'SecondLambdaFunction' },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
|
||||
@ -1134,20 +1144,21 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
},
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
|
||||
@ -1213,32 +1224,33 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
},
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'SecondLambdaFunction' },
|
||||
SecondLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'SecondLambdaFunction' },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
|
||||
@ -1321,32 +1333,33 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
},
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'SecondLambdaFunction' },
|
||||
SecondLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'SecondLambdaFunction' },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
expect(() => {
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
@ -1382,32 +1395,33 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
},
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'SecondLambdaFunction' },
|
||||
SecondLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'SecondLambdaFunction' },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
|
||||
@ -1464,20 +1478,21 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
},
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
|
||||
@ -1532,32 +1547,33 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
},
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'SecondLambdaFunction' },
|
||||
SecondLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'SecondLambdaFunction' },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
expect(() => {
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
@ -1592,32 +1608,33 @@ describe('AwsCompileCloudFrontEvents', () => {
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
awsCompileCloudFrontEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
FirstLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'first',
|
||||
},
|
||||
},
|
||||
},
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
FirstLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'FirstLambdaFunction' },
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
SecondLambdaFunction: {
|
||||
Type: 'AWS::Lambda::Function',
|
||||
Properties: {
|
||||
FunctionName: 'second',
|
||||
},
|
||||
},
|
||||
},
|
||||
SecondLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'SecondLambdaFunction' },
|
||||
SecondLambdaVersion: {
|
||||
Type: 'AWS::Lambda::Version',
|
||||
Properties: {
|
||||
FunctionName: { Ref: 'SecondLambdaFunction' },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
expect(() => {
|
||||
awsCompileCloudFrontEvents.compileCloudFrontEvents();
|
||||
|
||||
@ -295,9 +295,9 @@ describe('AwsCompileCognitoUserPoolEvents', () => {
|
||||
return expect(
|
||||
awsCompileCognitoUserPoolEvents.existingCognitoUserPools()
|
||||
).to.be.fulfilled.then(() => {
|
||||
const {
|
||||
Resources,
|
||||
} = awsCompileCognitoUserPoolEvents.serverless.service.provider.compiledCloudFormationTemplate;
|
||||
const { Resources } =
|
||||
awsCompileCognitoUserPoolEvents.serverless.service.provider
|
||||
.compiledCloudFormationTemplate;
|
||||
|
||||
expect(addCustomResourceToServiceStub).to.have.been.calledOnce;
|
||||
expect(addCustomResourceToServiceStub.args[0][1]).to.equal('cognitoUserPool');
|
||||
@ -377,9 +377,9 @@ describe('AwsCompileCognitoUserPoolEvents', () => {
|
||||
return expect(
|
||||
awsCompileCognitoUserPoolEvents.existingCognitoUserPools()
|
||||
).to.be.fulfilled.then(() => {
|
||||
const {
|
||||
Resources,
|
||||
} = awsCompileCognitoUserPoolEvents.serverless.service.provider.compiledCloudFormationTemplate;
|
||||
const { Resources } =
|
||||
awsCompileCognitoUserPoolEvents.serverless.service.provider
|
||||
.compiledCloudFormationTemplate;
|
||||
|
||||
expect(addCustomResourceToServiceStub).to.have.been.calledOnce;
|
||||
expect(addCustomResourceToServiceStub.args[0][1]).to.equal('cognitoUserPool');
|
||||
@ -491,9 +491,9 @@ describe('AwsCompileCognitoUserPoolEvents', () => {
|
||||
return expect(
|
||||
awsCompileCognitoUserPoolEvents.existingCognitoUserPools()
|
||||
).to.be.fulfilled.then(() => {
|
||||
const {
|
||||
Resources,
|
||||
} = awsCompileCognitoUserPoolEvents.serverless.service.provider.compiledCloudFormationTemplate;
|
||||
const { Resources } =
|
||||
awsCompileCognitoUserPoolEvents.serverless.service.provider
|
||||
.compiledCloudFormationTemplate;
|
||||
|
||||
expect(addCustomResourceToServiceStub).to.have.been.calledOnce;
|
||||
expect(addCustomResourceToServiceStub.args[0][1]).to.equal('cognitoUserPool');
|
||||
|
||||
@ -156,9 +156,8 @@ describe('EventBridgeEvents', () => {
|
||||
it('should create the correct policy Statement', () => {
|
||||
const roleId = naming.getCustomResourcesRoleLogicalId('default', '12345');
|
||||
|
||||
const [firstStatement, secondStatement, thirdStatment] = cfResources[
|
||||
roleId
|
||||
].Properties.Policies[0].PolicyDocument.Statement;
|
||||
const [firstStatement, secondStatement, thirdStatment] =
|
||||
cfResources[roleId].Properties.Policies[0].PolicyDocument.Statement;
|
||||
expect(firstStatement.Effect).to.be.eq('Allow');
|
||||
expect(firstStatement.Resource['Fn::Join'][1]).to.deep.include('arn');
|
||||
expect(firstStatement.Resource['Fn::Join'][1]).to.deep.include('events');
|
||||
|
||||
@ -462,9 +462,8 @@ describe('lib/plugins/aws/package/compile/events/httpApi.test.js', () => {
|
||||
});
|
||||
|
||||
it('should create permission resource when authorizer references function from service', () => {
|
||||
const authorizerPermissionLogicalId = naming.getLambdaAuthorizerHttpApiPermissionLogicalId(
|
||||
'someAuthorizer'
|
||||
);
|
||||
const authorizerPermissionLogicalId =
|
||||
naming.getLambdaAuthorizerHttpApiPermissionLogicalId('someAuthorizer');
|
||||
expect(cfResources[authorizerPermissionLogicalId]).to.deep.equal({
|
||||
Type: 'AWS::Lambda::Permission',
|
||||
Properties: {
|
||||
|
||||
@ -373,9 +373,8 @@ describe('AwsCompileS3Events', () => {
|
||||
};
|
||||
|
||||
return expect(awsCompileS3Events.existingS3Buckets()).to.be.fulfilled.then(() => {
|
||||
const {
|
||||
Resources,
|
||||
} = awsCompileS3Events.serverless.service.provider.compiledCloudFormationTemplate;
|
||||
const { Resources } =
|
||||
awsCompileS3Events.serverless.service.provider.compiledCloudFormationTemplate;
|
||||
|
||||
expect(addCustomResourceToServiceStub).to.have.been.calledOnce;
|
||||
expect(addCustomResourceToServiceStub.args[0][1]).to.equal('s3');
|
||||
@ -458,9 +457,8 @@ describe('AwsCompileS3Events', () => {
|
||||
};
|
||||
|
||||
return expect(awsCompileS3Events.existingS3Buckets()).to.be.fulfilled.then(() => {
|
||||
const {
|
||||
Resources,
|
||||
} = awsCompileS3Events.serverless.service.provider.compiledCloudFormationTemplate;
|
||||
const { Resources } =
|
||||
awsCompileS3Events.serverless.service.provider.compiledCloudFormationTemplate;
|
||||
|
||||
expect(addCustomResourceToServiceStub).to.have.been.calledOnce;
|
||||
expect(addCustomResourceToServiceStub.args[0][1]).to.equal('s3');
|
||||
@ -564,9 +562,8 @@ describe('AwsCompileS3Events', () => {
|
||||
};
|
||||
|
||||
return expect(awsCompileS3Events.existingS3Buckets()).to.be.fulfilled.then(() => {
|
||||
const {
|
||||
Resources,
|
||||
} = awsCompileS3Events.serverless.service.provider.compiledCloudFormationTemplate;
|
||||
const { Resources } =
|
||||
awsCompileS3Events.serverless.service.provider.compiledCloudFormationTemplate;
|
||||
|
||||
expect(addCustomResourceToServiceStub).to.have.been.calledOnce;
|
||||
expect(addCustomResourceToServiceStub.args[0][1]).to.equal('s3');
|
||||
@ -745,9 +742,8 @@ describe('AwsCompileS3Events', () => {
|
||||
};
|
||||
|
||||
return expect(awsCompileS3Events.existingS3Buckets()).to.be.fulfilled.then(() => {
|
||||
const {
|
||||
Resources,
|
||||
} = awsCompileS3Events.serverless.service.provider.compiledCloudFormationTemplate;
|
||||
const { Resources } =
|
||||
awsCompileS3Events.serverless.service.provider.compiledCloudFormationTemplate;
|
||||
|
||||
expect(Object.keys(Resources)).to.have.length(2);
|
||||
expect(Resources.FirstCustomS31).to.deep.equal({
|
||||
@ -872,9 +868,10 @@ describe('AwsCompileS3Events', () => {
|
||||
'*',
|
||||
];
|
||||
|
||||
const lambdaPermissionsPolicies = cfTemplate.Resources.IamRoleCustomResourcesLambdaExecution.Properties.Policies[
|
||||
'0'
|
||||
].PolicyDocument.Statement.filter((x) => x.Action[0].includes('AddPermission'));
|
||||
const lambdaPermissionsPolicies =
|
||||
cfTemplate.Resources.IamRoleCustomResourcesLambdaExecution.Properties.Policies[
|
||||
'0'
|
||||
].PolicyDocument.Statement.filter((x) => x.Action[0].includes('AddPermission'));
|
||||
|
||||
expect(lambdaPermissionsPolicies).to.have.length(1);
|
||||
|
||||
|
||||
@ -50,7 +50,8 @@ describe('AwsCompileSQSEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
expect(() => {
|
||||
awsCompileSQSEvents.compileSQSEvents();
|
||||
@ -74,7 +75,8 @@ describe('AwsCompileSQSEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
expect(() => {
|
||||
awsCompileSQSEvents.compileSQSEvents();
|
||||
@ -107,7 +109,8 @@ describe('AwsCompileSQSEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
expect(() => {
|
||||
awsCompileSQSEvents.compileSQSEvents();
|
||||
@ -140,7 +143,8 @@ describe('AwsCompileSQSEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
expect(() => {
|
||||
awsCompileSQSEvents.compileSQSEvents();
|
||||
@ -171,7 +175,8 @@ describe('AwsCompileSQSEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
awsCompileSQSEvents.serverless.service.provider.role = 'arn:aws:iam::account:role/foo';
|
||||
|
||||
@ -205,7 +210,8 @@ describe('AwsCompileSQSEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
expect(() => {
|
||||
awsCompileSQSEvents.compileSQSEvents();
|
||||
@ -233,7 +239,8 @@ describe('AwsCompileSQSEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
awsCompileSQSEvents.serverless.service.provider.role = {
|
||||
'Fn::GetAtt': [roleLogicalId, 'Arn'],
|
||||
@ -269,7 +276,8 @@ describe('AwsCompileSQSEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileSQSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
awsCompileSQSEvents.serverless.service.provider.role = roleLogicalId;
|
||||
|
||||
|
||||
@ -97,7 +97,8 @@ describe('AwsCompileStreamEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
expect(() => {
|
||||
awsCompileStreamEvents.compileStreamEvents();
|
||||
@ -122,7 +123,8 @@ describe('AwsCompileStreamEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
expect(() => {
|
||||
awsCompileStreamEvents.compileStreamEvents();
|
||||
@ -156,7 +158,8 @@ describe('AwsCompileStreamEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
expect(() => {
|
||||
awsCompileStreamEvents.compileStreamEvents();
|
||||
@ -186,7 +189,8 @@ describe('AwsCompileStreamEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
expect(() => {
|
||||
awsCompileStreamEvents.compileStreamEvents();
|
||||
@ -214,7 +218,8 @@ describe('AwsCompileStreamEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
awsCompileStreamEvents.serverless.service.provider.role = 'arn:aws:iam::account:role/foo';
|
||||
|
||||
@ -249,7 +254,8 @@ describe('AwsCompileStreamEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
expect(() => {
|
||||
awsCompileStreamEvents.compileStreamEvents();
|
||||
@ -278,7 +284,8 @@ describe('AwsCompileStreamEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
expect(() => {
|
||||
awsCompileStreamEvents.compileStreamEvents();
|
||||
@ -307,7 +314,8 @@ describe('AwsCompileStreamEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
awsCompileStreamEvents.serverless.service.provider.role = {
|
||||
'Fn::GetAtt': [roleLogicalId, 'Arn'],
|
||||
@ -340,7 +348,8 @@ describe('AwsCompileStreamEvents', () => {
|
||||
};
|
||||
|
||||
// pretend that the default IamRoleLambdaExecution is not in place
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = null;
|
||||
awsCompileStreamEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
null;
|
||||
|
||||
awsCompileStreamEvents.serverless.service.provider.role = roleLogicalId;
|
||||
|
||||
|
||||
@ -18,19 +18,20 @@ describe('#compileApi()', () => {
|
||||
awsCompileWebsocketsEvents = new AwsCompileWebsocketsEvents(serverless);
|
||||
|
||||
roleLogicalId = awsCompileWebsocketsEvents.provider.naming.getRoleLogicalId();
|
||||
awsCompileWebsocketsEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
|
||||
[roleLogicalId]: {
|
||||
Properties: {
|
||||
Policies: [
|
||||
{
|
||||
PolicyDocument: {
|
||||
Statement: [],
|
||||
awsCompileWebsocketsEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{
|
||||
[roleLogicalId]: {
|
||||
Properties: {
|
||||
Policies: [
|
||||
{
|
||||
PolicyDocument: {
|
||||
Statement: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
it('should create a websocket api resource', () => {
|
||||
@ -90,7 +91,8 @@ describe('#compileApi()', () => {
|
||||
});
|
||||
|
||||
it('should NOT add the websockets policy if role resource does not exist', () => {
|
||||
awsCompileWebsocketsEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources = {};
|
||||
awsCompileWebsocketsEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources =
|
||||
{};
|
||||
|
||||
awsCompileWebsocketsEvents.compileApi();
|
||||
const resources =
|
||||
|
||||
@ -16,7 +16,8 @@ describe('#compileAuthorizers()', () => {
|
||||
|
||||
awsCompileWebsocketsEvents = new AwsCompileWebsocketsEvents(serverless);
|
||||
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId = awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId =
|
||||
awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
|
||||
awsCompileWebsocketsEvents.validated = {
|
||||
events: [
|
||||
@ -111,7 +112,8 @@ describe('#compileAuthorizers()', () => {
|
||||
|
||||
awsCompileWebsocketsEvents = new AwsCompileWebsocketsEvents(serverless);
|
||||
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId = awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId =
|
||||
awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
|
||||
awsCompileWebsocketsEvents.validated = {
|
||||
events: [
|
||||
|
||||
@ -22,7 +22,8 @@ describe('#compileDeployment()', () => {
|
||||
|
||||
awsCompileWebsocketsEvents = new AwsCompileWebsocketsEvents(serverless, options);
|
||||
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId = awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId =
|
||||
awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
});
|
||||
|
||||
it('should create a deployment resource and output', () => {
|
||||
|
||||
@ -15,7 +15,8 @@ describe('#compileIntegrations()', () => {
|
||||
|
||||
awsCompileWebsocketsEvents = new AwsCompileWebsocketsEvents(serverless);
|
||||
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId = awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId =
|
||||
awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
});
|
||||
|
||||
it('should create an integration resource for every event', () => {
|
||||
|
||||
@ -15,7 +15,8 @@ describe('#compilePermissions()', () => {
|
||||
|
||||
awsCompileWebsocketsEvents = new AwsCompileWebsocketsEvents(serverless);
|
||||
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId = awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId =
|
||||
awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
});
|
||||
|
||||
it('should create a permission resource for every event', () => {
|
||||
|
||||
@ -15,7 +15,8 @@ describe('#compileRouteResponses()', () => {
|
||||
|
||||
awsCompileWebsocketsEvents = new AwsCompileWebsocketsEvents(serverless);
|
||||
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId = awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId =
|
||||
awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
});
|
||||
|
||||
it('should create a RouteResponse resource for events with selection expression', () => {
|
||||
|
||||
@ -15,7 +15,8 @@ describe('#compileRoutes()', () => {
|
||||
|
||||
awsCompileWebsocketsEvents = new AwsCompileWebsocketsEvents(serverless);
|
||||
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId = awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId =
|
||||
awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
});
|
||||
|
||||
it('should create a route resource for every event', () => {
|
||||
|
||||
@ -34,7 +34,8 @@ describe('#compileStage()', () => {
|
||||
awsCompileWebsocketsEvents = new AwsCompileWebsocketsEvents(serverless, options);
|
||||
stageLogicalId = awsCompileWebsocketsEvents.provider.naming.getWebsocketsStageLogicalId();
|
||||
logGroupLogicalId = awsCompileWebsocketsEvents.provider.naming.getWebsocketsLogGroupLogicalId();
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId = awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
awsCompileWebsocketsEvents.websocketsApiLogicalId =
|
||||
awsCompileWebsocketsEvents.provider.naming.getWebsocketsApiLogicalId();
|
||||
});
|
||||
|
||||
it('should create a stage resource if no websocketApiId specified', () =>
|
||||
|
||||
@ -450,17 +450,18 @@ describe('AwsCompileFunctions', () => {
|
||||
describe('when IamRoleLambdaExecution is used', () => {
|
||||
beforeEach(() => {
|
||||
// pretend that the IamRoleLambdaExecution is used
|
||||
awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = {
|
||||
Properties: {
|
||||
Policies: [
|
||||
{
|
||||
PolicyDocument: {
|
||||
Statement: [],
|
||||
awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
{
|
||||
Properties: {
|
||||
Policies: [
|
||||
{
|
||||
PolicyDocument: {
|
||||
Statement: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
it('should create necessary resources if a SNS arn is provided', () => {
|
||||
@ -804,17 +805,18 @@ describe('AwsCompileFunctions', () => {
|
||||
describe('when IamRoleLambdaExecution is used', () => {
|
||||
beforeEach(() => {
|
||||
// pretend that the IamRoleLambdaExecution is used
|
||||
awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = {
|
||||
Properties: {
|
||||
Policies: [
|
||||
{
|
||||
PolicyDocument: {
|
||||
Statement: [],
|
||||
awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
{
|
||||
Properties: {
|
||||
Policies: [
|
||||
{
|
||||
PolicyDocument: {
|
||||
Statement: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
it('should create necessary resources if a KMS key arn is provided', () => {
|
||||
@ -878,17 +880,18 @@ describe('AwsCompileFunctions', () => {
|
||||
describe('when IamRoleLambdaExecution is used', () => {
|
||||
beforeEach(() => {
|
||||
// pretend that the IamRoleLambdaExecution is used
|
||||
awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution = {
|
||||
Properties: {
|
||||
Policies: [
|
||||
{
|
||||
PolicyDocument: {
|
||||
Statement: [],
|
||||
awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate.Resources.IamRoleLambdaExecution =
|
||||
{
|
||||
Properties: {
|
||||
Policies: [
|
||||
{
|
||||
PolicyDocument: {
|
||||
Statement: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
it('should create necessary resources if a tracing config is provided', () => {
|
||||
@ -1520,8 +1523,7 @@ describe('lib/plugins/aws/package/compile/functions/index.test.js', () => {
|
||||
handler: 'index.handler',
|
||||
fileSystemConfig: {
|
||||
localMountPath: '/mnt/path',
|
||||
arn:
|
||||
'arn:aws:elasticfilesystem:us-east-1:111111111111:access-point/fsap-a1a1a1a1a1a1a1a1a',
|
||||
arn: 'arn:aws:elasticfilesystem:us-east-1:111111111111:access-point/fsap-a1a1a1a1a1a1a1a1a',
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1932,8 +1934,7 @@ describe('lib/plugins/aws/package/compile/functions/index.test.js', () => {
|
||||
},
|
||||
fileSystemConfig: {
|
||||
localMountPath: '/mnt/path',
|
||||
arn:
|
||||
'arn:aws:elasticfilesystem:us-east-1:111111111111:access-point/fsap-a1a1a1a1a1a1a1a1a',
|
||||
arn: 'arn:aws:elasticfilesystem:us-east-1:111111111111:access-point/fsap-a1a1a1a1a1a1a1a1a',
|
||||
},
|
||||
},
|
||||
fnImage: {
|
||||
@ -2309,8 +2310,7 @@ describe('lib/plugins/aws/package/compile/functions/index.test.js', () => {
|
||||
foo: {
|
||||
fileSystemConfig: {
|
||||
localMountPath: '/mnt/path',
|
||||
arn:
|
||||
'arn:aws:elasticfilesystem:us-east-1:111111111111:access-point/fsap-a1a1a1a1a1a1a1a1a',
|
||||
arn: 'arn:aws:elasticfilesystem:us-east-1:111111111111:access-point/fsap-a1a1a1a1a1a1a1a1a',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -21,7 +21,8 @@ describe('mergeCustomProviderResources', () => {
|
||||
)
|
||||
);
|
||||
|
||||
awsPackage.serverless.service.provider.compiledCloudFormationTemplate = coreCloudFormationTemplate;
|
||||
awsPackage.serverless.service.provider.compiledCloudFormationTemplate =
|
||||
coreCloudFormationTemplate;
|
||||
});
|
||||
|
||||
describe('#mergeCustomProviderResources()', () => {
|
||||
|
||||
@ -431,7 +431,11 @@ describe('lib/plugins/aws/package/lib/mergeIamTemplates.test.js', () => {
|
||||
let serverless;
|
||||
const customFunctionName = 'foo-bar';
|
||||
before(async () => {
|
||||
const { awsNaming, cfTemplate, serverless: serverlessInstance } = await runServerless({
|
||||
const {
|
||||
awsNaming,
|
||||
cfTemplate,
|
||||
serverless: serverlessInstance,
|
||||
} = await runServerless({
|
||||
fixture: 'function',
|
||||
command: 'package',
|
||||
configExt: {
|
||||
|
||||
@ -813,8 +813,7 @@ aws_secret_access_key = CUSTOMSECRET
|
||||
images: {
|
||||
invalidimage: {
|
||||
path: './',
|
||||
uri:
|
||||
'000000000000.dkr.ecr.sa-east-1.amazonaws.com/test-lambda-docker@sha256:6bb600b4d6e1d7cf521097177dd0c4e9ea373edb91984a505333be8ac9455d38',
|
||||
uri: '000000000000.dkr.ecr.sa-east-1.amazonaws.com/test-lambda-docker@sha256:6bb600b4d6e1d7cf521097177dd0c4e9ea373edb91984a505333be8ac9455d38',
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -909,8 +908,7 @@ aws_secret_access_key = CUSTOMSECRET
|
||||
foo: {
|
||||
image: {
|
||||
name: 'baseimage',
|
||||
uri:
|
||||
'000000000000.dkr.ecr.sa-east-1.amazonaws.com/test-lambda-docker@sha256:6bb600b4d6e1d7cf521097177dd0c4e9ea373edb91984a505333be8ac9455d38',
|
||||
uri: '000000000000.dkr.ecr.sa-east-1.amazonaws.com/test-lambda-docker@sha256:6bb600b4d6e1d7cf521097177dd0c4e9ea373edb91984a505333be8ac9455d38',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -91,8 +91,7 @@ describe('AwsRollback', () => {
|
||||
const s3Objects = [
|
||||
{
|
||||
// eslint-disable-next-line max-len
|
||||
Key:
|
||||
'serverless/rollback/dev/1476779096930-2016-10-18T08:24:56.930Z/compiled-cloudformation-template.json',
|
||||
Key: 'serverless/rollback/dev/1476779096930-2016-10-18T08:24:56.930Z/compiled-cloudformation-template.json',
|
||||
},
|
||||
{
|
||||
Key: 'serverless/rollback/dev/1476779096930-2016-10-18T08:24:56.930Z/test.zip',
|
||||
@ -141,8 +140,7 @@ describe('AwsRollback', () => {
|
||||
const s3Objects = [
|
||||
{
|
||||
// eslint-disable-next-line max-len
|
||||
Key:
|
||||
'serverless/rollback/dev/2000000000000-2016-10-18T08:24:56.930Z/compiled-cloudformation-template.json',
|
||||
Key: 'serverless/rollback/dev/2000000000000-2016-10-18T08:24:56.930Z/compiled-cloudformation-template.json',
|
||||
},
|
||||
{
|
||||
Key: 'serverless/rollback/dev/2000000000000-2016-10-18T08:24:56.930Z/test.zip',
|
||||
@ -176,8 +174,7 @@ describe('AwsRollback', () => {
|
||||
const s3Objects = [
|
||||
{
|
||||
// eslint-disable-next-line max-len
|
||||
Key:
|
||||
'serverless/rollback/dev/1476779096930-2016-10-18T08:24:56.930Z/compiled-cloudformation-template.json',
|
||||
Key: 'serverless/rollback/dev/1476779096930-2016-10-18T08:24:56.930Z/compiled-cloudformation-template.json',
|
||||
},
|
||||
{
|
||||
Key: 'serverless/rollback/dev/1476779096930-2016-10-18T08:24:56.930Z/test.zip',
|
||||
|
||||
@ -16,24 +16,21 @@ describe('#findAndGroupDeployments()', () => {
|
||||
const s3Objects = [
|
||||
{
|
||||
// eslint-disable-next-line max-len
|
||||
Key:
|
||||
'serverless/test/dev/1476779096930-2016-10-18T08:24:56.930Z/compiled-cloudformation-template.json',
|
||||
Key: 'serverless/test/dev/1476779096930-2016-10-18T08:24:56.930Z/compiled-cloudformation-template.json',
|
||||
},
|
||||
{
|
||||
Key: 'serverless/test/dev/1476779096930-2016-10-18T08:24:56.930Z/test.zip',
|
||||
},
|
||||
{
|
||||
// eslint-disable-next-line max-len
|
||||
Key:
|
||||
'serverless/test/dev/1476779278222-2016-10-18T08:27:58.222Z/compiled-cloudformation-template.json',
|
||||
Key: 'serverless/test/dev/1476779278222-2016-10-18T08:27:58.222Z/compiled-cloudformation-template.json',
|
||||
},
|
||||
{
|
||||
Key: 'serverless/test/dev/1476779278222-2016-10-18T08:27:58.222Z/test.zip',
|
||||
},
|
||||
{
|
||||
// eslint-disable-next-line max-len
|
||||
Key:
|
||||
'serverless/test/dev/1476781042481-2016-10-18T08:57:22.481Z/compiled-cloudformation-template.json',
|
||||
Key: 'serverless/test/dev/1476781042481-2016-10-18T08:57:22.481Z/compiled-cloudformation-template.json',
|
||||
},
|
||||
{
|
||||
Key: 'serverless/test/dev/1476781042481-2016-10-18T08:57:22.481Z/test.zip',
|
||||
|
||||
@ -35,14 +35,12 @@ describe('#getS3ObjectsFromStacks()', () => {
|
||||
const expected = [
|
||||
// eslint-disable-next-line max-len
|
||||
{
|
||||
Key:
|
||||
'serverless/test/dev/1476779096930-2016-10-18T08:24:56.930Z/compiled-cloudformation-template.json',
|
||||
Key: 'serverless/test/dev/1476779096930-2016-10-18T08:24:56.930Z/compiled-cloudformation-template.json',
|
||||
},
|
||||
{ Key: 'serverless/test/dev/1476779096930-2016-10-18T08:24:56.930Z/test.zip' },
|
||||
// eslint-disable-next-line max-len
|
||||
{
|
||||
Key:
|
||||
'serverless/test/dev/1476779278222-2016-10-18T08:27:58.222Z/compiled-cloudformation-template.json',
|
||||
Key: 'serverless/test/dev/1476779278222-2016-10-18T08:27:58.222Z/compiled-cloudformation-template.json',
|
||||
},
|
||||
{ Key: 'serverless/test/dev/1476779278222-2016-10-18T08:27:58.222Z/test.zip' },
|
||||
];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user