This adds the implementation for the API endpoint_snitch After this patch the API doc can be found at: /api-doc/endpoint_snitch_info/ The following url are available: /snitch/datacenter /snitch/rack The get name is stubed /snitch/name Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
27 lines
754 B
C++
27 lines
754 B
C++
/*
|
|
* Copyright 2015 Cloudius Systems
|
|
*/
|
|
|
|
#include "locator/snitch_base.hh"
|
|
#include "endpoint_snitch.hh"
|
|
#include "api/api-doc/endpoint_snitch_info.json.hh"
|
|
|
|
namespace api {
|
|
|
|
void set_endpoint_snitch(http_context& ctx, routes& r) {
|
|
httpd::endpoint_snitch_info_json::get_datacenter.set(r, [] (const_req req) {
|
|
return locator::i_endpoint_snitch::get_local_snitch_ptr()->get_datacenter(req.get_query_param("host"));
|
|
});
|
|
|
|
httpd::endpoint_snitch_info_json::get_rack.set(r, [] (const_req req) {
|
|
return locator::i_endpoint_snitch::get_local_snitch_ptr()->get_rack(req.get_query_param("host"));
|
|
});
|
|
|
|
httpd::endpoint_snitch_info_json::get_snitch_name.set(r, [] (const_req req) {
|
|
//TBD
|
|
return "";
|
|
});
|
|
}
|
|
|
|
}
|