]> git.proxmox.com Git - ceph.git/blame - ceph/src/rgw/rgw_rest_config.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / rgw / rgw_rest_config.h
CommitLineData
7c673cae
FG
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
11fdf7f2 3
7c673cae
FG
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
11fdf7f2
TL
19#include "rgw_zone.h"
20
7c673cae
FG
21class RGWOp_ZoneGroupMap_Get : public RGWRESTOp {
22 RGWZoneGroupMap zonegroup_map;
23 bool old_format;
24public:
11fdf7f2 25 explicit RGWOp_ZoneGroupMap_Get(bool _old_format):old_format(_old_format) {}
7c673cae
FG
26 ~RGWOp_ZoneGroupMap_Get() override {}
27
11fdf7f2
TL
28 int check_caps(RGWUserCaps& caps) override {
29 return caps.check_cap("zone", RGW_CAP_READ);
30 }
7c673cae 31 int verify_permission() override {
11fdf7f2 32 return check_caps(s->user->caps);
7c673cae
FG
33 }
34 void execute() override;
35 void send_response() override;
11fdf7f2 36 const char* name() const override {
7c673cae
FG
37 if (old_format) {
38 return "get_region_map";
39 } else {
40 return "get_zonegroup_map";
41 }
42 }
43};
44
45class RGWOp_ZoneConfig_Get : public RGWRESTOp {
46 RGWZoneParams zone_params;
47public:
48 RGWOp_ZoneConfig_Get() {}
49
11fdf7f2
TL
50 int check_caps(RGWUserCaps& caps) override {
51 return caps.check_cap("zone", RGW_CAP_READ);
7c673cae 52 }
11fdf7f2 53 int verify_permission() override {
7c673cae
FG
54 return check_caps(s->user->caps);
55 }
11fdf7f2
TL
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 {
7c673cae
FG
59 return "get_zone_config";
60 }
61};
62
63class RGWHandler_Config : public RGWHandler_Auth_S3 {
64protected:
65 RGWOp *op_get() override;
66
67 int read_permissions(RGWOp*) override {
68 return 0;
69 }
70public:
71 using RGWHandler_Auth_S3::RGWHandler_Auth_S3;
72 ~RGWHandler_Config() override = default;
73};
74
75
76class RGWRESTMgr_Config : public RGWRESTMgr {
77public:
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 */