New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aws cloudfront event schema #8250
Changes from 4 commits
7b7a2a9
2282c44
a3d1b8f
5703ee4
2f5524c
e8ab079
f1356df
fb32776
283fb6c
0c343c3
20b58cf
7502dd4
f6476e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,9 +27,21 @@ class AwsCompileCloudFrontEvents { | |
'before:remove:remove': this.logRemoveReminder.bind(this), | ||
}; | ||
|
||
// TODO: Complete schema, see https://github.com/serverless/serverless/issues/8025 | ||
this.serverless.configSchemaHandler.defineFunctionEvent('aws', 'cloudFront', { | ||
type: 'object', | ||
properties: { | ||
eventType: { | ||
type: 'string', | ||
enum: ['viewer-request', 'origin-request', 'origin-response', 'viewer-response'], | ||
}, | ||
pathPattern: { type: 'string', pattern: '^([A-Za-z0-9-_.*$/~"\'@:+]|&)+$' }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved it to the end of the array like we do in other patterns
medikoo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
origin: { | ||
oneOf: [{ type: 'string', format: 'uri' }, { type: 'object' }], | ||
}, | ||
isDefaultOrigin: { type: 'boolean' }, | ||
includeBody: { type: 'boolean' }, | ||
behavior: { type: 'object' }, | ||
medikoo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add |
||
}); | ||
} | ||
|
||
|
@@ -156,10 +168,6 @@ class AwsCompileCloudFrontEvents { | |
if (functionObj.events) { | ||
functionObj.events.forEach(event => { | ||
if (event.cloudFront) { | ||
if (!_.isObject(event.cloudFront)) { | ||
throw new Error('cloudFront event has to be an object'); | ||
} | ||
|
||
const lambdaFunctionLogicalId = Object.keys(Resources).find( | ||
key => | ||
Resources[key].Type === 'AWS::Lambda::Function' && | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove
type
here