Interface LayerVersionPermission

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
LayerVersionPermission.Jsii$Proxy

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:40.803Z") @Stability(Stable) public interface LayerVersionPermission extends software.amazon.jsii.JsiiSerializable
Identification of an account (or organization) that is allowed to access a Lambda Layer Version.

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();
 
  • Method Details

    • getAccountId

      @Stability(Stable) @NotNull String getAccountId()
      The AWS Account id of the account that is authorized to use a Lambda Layer Version.

      The wild-card '*' can be used to grant access to "any" account (or any account in an organization when organizationId is specified).

    • getOrganizationId

      @Stability(Stable) @Nullable default String getOrganizationId()
      The ID of the AWS Organization to which the grant is restricted.

      Can only be specified if accountId is '*'

    • builder

      @Stability(Stable) static LayerVersionPermission.Builder builder()
      Returns:
      a LayerVersionPermission.Builder of LayerVersionPermission