Class Code
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.appsync.Code
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
- Direct Known Subclasses:
AssetCode,InlineCode
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-17T14:40:45.469Z")
@Stability(Stable)
public abstract class Code
extends software.amazon.jsii.JsiiObject
Represents source code for an AppSync Function or Resolver.
Example:
EventApi api;
AppSyncLambdaDataSource lambdaDataSource;
// Lambda data source for publish handler
api.addChannelNamespace("lambda-ns", ChannelNamespaceOptions.builder()
.code(Code.fromInline("/* event handler code here.*/"))
.publishHandlerConfig(HandlerConfig.builder()
.dataSource(lambdaDataSource)
.build())
.build());
// Direct Lambda data source for publish handler
api.addChannelNamespace("lambda-direct-ns", ChannelNamespaceOptions.builder()
.publishHandlerConfig(HandlerConfig.builder()
.dataSource(lambdaDataSource)
.direct(true)
.build())
.build());
api.addChannelNamespace("lambda-direct-async-ns", ChannelNamespaceOptions.builder()
.publishHandlerConfig(HandlerConfig.builder()
.dataSource(lambdaDataSource)
.direct(true)
.lambdaInvokeType(LambdaInvokeType.EVENT)
.build())
.build());
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract CodeConfigbind(software.constructs.Construct scope) Bind source code to an AppSync Function or resolver.static AssetCodeLoads the function code from a local disk path.static AssetCodefromAsset(String path, AssetOptions options) Loads the function code from a local disk path.static InlineCodefromInline(String code) Inline code for AppSync function.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
Code
protected Code(software.amazon.jsii.JsiiObjectRef objRef) -
Code
protected Code(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Code
@Stability(Stable) protected Code()
-
-
Method Details
-
fromAsset
@Stability(Stable) @NotNull public static AssetCode fromAsset(@NotNull String path, @Nullable AssetOptions options) Loads the function code from a local disk path.- Parameters:
path- The path to the source code file. This parameter is required.options-
-
fromAsset
Loads the function code from a local disk path.- Parameters:
path- The path to the source code file. This parameter is required.
-
fromInline
Inline code for AppSync function.- Parameters:
code- The actual handler code (the resulting zip file cannot exceed 4MB). This parameter is required.- Returns:
InlineCodewith inline code.
-
bind
@Stability(Stable) @NotNull public abstract CodeConfig bind(@NotNull software.constructs.Construct scope) Bind source code to an AppSync Function or resolver.- Parameters:
scope- This parameter is required.
-