]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_rest_info.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
5 #include "rgw_rest_info.h"
8 #define dout_subsys ceph_subsys_rgw
10 class RGWOp_Info_Get
: public RGWRESTOp
{
15 int check_caps(const RGWUserCaps
& caps
) override
{
16 return caps
.check_cap("info", RGW_CAP_READ
);
18 void execute(optional_yield y
) override
;
20 const char* name() const override
{ return "get_info"; }
23 void RGWOp_Info_Get::execute(optional_yield y
) {
24 Formatter
*formatter
= flusher
.get_formatter();
27 /* extensible array of general info sections, currently only
28 * storage backend is defined:
29 * {"info":{"storage_backends":[{"name":"rados","cluster_id":"75d1938b-2949-4933-8386-fb2d1449ff03"}]}}
31 formatter
->open_object_section("dummy");
32 formatter
->open_object_section("info");
33 formatter
->open_array_section("storage_backends");
34 // for now, just return the backend that is accessible
35 formatter
->open_object_section("dummy");
36 formatter
->dump_string("name", store
->get_name());
37 formatter
->dump_string("cluster_id", store
->get_cluster_id(this, y
));
38 formatter
->close_section();
39 formatter
->close_section();
40 formatter
->close_section();
41 formatter
->close_section();
44 } /* RGWOp_Info_Get::execute */
46 RGWOp
*RGWHandler_Info::op_get()
48 return new RGWOp_Info_Get
;