FunctionAssociation Struct
Represents a CloudFront function and event type when using CF Functions.
The type of the AddBehaviorOptions.functionAssociations property.
| Source | aws-cloudfront/lib/function.ts |
|---|---|
| Type last changed |
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cloudfront as cloudfront } from 'aws-cdk-lib';
import { aws_cloudfront as interfaces_cloudfront } from 'aws-cdk-lib/interfaces';
declare const functionRef: interfaces_cloudfront.IFunctionRef;
const functionAssociation: cloudfront.FunctionAssociation = {
eventType: cloudfront.FunctionEventType.VIEWER_REQUEST,
function: functionRef,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_cloudfront as cloudfront
from aws_cdk.interfaces import aws_cloudfront as interfaces_cloudfront
# function_ref: interfaces_cloudfront.IFunctionRef
function_association = cloudfront.FunctionAssociation(
event_type=cloudfront.FunctionEventType.VIEWER_REQUEST,
function=function_ref
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.cloudfront.*;
import software.amazon.awscdk.interfaces.cloudfront.*;
IFunctionRef functionRef;
FunctionAssociation functionAssociation = FunctionAssociation.builder()
.eventType(FunctionEventType.VIEWER_REQUEST)
.function(functionRef)
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudFront;
using Amazon.CDK.Interfaces.CloudFront;
IFunctionRef functionRef;
var functionAssociation = new FunctionAssociation {
EventType = FunctionEventType.VIEWER_REQUEST,
Function = functionRef
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var functionRef IFunctionRef
functionAssociation := &FunctionAssociation{
EventType: awscdk.Aws_cloudfront.FunctionEventType_VIEWER_REQUEST,
Function: functionRef,
}
Properties
eventTypeFunctionEventTypeevent_typeFunctionEventTypeeventTypeFunctionEventTypeEventTypeFunctionEventTypeEventTypeFunctionEventType required #The type of event which should invoke the function.
functionIFunctionReffunctionIFunctionReffunctionIFunctionRefFunctionIFunctionRefFunctionIFunctionRef required #The CloudFront function that will be invoked.