pip_services3_aws.services.CommandableLambdaService module

class pip_services3_aws.services.CommandableLambdaService.CommandableLambdaService(name: str)

Bases: pip_services3_aws.services.LambdaService.LambdaService, abc.ABC

Abstract service that receives commands via AWS Lambda protocol to operations automatically generated for commands defined in ICommandable components. Each command is exposed as invoke method that receives command name and parameters.

Commandable services require only 3 lines of code to implement a robust external Lambda-based remote interface.

This service is intended to work inside LambdaFunction container that exploses registered actions externally.

### Configuration parameters ###
  • dependencies:
    • controller: override for Controller dependency

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

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

Example:

class MyCommandableLambdaService(CommandableLambdaService):
    def __init__(self):
        super().__init__()
        self._dependency_resolver.put(
            "controller",
            Descriptor("mygroup","controller","*","*","1.0")
      )

service = MyCommandableLambdaService()
service.set_references(References.from_tuples(
    Descriptor("mygroup","controller","default","default","1.0"), controller
))

service.open("123")
print("The AWS Lambda service is running")
register()

Registers all actions in AWS Lambda function.