def get_host_system_profile_by_id(host_id_list, page=1, per_page=100, order_by=None, order_how=None): query = _get_host_list_by_id_list(current_identity.account_number, host_id_list) try: order_by = _params_to_order_by(order_by, order_how) except ValueError as e: flask.abort(400, str(e)) else: query = query.order_by(*order_by) query_results = query.paginate(page, per_page, True) response_list = [ serialize_host_system_profile(host) for host in query_results.items ] json_output = { "total": query_results.total, "count": len(response_list), "page": page, "per_page": per_page, "results": response_list, } return _build_json_response(json_output, status=200)
def get_host_system_profile_by_id(host_id_list, page=1, per_page=100, order_by=None, order_how=None, fields=None): if fields: if not get_bulk_query_source() == BulkQuerySource.xjoin: logger.error("xjoin-search not accessible") flask.abort(503) total, response_list = get_sparse_system_profile( host_id_list, page, per_page, order_by, order_how, fields) else: query = _get_host_list_by_id_list(host_id_list) try: order_by = params_to_order_by(order_by, order_how) except ValueError as e: flask.abort(400, str(e)) else: query = query.order_by(*order_by) query_results = query.paginate(page, per_page, True) total = query_results.total response_list = [ serialize_host_system_profile(host) for host in query_results.items ] json_output = build_collection_response(response_list, page, per_page, total) return flask_json_response(json_output)
def get_host_system_profile_by_id(host_id_list, page=1, per_page=100, order_by=None, order_how=None): query = _get_host_list_by_id_list(current_identity.account_number, host_id_list) try: order_by = params_to_order_by(order_by, order_how) except ValueError as e: flask.abort(400, str(e)) else: query = query.order_by(*order_by) query_results = query.paginate(page, per_page, True) response_list = [serialize_host_system_profile(host) for host in query_results.items] json_output = build_collection_response(response_list, page, per_page, query_results.total) return flask_json_response(json_output)