Class InlineCode
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.lambda.Code
software.amazon.awscdk.services.lambda.InlineCode
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-17T14:40:54.962Z")
@Stability(Stable)
public class InlineCode
extends Code
Lambda code from an inline string.
Example:
LayerVersion layer = LayerVersion.Builder.create(stack, "MyLayer")
.code(Code.fromAsset(join(__dirname, "layer-code")))
.compatibleRuntimes(List.of(Runtime.NODEJS_LATEST))
.license("Apache-2.0")
.description("A layer to test the L2 construct")
.build();
// To grant usage by other AWS accounts
layer.addPermission("remote-account-grant", LayerVersionPermission.builder().accountId(awsAccountId).build());
// To grant usage to all accounts in some AWS Ogranization
// layer.grantUsage({ accountId: '*', organizationId });
// To grant usage to all accounts in some AWS Ogranization
// layer.grantUsage({ accountId: '*', organizationId });
Function.Builder.create(stack, "MyLayeredLambda")
.code(new InlineCode("foo"))
.handler("index.handler")
.runtime(Runtime.NODEJS_LATEST)
.layers(List.of(layer))
.build();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode -
Constructor Summary
ConstructorsModifierConstructorDescriptionInlineCode(String code) protectedInlineCode(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedInlineCode(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionbind(software.constructs.Construct _scope) Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.Determines whether this Code is inline code or not.Methods inherited from class software.amazon.awscdk.services.lambda.Code
bindToResource, bindToResource, fromAsset, fromAsset, fromAssetImage, fromAssetImage, fromBucket, fromBucket, fromBucketV2, fromBucketV2, fromCfnParameters, fromCfnParameters, fromCustomCommand, fromCustomCommand, fromDockerBuild, fromDockerBuild, fromEcrImage, fromEcrImage, fromInlineMethods 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
-
InlineCode
protected InlineCode(software.amazon.jsii.JsiiObjectRef objRef) -
InlineCode
protected InlineCode(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
InlineCode
- Parameters:
code- This parameter is required.
-
-
Method Details