enum FunctionEventType
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.CloudFront.FunctionEventType |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awscloudfront#FunctionEventType |
![]() | software.amazon.awscdk.services.cloudfront.FunctionEventType |
![]() | aws_cdk.aws_cloudfront.FunctionEventType |
![]() | aws-cdk-lib » aws_cloudfront » FunctionEventType |
The type of events that a CloudFront function can be invoked in response to.
Example
// 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
Name | Description |
---|---|
VIEWER_REQUEST | The viewer-request specifies the incoming request. |
VIEWER_RESPONSE | The viewer-response specifies the outgoing response. |
VIEWER_REQUEST
The viewer-request specifies the incoming request.
VIEWER_RESPONSE
The viewer-response specifies the outgoing response.