]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_rest_config.h
import quincy beta 17.1.0
[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 ft=cpp
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 #pragma once
17
18 #include "rgw_auth_s3.h"
19 #include "rgw_rest.h"
20 #include "rgw_zone.h"
21
22 class RGWOp_ZoneGroupMap_Get : public RGWRESTOp {
23 RGWZoneGroupMap zonegroup_map;
24 bool old_format;
25 public:
26 explicit RGWOp_ZoneGroupMap_Get(bool _old_format):old_format(_old_format) {}
27 ~RGWOp_ZoneGroupMap_Get() override {}
28
29 int check_caps(const RGWUserCaps& caps) override {
30 return caps.check_cap("zone", RGW_CAP_READ);
31 }
32 int verify_permission(optional_yield) override {
33 return check_caps(s->user->get_caps());
34 }
35 void execute(optional_yield y) override;
36 void send_response() override;
37 const char* name() const override {
38 if (old_format) {
39 return "get_region_map";
40 } else {
41 return "get_zonegroup_map";
42 }
43 }
44 };
45
46 class RGWOp_ZoneConfig_Get : public RGWRESTOp {
47 RGWZoneParams zone_params;
48 public:
49 RGWOp_ZoneConfig_Get() {}
50
51 int check_caps(const RGWUserCaps& caps) override {
52 return caps.check_cap("zone", RGW_CAP_READ);
53 }
54 int verify_permission(optional_yield) override {
55 return check_caps(s->user->get_caps());
56 }
57 void execute(optional_yield) override {} /* store already has the info we need, just need to send response */
58 void send_response() override ;
59 const char* name() const override {
60 return "get_zone_config";
61 }
62 };
63
64 class RGWHandler_Config : public RGWHandler_Auth_S3 {
65 protected:
66 RGWOp *op_get() override;
67
68 int read_permissions(RGWOp*, optional_yield) override {
69 return 0;
70 }
71 public:
72 using RGWHandler_Auth_S3::RGWHandler_Auth_S3;
73 ~RGWHandler_Config() override = default;
74 };
75
76
77 class RGWRESTMgr_Config : public RGWRESTMgr {
78 public:
79 RGWRESTMgr_Config() = default;
80 ~RGWRESTMgr_Config() override = default;
81
82 RGWHandler_REST* get_handler(rgw::sal::Store* ,
83 struct req_state*,
84 const rgw::auth::StrategyRegistry& auth_registry,
85 const std::string&) override {
86 return new RGWHandler_Config(auth_registry);
87 }
88 };