Class FunctionProps
Properties for creating a CloudFront Function.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class FunctionProps : Object, IFunctionProps
Syntax (vb)
Public Class FunctionProps
Inherits Object
Implements 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
Constructors
FunctionProps() |
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. |
Constructors
FunctionProps()
public FunctionProps()
Properties
Code
Comment
A comment to describe the function.
public string Comment { get; set; }
Property Value
System.String
Remarks
Default: - same as functionName
FunctionName
A name to identify the function.
public string FunctionName { get; set; }
Property Value
System.String
Remarks
Default: - generated from the id
KeyValueStore
The Key Value Store to associate with this function.
public IKeyValueStore KeyValueStore { get; set; }
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.
public FunctionRuntime Runtime { get; set; }
Property Value
Remarks
Default: FunctionRuntime.JS_1_0 (unless keyValueStore
is specified, then FunctionRuntime.JS_2_0
)