FunctionEventType
- class aws_cdk.aws_cloudfront.FunctionEventType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
Enum
The type of events that a CloudFront function can be invoked in response to.
- ExampleMetadata:
infused
Example:
# s3_bucket: s3.Bucket # Add a cloudfront Function to a Distribution cf_function = cloudfront.Function(self, "Function", code=cloudfront.FunctionCode.from_inline("function handler(event) { return event.request }"), runtime=cloudfront.FunctionRuntime.JS_2_0 ) cloudfront.Distribution(self, "distro", default_behavior=cloudfront.BehaviorOptions( origin=origins.S3Origin(s3_bucket), function_associations=[cloudfront.FunctionAssociation( function=cf_function, event_type=cloudfront.FunctionEventType.VIEWER_REQUEST )] ) )
Attributes
- VIEWER_REQUEST
The viewer-request specifies the incoming request.
- VIEWER_RESPONSE
The viewer-response specifies the outgoing response.