docs/reference/adapter/aws_lambda/local_lambda_client.html
class LocalLambdaClient (app: chalice.app.Chalice, config: chalice.config.Config)#Expand source code
class LocalLambdaClient(BaseClient):
"""Lambda client implementing `invoke` for use when running with Chalice CLI."""
def __init__ (self, app: Chalice, config: Config) -> None:
self._app = app
self._config = config if config else Config()
def invoke(
self,
FunctionName: str,
InvocationType: str = "Event",
Payload: str = "{}",
) -> InvokeResponse:
scoped = self._config.scope(self._config.chalice_stage, FunctionName)
lambda_context = LambdaContext(FunctionName, memory_size=scoped.lambda_memory_size)
with self._patched_env_vars(scoped.environment_variables):
response = self._app(json.loads(Payload), lambda_context)
return InvokeResponse(payload=response)
Lambda client implementing invoke for use when running with Chalice CLI.
def invoke(self, FunctionName: str, InvocationType: str = 'Event', Payload: str = '{}') ‑> chalice.test.InvokeResponse#Expand source code
def invoke(
self,
FunctionName: str,
InvocationType: str = "Event",
Payload: str = "{}",
) -> InvokeResponse:
scoped = self._config.scope(self._config.chalice_stage, FunctionName)
lambda_context = LambdaContext(FunctionName, memory_size=scoped.lambda_memory_size)
with self._patched_env_vars(scoped.environment_variables):
response = self._app(json.loads(Payload), lambda_context)
return InvokeResponse(payload=response)