def proxy_operation_to_efs_lambda()

in source/api/app.py [0:0]


def proxy_operation_to_efs_lambda(filesystem_id, operation):
    """
    Proxies file system operations to the file manager lambda associated to a
    given filesystem

    :param filesystem_id: The id of the filesystem
    :param operation: The filesystem operation
    :returns: The filesystem operation result
    :raises ChaliceViewError
    """
    lambda_name = '{filesystem}-manager-lambda'.format(filesystem=filesystem_id)
    try:
        response = SERVERLESS.invoke(
            InvocationType='RequestResponse',
            FunctionName=lambda_name,
            Payload=bytes(json.dumps(operation), encoding='utf-8')
        )
    except botocore.exceptions.ClientError as error:
        app.log.error(error)
        raise ChaliceViewError(error)
    else:
        return response