Files
scylladb/api/api.cc
Amnon Heiman ff4da7fcdc Adding the endpoint_snitch API implementation
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>
2015-07-02 17:45:23 +03:00

67 lines
2.3 KiB
C++

/*
* Copyright 2015 Cloudius Systems
*/
#include "api.hh"
#include "http/file_handler.hh"
#include "http/transformers.hh"
#include "http/api_docs.hh"
#include "storage_service.hh"
#include "commitlog.hh"
#include "gossiper.hh"
#include "failure_detector.hh"
#include "column_family.hh"
#include "messaging_service.hh"
#include "storage_proxy.hh"
#include "cache_service.hh"
#include "collectd.hh"
#include "endpoint_snitch.hh"
namespace api {
future<> set_server(http_context& ctx) {
auto rb = std::make_shared < api_registry_builder > ("api/api-doc/");
return ctx.http_server.set_routes([rb, &ctx](routes& r) {
httpd::directory_handler* dir = new httpd::directory_handler(ctx.api_dir,
new content_replace("html"));
r.put(GET, "/ui", new httpd::file_handler(ctx.api_dir + "/index.html",
new content_replace("html")));
r.add(GET, url("/ui").remainder("path"), dir);
rb->set_api_doc(r);
rb->register_function(r, "storage_service",
"The storage service API");
set_storage_service(ctx,r);
rb->register_function(r, "commitlog",
"The commit log API");
set_commitlog(ctx,r);
rb->register_function(r, "gossiper",
"The gossiper API");
set_gossiper(ctx,r);
rb->register_function(r, "column_family",
"The column family API");
set_column_family(ctx, r);
rb->register_function(r, "failure_detector",
"The failure detector API");
set_failure_detector(ctx,r);
rb->register_function(r, "messaging_service",
"The messaging service API");
set_messaging_service(ctx, r);
rb->register_function(r, "storage_proxy",
"The storage proxy API");
rb->register_function(r, "cache_service",
"The cache service API");
set_cache_service(ctx,r);
rb->register_function(r, "collectd",
"The collectd API");
set_collectd(ctx, r);
rb->register_function(r, "endpoint_snitch_info",
"The endpoint snitch info API");
set_endpoint_snitch(ctx, r);
});
}
}