]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_rest_opstate.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rgw / rgw_rest_opstate.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_OPSTATE_H
16 #define RGW_REST_OPSTATE_H
17
18 class RGWOp_Opstate_List : public RGWRESTOp {
19 bool sent_header;
20 public:
21 RGWOp_Opstate_List() : sent_header(false) {}
22 ~RGWOp_Opstate_List() override {}
23
24 int check_caps(RGWUserCaps& caps) override {
25 return caps.check_cap("opstate", RGW_CAP_READ);
26 }
27 int verify_permission() override {
28 return check_caps(s->user->caps);
29 }
30 void execute() override;
31 void send_response() override;
32 virtual void send_response(list<cls_statelog_entry> entries);
33 virtual void send_response_end();
34 const string name() override {
35 return "opstate_list";
36 }
37 };
38
39 class RGWOp_Opstate_Set : public RGWRESTOp {
40 public:
41 RGWOp_Opstate_Set() {}
42 ~RGWOp_Opstate_Set() override {}
43
44 int check_caps(RGWUserCaps& caps) override {
45 return caps.check_cap("opstate", RGW_CAP_WRITE);
46 }
47 void execute() override;
48 const string name() override {
49 return "set_opstate";
50 }
51 };
52
53 class RGWOp_Opstate_Renew : public RGWRESTOp {
54 public:
55 RGWOp_Opstate_Renew() {}
56 ~RGWOp_Opstate_Renew() override {}
57
58 int check_caps(RGWUserCaps& caps) override {
59 return caps.check_cap("opstate", RGW_CAP_WRITE);
60 }
61 void execute() override;
62 const string name() override {
63 return "renew_opstate";
64 }
65 };
66
67 class RGWOp_Opstate_Delete : public RGWRESTOp {
68 public:
69 RGWOp_Opstate_Delete() {}
70 ~RGWOp_Opstate_Delete() override {}
71
72 int check_caps(RGWUserCaps& caps) override {
73 return caps.check_cap("opstate", RGW_CAP_WRITE);
74 }
75 void execute() override;
76 const string name() override {
77 return "delete_opstate";
78 }
79 };
80
81 class RGWHandler_Opstate : public RGWHandler_Auth_S3 {
82 protected:
83 RGWOp *op_get() override {
84 return new RGWOp_Opstate_List;
85 }
86 RGWOp *op_delete() override {
87 return new RGWOp_Opstate_Delete;
88 }
89 RGWOp *op_post() override;
90
91 int read_permissions(RGWOp*) override {
92 return 0;
93 }
94 public:
95 using RGWHandler_Auth_S3::RGWHandler_Auth_S3;
96 ~RGWHandler_Opstate() override = default;
97 };
98
99 class RGWRESTMgr_Opstate : public RGWRESTMgr {
100 public:
101 RGWRESTMgr_Opstate() = default;
102 ~RGWRESTMgr_Opstate() override = default;
103
104 RGWHandler_REST* get_handler(struct req_state*,
105 const rgw::auth::StrategyRegistry& auth_registry,
106 const std::string&) override {
107 return new RGWHandler_Opstate(auth_registry);
108 }
109 };
110
111 #endif /*!RGW_REST_OPSTATE_H*/