Added Lambda invoke capability.
This commit is contained in:
parent
a9e54482fc
commit
bfa079ec4e
4 changed files with 70 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
|||
import base64
|
||||
import datetime
|
||||
import hashlib
|
||||
import json
|
||||
|
||||
import boto.awslambda
|
||||
from moto.core import BaseBackend
|
||||
|
|
@ -92,6 +93,18 @@ class LambdaFunction(object):
|
|||
"Configuration": self.get_configuration(),
|
||||
}
|
||||
|
||||
def invoke(self, request, headers):
|
||||
payload = dict()
|
||||
|
||||
# Get the invocation type:
|
||||
if request.headers.get("x-amz-invocation-type") == "RequestResponse":
|
||||
encoded = base64.b64encode("Some log file output...".encode('utf-8'))
|
||||
headers["x-amz-log-result"] = encoded.decode('utf-8')
|
||||
|
||||
payload["result"] = "Good"
|
||||
|
||||
return json.dumps(payload, indent=4)
|
||||
|
||||
@classmethod
|
||||
def create_from_cloudformation_json(cls, resource_name, cloudformation_json, region_name):
|
||||
properties = cloudformation_json['Properties']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue