1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
14 #include "common/ceph_json.h"
15 #include "common/strtol.h"
18 #include "rgw_rados.h"
19 #include "rgw_rest_s3.h"
20 #include "rgw_rest_config.h"
21 #include "rgw_client_io.h"
22 #include "common/errno.h"
23 #include "include/assert.h"
25 #define dout_context g_ceph_context
26 #define dout_subsys ceph_subsys_rgw
28 void RGWOp_ZoneGroupMap_Get::execute() {
29 http_ret = zonegroup_map.read(g_ceph_context, store);
31 dout(5) << "failed to read zone_group map" << dendl;
35 void RGWOp_ZoneGroupMap_Get::send_response() {
36 set_req_state_err(s, http_ret);
44 RGWRegionMap region_map;
45 region_map.regions = zonegroup_map.zonegroups;
46 region_map.master_region = zonegroup_map.master_zonegroup;
47 region_map.bucket_quota = zonegroup_map.bucket_quota;
48 region_map.user_quota = zonegroup_map.user_quota;
49 encode_json("region-map", region_map, s->formatter);
51 encode_json("zonegroup-map", zonegroup_map, s->formatter);
56 void RGWOp_ZoneConfig_Get::send_response() {
57 const RGWZoneParams& zone_params = store->get_zone_params();
59 set_req_state_err(s, http_ret);
66 encode_json("zone_params", zone_params, s->formatter);
70 RGWOp* RGWHandler_Config::op_get() {
72 string type = s->info.args.get("type", &exists);
74 if (type.compare("zonegroup-map") == 0) {
75 return new RGWOp_ZoneGroupMap_Get(false);
76 } else if (type.compare("zone") == 0) {
77 return new RGWOp_ZoneConfig_Get();
79 return new RGWOp_ZoneGroupMap_Get(true);