@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:37.135Z") @Stability(value=Stable) public abstract class FunctionCode extends software.amazon.jsii.JsiiObject
Example:
Bucket s3Bucket;
// Add a cloudfront Function to a Distribution
Function cfFunction = Function.Builder.create(this, "Function")
.code(FunctionCode.fromInline("function handler(event) { return event.request }"))
.build();
Distribution.Builder.create(this, "distro")
.defaultBehavior(BehaviorOptions.builder()
.origin(new S3Origin(s3Bucket))
.functionAssociations(List.of(FunctionAssociation.builder()
.function(cfFunction)
.eventType(FunctionEventType.VIEWER_REQUEST)
.build()))
.build())
.build();
| Modifier | Constructor and Description |
|---|---|
protected |
FunctionCode() |
protected |
FunctionCode(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
FunctionCode(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
static FunctionCode |
fromFile(FileCodeOptions options)
Code from external file for function.
|
static FunctionCode |
fromInline(String code)
Inline code for function.
|
abstract String |
render()
renders the function code.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected FunctionCode(software.amazon.jsii.JsiiObjectRef objRef)
protected FunctionCode(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable) protected FunctionCode()
@Stability(value=Stable) @NotNull public static FunctionCode fromFile(@NotNull FileCodeOptions options)
options - the options for the external file. This parameter is required.@Stability(value=Stable) @NotNull public static FunctionCode fromInline(@NotNull String code)
code - The actual function code. This parameter is required.@Stability(value=Stable) @NotNull public abstract String render()
Copyright © 2022. All rights reserved.