diff options
-rw-r--r-- | src/rgw/rgw_rest_config.cc | 16 | ||||
-rw-r--r-- | src/rgw/rgw_rest_config.h | 18 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/rgw/rgw_rest_config.cc b/src/rgw/rgw_rest_config.cc index 645d4b855fe..3770cec15de 100644 --- a/src/rgw/rgw_rest_config.cc +++ b/src/rgw/rgw_rest_config.cc @@ -53,12 +53,28 @@ void RGWOp_ZoneGroupMap_Get::send_response() { flusher.flush(); } +void RGWOp_ZoneConfig_Get::send_response() { + const RGWZoneParams& zone_params = store->get_zone_params(); + + set_req_state_err(s, http_ret); + dump_errno(s); + end_header(s); + + if (http_ret < 0) + return; + + encode_json("zone_params", zone_params, s->formatter); + flusher.flush(); +} + RGWOp* RGWHandler_Config::op_get() { bool exists; string type = s->info.args.get("type", &exists); if (type.compare("zonegroup-map") == 0) { return new RGWOp_ZoneGroupMap_Get(false); + } else if (type.compare("zone") == 0) { + return new RGWOp_ZoneConfig_Get(); } else { return new RGWOp_ZoneGroupMap_Get(true); } diff --git a/src/rgw/rgw_rest_config.h b/src/rgw/rgw_rest_config.h index e9fcfd79ca6..8835c1a821f 100644 --- a/src/rgw/rgw_rest_config.h +++ b/src/rgw/rgw_rest_config.h @@ -36,6 +36,24 @@ public: } }; +class RGWOp_ZoneConfig_Get : public RGWRESTOp { + RGWZoneParams zone_params; +public: + RGWOp_ZoneConfig_Get() {} + + int check_caps(RGWUserCaps& caps) { + return caps.check_cap("admin", RGW_CAP_READ); + } + int verify_permission() { + return check_caps(s->user->caps); + } + void execute() {} /* store already has the info we need, just need to send response */ + void send_response(); + const string name() { + return "get_zone_config"; + } +}; + class RGWHandler_Config : public RGWHandler_Auth_S3 { protected: RGWOp *op_get(); |