in src/openwhisk/openwhisk.py [0:0]
def action_body(self, options):
if 'action' not in options:
raise Exception(missing_action_body_error)
if isinstance(options['action'], dict):
return options['action']
body = { 'exec': { 'kind': options['kind'] if 'kind' in options else 'python:3', 'code': options['action'] } }
if isinstance(options['action'], bytes):
body['exec']['code'] = base64.encodebytes(options['action'])
if 'limits' in options:
body['limits'] = options['limits']
if 'annotations' in options and isinstance(options['annotations'], dict):
annotations = []
for key, value in options['annotations']:
annotations.append({ 'key':key, 'value': value})
body['annotations'] = annotations
return body