pip_services3_aws.containers package

Submodules

Module contents

class pip_services3_aws.containers.CommandableLambdaFunction(name: str, description: Optional[str] = None)

Bases: pip_services3_aws.containers.LambdaFunction.LambdaFunction, abc.ABC

Abstract AWS Lambda function, that acts as a container to instantiate and run components and expose them via external entry point. All actions are automatically generated for commands defined in ICommandable components. Each command is exposed as an action defined by “cmd” parameter.

Container configuration for this Lambda function is stored in <code>”./config/config.yml”</code> file. But this path can be overriden by <code>CONFIG_PATH</code> environment variable.

Note: This component has been deprecated. Use LambdaService instead.

### References ###
  • *:logger:*:*:1.0 (optional) ContextInfo components to pass log messages

  • *:counters:*:*:1.0 (optional) ContextInfo components to pass collected measurements

  • *:service:lambda:*:1.0 (optional) ILambdaService services to handle action requests

  • *:service:commandable-lambda:*:1.0 (optional) ILambdaService services to handle action requests

See ILambdaService

Example:

class MyLambdaFunction(CommandableLambdaFunction):

    ...

    def __init__()

        super().__init__("mygroup", "MyGroup lambda function");
        self._dependency_resolver.put(
            "controller",
            Descriptor("mygroup","controller","*","*","1.0")
        )

        self.__controller: IMyController = None


lambda = MyLambdaFunction()

service.run()
print("MyLambdaFunction is started")
register()

Registers all actions in this lambda function.

class pip_services3_aws.containers.LambdaFunction(name: Optional[str] = None, description: Optional[str] = None)

Bases: pip_services3_container.Container.Container, abc.ABC

Abstract AWS Lambda function, that acts as a container to instantiate and run components and expose them via external entry point.

When handling calls “cmd” parameter determines which what action shall be called, while other parameters are passed to the action itself.

Container configuration for this Lambda function is stored in “./config/config.yml” file. But this path can be overriden by CONFIG_PATH environment variable.

### References ###
  • *:logger:*:*:1.0 (optional) ContextInfo components to pass log messages

  • *:counters:*:*:1.0 (optional) ContextInfo components to pass collected measurements

  • *:service:lambda:*:1.0 (optional) ILambdaService services to handle action requests

  • *:service:commandable-lambda:*:1.0 (optional) ILambdaService services to handle action requests

See ILambdaService

Example:

class MyLambdaFunction(LambdaFunction):
    def __init__(self):
        super().__init__("mygroup", "MyGroup lambda function")


lambda = MyLambdaFunction()

service.run();
print("MyLambdaFunction is started")
act(params: dict) Any

Calls registered action in this lambda function. “cmd” parameter in the action parameters determin what action shall be called.

This method shall only be used in testing.

Parameters

params – action parameters.

get_handler() Callable[[dict], Any]

Gets entry point into this lambda function.

Returns

an incoming event object with invocation parameters.

open(correlation_id: Optional[str])

Opens the component.

Parameters

correlation_id – (optional) transaction id to trace execution through call chain.

register()

Registers all actions in this lambda function.

Note: Overloading of this method has been deprecated. Use LambdaService instead.

run()

Runs this lambda function, loads container configuration, instantiate components and manage their lifecycle, makes this function ready to access action calls.

set_references(references: pip_services3_commons.refer.IReferences.IReferences)

Sets references to dependent components.

Parameters

references – references to locate the component dependencies.