]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_rest_config.h
update source to 12.2.11
[ceph.git] / ceph / src / rgw / rgw_rest_config.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
7 *
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.
12 *
13 */
14
15 #ifndef RGW_REST_CONFIG_H
16 #define RGW_REST_CONFIG_H
17
18 class RGWOp_ZoneGroupMap_Get : public RGWRESTOp {
19 RGWZoneGroupMap zonegroup_map;
20 bool old_format;
21 public:
22 RGWOp_ZoneGroupMap_Get(bool _old_format):old_format(_old_format) {}
23 ~RGWOp_ZoneGroupMap_Get() override {}
24
25 int verify_permission() override {
26 return 0;
27 }
28 void execute() override;
29 void send_response() override;
30 const string name() override {
31 if (old_format) {
32 return "get_region_map";
33 } else {
34 return "get_zonegroup_map";
35 }
36 }
37 };
38
39 class RGWOp_ZoneConfig_Get : public RGWRESTOp {
40 RGWZoneParams zone_params;
41 public:
42 RGWOp_ZoneConfig_Get() {}
43
44 int check_caps(RGWUserCaps& caps) {
45 return caps.check_cap("admin", RGW_CAP_READ);
46 }
47 int verify_permission() {
48 return check_caps(s->user->caps);
49 }
50 void execute() {} /* store already has the info we need, just need to send response */
51 void send_response();
52 const string name() {
53 return "get_zone_config";
54 }
55 };
56
57 class RGWHandler_Config : public RGWHandler_Auth_S3 {
58 protected:
59 RGWOp *op_get() override;
60
61 int read_permissions(RGWOp*) override {
62 return 0;
63 }
64 public:
65 using RGWHandler_Auth_S3::RGWHandler_Auth_S3;
66 ~RGWHandler_Config() override = default;
67 };
68
69
70 class RGWRESTMgr_Config : public RGWRESTMgr {
71 public:
72 RGWRESTMgr_Config() = default;
73 ~RGWRESTMgr_Config() override = default;
74
75 RGWHandler_REST* get_handler(struct req_state*,
76 const rgw::auth::StrategyRegistry& auth_registry,
77 const std::string&) override {
78 return new RGWHandler_Config(auth_registry);
79 }
80 };
81
82 #endif /* RGW_REST_CONFIG_H */