UNPKG

3.29 kBTypeScriptView Raw
1import { LambdaFunction } from './LambdaFunction';
2/**
3 * Abstract AWS Lambda function, that acts as a container to instantiate and run components
4 * and expose them via external entry point. All actions are automatically generated for commands
5 * defined in [[https://pip-services3-node.github.io/pip-services3-commons-node/interfaces/commands.icommandable.html ICommandable components]]. Each command is exposed as an action defined by "cmd" parameter.
6 *
7 * Container configuration for this Lambda function is stored in <code>"./config/config.yml"</code> file.
8 * But this path can be overriden by <code>CONFIG_PATH</code> environment variable.
9 *
10 * ### Configuration parameters ###
11 *
12 * - dependencies:
13 * - controller: override for Controller dependency
14 * - connections:
15 * - discovery_key: (optional) a key to retrieve the connection from [[https://pip-services3-node.github.io/pip-services3-components-node/interfaces/connect.idiscovery.html IDiscovery]]
16 * - region: (optional) AWS region
17 * - credentials:
18 * - store_key: (optional) a key to retrieve the credentials from [[https://pip-services3-node.github.io/pip-services3-components-node/interfaces/auth.icredentialstore.html ICredentialStore]]
19 * - access_id: AWS access/client id
20 * - access_key: AWS access/client id
21 *
22 * ### References ###
23 *
24 * - <code>\*:logger:\*:\*:1.0</code> (optional) [[https://pip-services3-node.github.io/pip-services3-components-node/interfaces/log.ilogger.html ILogger]] components to pass log messages
25 * - <code>\*:counters:\*:\*:1.0</code> (optional) [[https://pip-services3-node.github.io/pip-services3-components-node/interfaces/count.icounters.html ICounters]] components to pass collected measurements
26 * - <code>\*:discovery:\*:\*:1.0</code> (optional) [[https://pip-services3-node.github.io/pip-services3-components-node/interfaces/connect.idiscovery.html IDiscovery]] services to resolve connection
27 * - <code>\*:credential-store:\*:\*:1.0</code> (optional) Credential stores to resolve credentials
28 *
29 * @see [[LambdaClient]]
30 *
31 * ### Example ###
32 *
33 * class MyLambdaFunction extends CommandableLambdaFunction {
34 * private _controller: IMyController;
35 * ...
36 * public constructor() {
37 * base("mygroup", "MyGroup lambda function");
38 * this._dependencyResolver.put(
39 * "controller",
40 * new Descriptor("mygroup","controller","*","*","1.0")
41 * );
42 * }
43 * }
44 *
45 * let lambda = new MyLambdaFunction();
46 *
47 * service.run((err) => {
48 * console.log("MyLambdaFunction is started");
49 * });
50 */
51export declare abstract class CommandableLambdaFunction extends LambdaFunction {
52 /**
53 * Creates a new instance of this lambda function.
54 *
55 * @param name (optional) a container name (accessible via ContextInfo)
56 * @param description (optional) a container description (accessible via ContextInfo)
57 */
58 constructor(name: string, description?: string);
59 private registerCommandSet;
60 /**
61 * Registers all actions in this lambda function.
62 */
63 register(): void;
64}