]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_rest_replica_log.h
bump version to 12.1.1-pve1 while rebasing patches
[ceph.git] / ceph / src / rgw / rgw_rest_replica_log.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_REPLICA_LOG_H
16 #define RGW_REST_REPLICA_LOG_H
17
18 class RGWOp_OBJLog_GetBounds : public RGWRESTOp {
19 string prefix;
20 string obj_type;
21 RGWReplicaBounds bounds;
22
23 public:
24 RGWOp_OBJLog_GetBounds(const char *_prefix, const char *type)
25 : prefix(_prefix), obj_type(type){}
26 ~RGWOp_OBJLog_GetBounds() override {}
27
28 int check_caps(RGWUserCaps& caps) override {
29 return caps.check_cap(obj_type.c_str(), 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 string name() override {
37 string s = "replica";
38 s.append(obj_type);
39 s.append("_getbounds");
40 return s;
41 }
42 };
43
44 class RGWOp_OBJLog_SetBounds : public RGWRESTOp {
45 string prefix;
46 string obj_type;
47 public:
48 RGWOp_OBJLog_SetBounds(const char *_prefix, const char *type)
49 : prefix(_prefix), obj_type(type){}
50 ~RGWOp_OBJLog_SetBounds() override {}
51
52 int check_caps(RGWUserCaps& caps) override {
53 return caps.check_cap(obj_type.c_str(), RGW_CAP_WRITE);
54 }
55 void execute() override;
56 const string name() override {
57 string s = "replica";
58 s.append(obj_type);
59 s.append("_updatebounds");
60 return s;
61 }
62 };
63
64 class RGWOp_OBJLog_DeleteBounds : public RGWRESTOp {
65 string prefix;
66 string obj_type;
67 public:
68 RGWOp_OBJLog_DeleteBounds(const char *_prefix, const char *type)
69 : prefix(_prefix), obj_type(type){}
70 ~RGWOp_OBJLog_DeleteBounds() override {}
71
72 int check_caps(RGWUserCaps& caps) override {
73 return caps.check_cap(obj_type.c_str(), RGW_CAP_WRITE);
74 }
75 void execute() override;
76 const string name() override {
77 string s = "replica";
78 s.append(obj_type);
79 s.append("_deletebound");
80 return s;
81 }
82 };
83
84 class RGWOp_BILog_GetBounds : public RGWRESTOp {
85 RGWReplicaBounds bounds;
86 public:
87 RGWOp_BILog_GetBounds() {}
88 ~RGWOp_BILog_GetBounds() override {}
89
90 int check_caps(RGWUserCaps& caps) override {
91 return caps.check_cap("bilog", RGW_CAP_READ);
92 }
93 int verify_permission() override {
94 return check_caps(s->user->caps);
95 }
96 void execute() override;
97 void send_response() override;
98 const string name() override {
99 return "replicabilog_getbounds";
100 }
101 };
102
103 class RGWOp_BILog_SetBounds : public RGWRESTOp {
104 public:
105 RGWOp_BILog_SetBounds() {}
106 ~RGWOp_BILog_SetBounds() override {}
107
108 int check_caps(RGWUserCaps& caps) override {
109 return caps.check_cap("bilog", RGW_CAP_WRITE);
110 }
111 void execute() override;
112 const string name() override {
113 return "replicabilog_updatebounds";
114 }
115 };
116
117 class RGWOp_BILog_DeleteBounds : public RGWRESTOp {
118 public:
119 RGWOp_BILog_DeleteBounds() {}
120 ~RGWOp_BILog_DeleteBounds() override {}
121
122 int check_caps(RGWUserCaps& caps) override {
123 return caps.check_cap("bilog", RGW_CAP_WRITE);
124 }
125 void execute() override;
126 const string name() override {
127 return "replicabilog_deletebound";
128 }
129 };
130
131 class RGWHandler_ReplicaLog : public RGWHandler_Auth_S3 {
132 protected:
133 RGWOp *op_get() override;
134 RGWOp *op_delete() override;
135 RGWOp *op_post() override;
136
137 int read_permissions(RGWOp*) override {
138 return 0;
139 }
140 public:
141 using RGWHandler_Auth_S3::RGWHandler_Auth_S3;
142 ~RGWHandler_ReplicaLog() override = default;
143 };
144
145 class RGWRESTMgr_ReplicaLog : public RGWRESTMgr {
146 public:
147 RGWRESTMgr_ReplicaLog() = default;
148 ~RGWRESTMgr_ReplicaLog() override = default;
149
150 RGWHandler_REST* get_handler(struct req_state*,
151 const rgw::auth::StrategyRegistry& auth_registry,
152 const std::string&) override {
153 return new RGWHandler_ReplicaLog(auth_registry);
154 }
155 };
156
157 #endif /*!RGW_REST_REPLICA_LOG_H*/