Skip to content

Commit

Permalink
Merge branch 'master' of github.com:serverless-operations/serverless-…
Browse files Browse the repository at this point in the history
…lambda-edge-pre-existing-cloudfront
  • Loading branch information
horike37 committed Aug 22, 2020
2 parents 7fdeefa + 240c509 commit ffe4b6f
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,39 @@ class ServerlessLambdaEdgePreExistingCloudFront {
}, Promise.resolve())
}
}

this.serverless.configSchemaHandler.defineCustomProperties({
type: 'object',
properties: {
lambdaEdgePreExistingCloudFront: {
type: 'object',
properties: {
validStages: {
type: 'array',
items: { type: 'string' },
uniqueItems: true
}
}
},
}
})

this.serverless.configSchemaHandler.defineFunctionEvent('aws', 'preExistingCloudFront', {
type: 'object',
properties: {
distributionId: { type: 'string' },
eventType: { type: 'string' },
pathPattern: { type: 'string' },
includeBody: { type: 'boolean' }
},
required: [
'distributionId',
'eventType',
'pathPattern',
'includeBody'
]
})

}

checkAllowedDeployStage() {
Expand Down Expand Up @@ -121,14 +154,15 @@ class ServerlessLambdaEdgePreExistingCloudFront {
const versions = await this.provider.request('Lambda', 'listVersionsByFunction', args)

if (versions.NextMarker !== null) {
return await this.getlatestVersion(functionName, versions.NextMarker)
return await this.getlatestVersionLambdaArn(functionName, versions.NextMarker)
}
let arn
versions.Versions.forEach(async (functionObj) => {
arn = functionObj.FunctionArn
})
return arn
}

}

module.exports = ServerlessLambdaEdgePreExistingCloudFront

0 comments on commit ffe4b6f

Please sign in to comment.