FunctionEventType Enum
The type of events that a CloudFront function can be invoked in response to.
Example
ts
// Add a cloudfront Function to a Distribution
const cfFunction = new cloudfront.Function(this, 'Function', {
code: cloudfront.FunctionCode.fromInline('function handler(event) { return event.request }'),
runtime: cloudfront.FunctionRuntime.JS_2_0,
});
declare const s3Bucket: s3.Bucket;
new cloudfront.Distribution(this, 'distro', {
defaultBehavior: {
origin: new origins.S3Origin(s3Bucket),
functionAssociations: [{
function: cfFunction,
eventType: cloudfront.FunctionEventType.VIEWER_REQUEST,
}],
},
});
Members
| Member | Description |
|---|---|
VIEWER_REQUEST | The viewer-request specifies the incoming request. |
VIEWER_RESPONSE | The viewer-response specifies the outgoing response. |
Referenced by
FunctionAssociation.eventTypeevent_typeeventTypeEventTypeEventType