]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_rest_config.h
update sources to ceph Nautilus 14.2.1
[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 /*
5 * Ceph - scalable distributed file system
6 *
7 * Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
8 *
9 * This is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License version 2.1, as published by the Free Software
12 * Foundation. See file COPYING.
13 *
14 */
15
16 #ifndef RGW_REST_CONFIG_H
17 #define RGW_REST_CONFIG_H
18
19 #include "rgw_zone.h"
20
21 class RGWOp_ZoneGroupMap_Get : public RGWRESTOp {
22 RGWZoneGroupMap zonegroup_map;
23 bool old_format;
24 public:
25 explicit RGWOp_ZoneGroupMap_Get(bool _old_format):old_format(_old_format) {}
26 ~RGWOp_ZoneGroupMap_Get() override {}
27
28 int check_caps(RGWUserCaps& caps) override {
29 return caps.check_cap("zone", RGW_CAP_READ);
30 }
31 int verify_permission() override {
32 return check_caps(s->user->caps);
33 }
34 void execute() override;
35 void send_response() override;
36 const char* name() const override {
37 if (old_format) {
38 return "get_region_map";
39 } else {
40 return "get_zonegroup_map";
41 }
42 }
43 };
44
45 class RGWOp_ZoneConfig_Get : public RGWRESTOp {
46 RGWZoneParams zone_params;
47 public:
48 RGWOp_ZoneConfig_Get() {}
49
50 int check_caps(RGWUserCaps& caps) override {
51 return caps.check_cap("zone", RGW_CAP_READ);
52 }
53 int verify_permission() override {
54 return check_caps(s->user->caps);
55 }
56 void execute() override {} /* store already has the info we need, just need to send response */
57 void send_response() override ;
58 const char* name() const override {
59 return "get_zone_config";
60 }
61 };
62
63 class RGWHandler_Config : public RGWHandler_Auth_S3 {
64 protected:
65 RGWOp *op_get() override;
66
67 int read_permissions(RGWOp*) override {
68 return 0;
69 }
70 public:
71 using RGWHandler_Auth_S3::RGWHandler_Auth_S3;
72 ~RGWHandler_Config() override = default;
73 };
74
75
76 class RGWRESTMgr_Config : public RGWRESTMgr {
77 public:
78 RGWRESTMgr_Config() = default;
79 ~RGWRESTMgr_Config() override = default;
80
81 RGWHandler_REST* get_handler(struct req_state*,
82 const rgw::auth::StrategyRegistry& auth_registry,
83 const std::string&) override {
84 return new RGWHandler_Config(auth_registry);
85 }
86 };
87
88 #endif /* RGW_REST_CONFIG_H */