1 | import { IResource, RemovalPolicy, Resource } from '@aws-cdk/core';
|
2 | import { Construct } from 'constructs';
|
3 | import { Architecture } from './architecture';
|
4 | import { Code } from './code';
|
5 | import { Runtime } from './runtime';
|
6 | /**
|
7 | * Non runtime options
|
8 | */
|
9 | export interface LayerVersionOptions {
|
10 | /**
|
11 | * The description the this Lambda Layer.
|
12 | *
|
13 | * @default - No description.
|
14 | */
|
15 | readonly description?: string;
|
16 | /**
|
17 | * The SPDX licence identifier or URL to the license file for this layer.
|
18 | *
|
19 | * @default - No license information will be recorded.
|
20 | */
|
21 | readonly license?: string;
|
22 | /**
|
23 | * The name of the layer.
|
24 | *
|
25 | * @default - A name will be generated.
|
26 | */
|
27 | readonly layerVersionName?: string;
|
28 | /**
|
29 | * Whether to retain this version of the layer when a new version is added
|
30 | * or when the stack is deleted.
|
31 | *
|
32 | * @default RemovalPolicy.DESTROY
|
33 | */
|
34 | readonly removalPolicy?: RemovalPolicy;
|
35 | }
|
36 | export interface LayerVersionProps extends LayerVersionOptions {
|
37 | /**
|
38 | * The runtimes compatible with this Layer.
|
39 | *
|
40 | * @default - All runtimes are supported.
|
41 | */
|
42 | readonly compatibleRuntimes?: Runtime[];
|
43 | /**
|
44 | * The system architectures compatible with this layer.
|
45 | * @default [Architecture.X86_64]
|
46 | */
|
47 | readonly compatibleArchitectures?: Architecture[];
|
48 | /**
|
49 | * The content of this Layer.
|
50 | *
|
51 | * Using `Code.fromInline` is not supported.
|
52 | */
|
53 | readonly code: Code;
|
54 | }
|
55 | export interface ILayerVersion extends IResource {
|
56 | /**
|
57 | * The ARN of the Lambda Layer version that this Layer defines.
|
58 | * @attribute
|
59 | */
|
60 | readonly layerVersionArn: string;
|
61 | /**
|
62 | * The runtimes compatible with this Layer.
|
63 | *
|
64 | * @default Runtime.All
|
65 | */
|
66 | readonly compatibleRuntimes?: Runtime[];
|
67 | /**
|
68 | * Add permission for this layer version to specific entities. Usage within
|
69 | * the same account where the layer is defined is always allowed and does not
|
70 | * require calling this method. Note that the principal that creates the
|
71 | * Lambda function using the layer (for example, a CloudFormation changeset
|
72 | * execution role) also needs to have the ``lambda:GetLayerVersion``
|
73 | * permission on the layer version.
|
74 | *
|
75 | * @param id the ID of the grant in the construct tree.
|
76 | * @param permission the identification of the grantee.
|
77 | */
|
78 | addPermission(id: string, permission: LayerVersionPermission): void;
|
79 | }
|
80 | /**
|
81 | * A reference to a Lambda Layer version.
|
82 | */
|
83 | declare abstract class LayerVersionBase extends Resource implements ILayerVersion {
|
84 | abstract readonly layerVersionArn: string;
|
85 | abstract readonly compatibleRuntimes?: Runtime[];
|
86 | addPermission(id: string, permission: LayerVersionPermission): void;
|
87 | }
|
88 | /**
|
89 | * Identification of an account (or organization) that is allowed to access a Lambda Layer Version.
|
90 | */
|
91 | export interface LayerVersionPermission {
|
92 | /**
|
93 | * The AWS Account id of the account that is authorized to use a Lambda Layer Version. The wild-card ``'*'`` can be
|
94 | * used to grant access to "any" account (or any account in an organization when ``organizationId`` is specified).
|
95 | */
|
96 | readonly accountId: string;
|
97 | /**
|
98 | * The ID of the AWS Organization to which the grant is restricted.
|
99 | *
|
100 | * Can only be specified if ``accountId`` is ``'*'``
|
101 | */
|
102 | readonly organizationId?: string;
|
103 | }
|
104 | /**
|
105 | * Properties necessary to import a LayerVersion.
|
106 | */
|
107 | export interface LayerVersionAttributes {
|
108 | /**
|
109 | * The ARN of the LayerVersion.
|
110 | */
|
111 | readonly layerVersionArn: string;
|
112 | /**
|
113 | * The list of compatible runtimes with this Layer.
|
114 | */
|
115 | readonly compatibleRuntimes?: Runtime[];
|
116 | }
|
117 | /**
|
118 | * Defines a new Lambda Layer version.
|
119 | */
|
120 | export declare class LayerVersion extends LayerVersionBase {
|
121 | /**
|
122 | * Imports a layer version by ARN. Assumes it is compatible with all Lambda runtimes.
|
123 | */
|
124 | static fromLayerVersionArn(scope: Construct, id: string, layerVersionArn: string): ILayerVersion;
|
125 | /**
|
126 | * Imports a Layer that has been defined externally.
|
127 | *
|
128 | * @param scope the parent Construct that will use the imported layer.
|
129 | * @param id the id of the imported layer in the construct tree.
|
130 | * @param attrs the properties of the imported layer.
|
131 | */
|
132 | static fromLayerVersionAttributes(scope: Construct, id: string, attrs: LayerVersionAttributes): ILayerVersion;
|
133 | readonly layerVersionArn: string;
|
134 | readonly compatibleRuntimes?: Runtime[];
|
135 | constructor(scope: Construct, id: string, props: LayerVersionProps);
|
136 | }
|
137 | export {};
|