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.84.0 (build 5404dcf)", date="2023-06-19T16:30:40.795Z") @Stability(Stable) public class InlineCode extends Code
Lambda code from an inline string (limited to 4KiB).

Example:

 LayerVersion layer = LayerVersion.Builder.create(stack, "MyLayer")
         .code(Code.fromAsset(join(__dirname, "layer-code")))
         .compatibleRuntimes(List.of(Runtime.NODEJS_14_X))
         .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_14_X)
         .layers(List.of(layer))
         .build();
 
  • Constructor Details

    • InlineCode

      protected InlineCode(software.amazon.jsii.JsiiObjectRef objRef)
    • InlineCode

      protected InlineCode(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • InlineCode

      @Stability(Stable) public InlineCode(@NotNull String code)
      Parameters:
      code - This parameter is required.
  • Method Details

    • bind

      @Stability(Stable) @NotNull public CodeConfig bind(@NotNull Construct _scope)
      Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.

      Specified by:
      bind in class Code
      Parameters:
      _scope - This parameter is required.
    • getIsInline

      @Stability(Stable) @NotNull public Boolean getIsInline()
      Determines whether this Code is inline code or not.
      Specified by:
      getIsInline in class Code