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.94.0 (build b380f01)", date="2024-03-01T20:58:26.578Z") @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();
 
  • 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 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.

      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.