pip_services3_aws.clients.CommandableLambdaClient module

class pip_services3_aws.clients.CommandableLambdaClient.CommandableLambdaClient(name: str)

Bases: pip_services3_aws.clients.LambdaClient.LambdaClient

Abstract client that calls commandable AWS Lambda Functions.

Commandable services are generated automatically for ICommandable objects. Each command is exposed as action determined by “cmd” parameter.

### Configuration parameters ###

  • connections:
    • discovery_key: (optional) a key to retrieve the connection from IDiscovery

    • region: (optional) AWS region

  • credentials:
    • store_key: (optional) a key to retrieve the credentials from ICredentialStore

    • access_id: AWS access/client id

    • access_key: AWS access/client id

  • options:
    • connect_timeout: (optional) connection timeout in milliseconds (default: 10 sec)

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

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

  • *:discovery:*:*:1.0 (optional) IDiscovery services to resolve connection

  • *:credential-store:*:*:1.0 (optional) Credential stores to resolve credentials

See LambdaFunction

Example:

class MyLambdaClient(CommandableLambdaClient, IMyClient):
    ...

    def get_data(self, correlation_id: str, id: str) -> Any
        return this.callCommand("get_data", correlation_id, { 'id': id })

...

client = MyLambdaClient()
client.configure(ConfigParams.from_еuples(
    "connection.region", "us-east-1",
    "connection.access_id", "XXXXXXXXXXX",
    "connection.access_key", "XXXXXXXXXXX",
    "connection.arn", "YYYYYYYYYYYYY"
))

result = client.get_data("123", "1")
...
call_command(cmd: str, correlation_id: Optional[str], params: dict) Any

Calls a remote action in AWS Lambda function. The name of the action is added as “cmd” parameter to the action parameters.

Parameters
  • cmd – an action name

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

  • params – command parameters.

Returns

action result.