def create_filesystem_lambda()

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


def create_filesystem_lambda(filesystem_id):
    """
    Proxies the filesystem manager creation to the create_manager_stack
    helper function

    :param filesystem_id: The filesystem to create resources for
    :returns: Creation response
    :raises ChaliceViewError, BadRequestError
    """
    request = app.current_request
    json_body = request.json_body

    try:
        subnet_ids = json_body['subnetIds']
        security_groups = json_body['securityGroups']
        uid = json_body['uid']
        gid = json_body['gid']
        path = json_body['path']
    except KeyError as error:
        app.log.error(error)
        raise BadRequestError("Check API logs")

    try:
        response = create_manager_stack(filesystem_id, uid, gid, path, subnet_ids, security_groups)
    except Exception as error:
        app.log.error(error)
        app.log.debug('Failed to create stack, deleting it.')
        raise ChaliceViewError('Check API Logs')
    else:
        return response