Example #1
0
def create_function(tenant_id, user_id, function_id, image_id, zip_url, tag, meta=None):
    try:
        f = Function()
        f.meta.id = function_id  # make this an uuid
        f.function_id = function_id  # make this an uuid
        f.user_id = user_id
        f.tenant_id = tenant_id
        f.image_id = image_id
        f.zip_location = zip_url
        f.type = 'async'
        f.event = 'webhook'
        f.description = meta.get('description', None)
        f.memory = meta.get('memory', None)
        f.name = meta.get('name', None)
        f.runtime = meta.get('runtime', None)
        f.endpoint = "{0}/functions/{1}".format(endpoint, function_id)
        f.tag = tag
        return f.save()
    except Exception as error:
        log.error(error.message)
        return None