Class FunctionCode
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.cloudfront.FunctionCode
- All Implemented Interfaces:
- software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
           date="2023-06-19T16:30:43.686Z")
@Stability(Stable)
public abstract class FunctionCode
extends software.amazon.jsii.JsiiObject
Represents the function's source code.
 
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();
 - 
Nested Class SummaryNested classes/interfaces inherited from class software.amazon.jsii.JsiiObjectsoftware.amazon.jsii.JsiiObject.InitializationMode
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedprotectedFunctionCode(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedFunctionCode(software.amazon.jsii.JsiiObjectRef objRef) 
- 
Method SummaryModifier and TypeMethodDescriptionstatic FunctionCodefromFile(FileCodeOptions options) Code from external file for function.static FunctionCodefromInline(String code) Inline code for function.abstract Stringrender()renders the function code.Methods inherited from class software.amazon.jsii.JsiiObjectjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable$jsii$toJson
- 
Constructor Details- 
FunctionCodeprotected FunctionCode(software.amazon.jsii.JsiiObjectRef objRef) 
- 
FunctionCodeprotected FunctionCode(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) 
- 
FunctionCode@Stability(Stable) protected FunctionCode()
 
- 
- 
Method Details- 
fromFileCode from external file for function.- Parameters:
- options- the options for the external file. This parameter is required.
- Returns:
- code object with contents from file.
 
- 
fromInlineInline code for function.- Parameters:
- code- The actual function code. This parameter is required.
- Returns:
- code object with inline code.
 
- 
renderrenders the function code.
 
-