Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ffe4b6f

Browse files
committedAug 22, 2020
Merge branch 'master' of github.com:serverless-operations/serverless-lambda-edge-pre-existing-cloudfront
2 parents 7fdeefa + 240c509 commit ffe4b6f

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed
 

‎index.js

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,39 @@ class ServerlessLambdaEdgePreExistingCloudFront {
6161
}, Promise.resolve())
6262
}
6363
}
64+
65+
this.serverless.configSchemaHandler.defineCustomProperties({
66+
type: 'object',
67+
properties: {
68+
lambdaEdgePreExistingCloudFront: {
69+
type: 'object',
70+
properties: {
71+
validStages: {
72+
type: 'array',
73+
items: { type: 'string' },
74+
uniqueItems: true
75+
}
76+
}
77+
},
78+
}
79+
})
80+
81+
this.serverless.configSchemaHandler.defineFunctionEvent('aws', 'preExistingCloudFront', {
82+
type: 'object',
83+
properties: {
84+
distributionId: { type: 'string' },
85+
eventType: { type: 'string' },
86+
pathPattern: { type: 'string' },
87+
includeBody: { type: 'boolean' }
88+
},
89+
required: [
90+
'distributionId',
91+
'eventType',
92+
'pathPattern',
93+
'includeBody'
94+
]
95+
})
96+
6497
}
6598

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

123156
if (versions.NextMarker !== null) {
124-
return await this.getlatestVersion(functionName, versions.NextMarker)
157+
return await this.getlatestVersionLambdaArn(functionName, versions.NextMarker)
125158
}
126159
let arn
127160
versions.Versions.forEach(async (functionObj) => {
128161
arn = functionObj.FunctionArn
129162
})
130163
return arn
131164
}
165+
132166
}
133167

134168
module.exports = ServerlessLambdaEdgePreExistingCloudFront

0 commit comments

Comments
 (0)
Please sign in to comment.