Interface IFunctionProps
Properties for creating a CloudFront Function.
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IFunctionProps
Syntax (vb)
Public Interface IFunctionProps
Remarks
ExampleMetadata: infused
Examples
Bucket s3Bucket;
// Add a cloudfront Function to a Distribution
var cfFunction = new Function(this, "Function", new FunctionProps {
Code = FunctionCode.FromInline("function handler(event) { return event.request }"),
Runtime = FunctionRuntime.JS_2_0
});
new Distribution(this, "distro", new DistributionProps {
DefaultBehavior = new BehaviorOptions {
Origin = new S3Origin(s3Bucket),
FunctionAssociations = new [] { new FunctionAssociation {
Function = cfFunction,
EventType = FunctionEventType.VIEWER_REQUEST
} }
}
});
Synopsis
Properties
Code | The source code of the function. |
Comment | A comment to describe the function. |
FunctionName | A name to identify the function. |
KeyValueStore | The Key Value Store to associate with this function. |
Runtime | The runtime environment for the function. |
Properties
Code
Comment
A comment to describe the function.
virtual string Comment { get; }
Property Value
System.String
Remarks
Default: - same as functionName
FunctionName
A name to identify the function.
virtual string FunctionName { get; }
Property Value
System.String
Remarks
Default: - generated from the id
KeyValueStore
The Key Value Store to associate with this function.
virtual IKeyValueStore KeyValueStore { get; }
Property Value
Remarks
In order to associate a Key Value Store, the runtime
must be
cloudfront-js-2.0
or newer.
Default: - no key value store is associated
Runtime
The runtime environment for the function.
virtual FunctionRuntime Runtime { get; }
Property Value
Remarks
Default: FunctionRuntime.JS_1_0 (unless keyValueStore
is specified, then FunctionRuntime.JS_2_0
)