1 | import * as ec2 from '@aws-cdk/aws-ec2';
|
2 | import * as iam from '@aws-cdk/aws-iam';
|
3 | import * as logs from '@aws-cdk/aws-logs';
|
4 | import * as cdk from '@aws-cdk/core';
|
5 | import { Construct } from 'constructs';
|
6 | import { Architecture } from './architecture';
|
7 | import { Function as LambdaFunction, FunctionProps, EnvironmentOptions } from './function';
|
8 | import { FunctionBase } from './function-base';
|
9 | import { Version } from './lambda-version';
|
10 | import { ILayerVersion } from './layers';
|
11 | import { Permission } from './permission';
|
12 | import { Runtime } from './runtime';
|
13 |
|
14 |
|
15 |
|
16 | export interface SingletonFunctionProps extends FunctionProps {
|
17 | |
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | readonly uuid: string;
|
24 | |
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | readonly lambdaPurpose?: string;
|
34 | }
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 | export declare class SingletonFunction extends FunctionBase {
|
46 | readonly grantPrincipal: iam.IPrincipal;
|
47 | readonly functionName: string;
|
48 | readonly functionArn: string;
|
49 | readonly role?: iam.IRole;
|
50 | readonly permissionsNode: cdk.ConstructNode;
|
51 | readonly architecture: Architecture;
|
52 | |
53 |
|
54 |
|
55 | readonly runtime: Runtime;
|
56 | protected readonly canCreatePermissions: boolean;
|
57 | private lambdaFunction;
|
58 | constructor(scope: Construct, id: string, props: SingletonFunctionProps);
|
59 | /**
|
60 | * @inheritdoc
|
61 | */
|
62 | get isBoundToVpc(): boolean;
|
63 | /**
|
64 | * @inheritdoc
|
65 | */
|
66 | get connections(): ec2.Connections;
|
67 | /**
|
68 | * The LogGroup where the Lambda function's logs are made available.
|
69 | *
|
70 | * If either `logRetention` is set or this property is called, a CloudFormation custom resource is added to the stack that
|
71 | * pre-creates the log group as part of the stack deployment, if it already doesn't exist, and sets the correct log retention
|
72 | * period (never expire, by default).
|
73 | *
|
74 | * Further, if the log group already exists and the `logRetention` is not set, the custom resource will reset the log retention
|
75 | * to never expire even if it was configured with a different value.
|
76 | */
|
77 | get logGroup(): logs.ILogGroup;
|
78 | /**
|
79 | * Returns a `lambda.Version` which represents the current version of this
|
80 | * singleton Lambda function. A new version will be created every time the
|
81 | * function's configuration changes.
|
82 | *
|
83 | * You can specify options for this version using the `currentVersionOptions`
|
84 | * prop when initializing the `lambda.SingletonFunction`.
|
85 | */
|
86 | get currentVersion(): Version;
|
87 | get resourceArnsForGrantInvoke(): string[];
|
88 | /**
|
89 | * Adds an environment variable to this Lambda function.
|
90 | * If this is a ref to a Lambda function, this operation results in a no-op.
|
91 | * @param key The environment variable key.
|
92 | * @param value The environment variable's value.
|
93 | * @param options Environment variable options.
|
94 | */
|
95 | addEnvironment(key: string, value: string, options?: EnvironmentOptions): LambdaFunction;
|
96 | /**
|
97 | * Adds one or more Lambda Layers to this Lambda function.
|
98 | *
|
99 | * @param layers the layers to be added.
|
100 | *
|
101 | * @throws if there are already 5 layers on this function, or the layer is incompatible with this function's runtime.
|
102 | */
|
103 | addLayers(...layers: ILayerVersion[]): void;
|
104 | addPermission(name: string, permission: Permission): void;
|
105 | /**
|
106 | * Using node.addDependency() does not work on this method as the underlying lambda function is modeled
|
107 | * as a singleton across the stack. Use this method instead to declare dependencies.
|
108 | */
|
109 | addDependency(...up: cdk.IDependable[]): void;
|
110 | /**
|
111 | * The SingletonFunction construct cannot be added as a dependency of another construct using
|
112 | * node.addDependency(). Use this method instead to declare this as a dependency of another construct.
|
113 | */
|
114 | dependOn(down: cdk.IConstruct): void;
|
115 | /** @internal */
|
116 | _checkEdgeCompatibility(): void;
|
117 | /**
|
118 | * Returns the construct tree node that corresponds to the lambda function.
|
119 | * @internal
|
120 | */
|
121 | protected _functionNode(): cdk.ConstructNode;
|
122 | private ensureLambda;
|
123 | }
|