1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
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.
15 #ifndef RGW_REST_REPLICA_LOG_H
16 #define RGW_REST_REPLICA_LOG_H
18 class RGWOp_OBJLog_GetBounds
: public RGWRESTOp
{
21 RGWReplicaBounds bounds
;
24 RGWOp_OBJLog_GetBounds(const char *_prefix
, const char *type
)
25 : prefix(_prefix
), obj_type(type
){}
26 ~RGWOp_OBJLog_GetBounds() override
{}
28 int check_caps(RGWUserCaps
& caps
) override
{
29 return caps
.check_cap(obj_type
.c_str(), RGW_CAP_READ
);
31 int verify_permission() override
{
32 return check_caps(s
->user
->caps
);
34 void execute() override
;
35 void send_response() override
;
36 const string
name() override
{
39 s
.append("_getbounds");
44 class RGWOp_OBJLog_SetBounds
: public RGWRESTOp
{
48 RGWOp_OBJLog_SetBounds(const char *_prefix
, const char *type
)
49 : prefix(_prefix
), obj_type(type
){}
50 ~RGWOp_OBJLog_SetBounds() override
{}
52 int check_caps(RGWUserCaps
& caps
) override
{
53 return caps
.check_cap(obj_type
.c_str(), RGW_CAP_WRITE
);
55 void execute() override
;
56 const string
name() override
{
59 s
.append("_updatebounds");
64 class RGWOp_OBJLog_DeleteBounds
: public RGWRESTOp
{
68 RGWOp_OBJLog_DeleteBounds(const char *_prefix
, const char *type
)
69 : prefix(_prefix
), obj_type(type
){}
70 ~RGWOp_OBJLog_DeleteBounds() override
{}
72 int check_caps(RGWUserCaps
& caps
) override
{
73 return caps
.check_cap(obj_type
.c_str(), RGW_CAP_WRITE
);
75 void execute() override
;
76 const string
name() override
{
79 s
.append("_deletebound");
84 class RGWOp_BILog_GetBounds
: public RGWRESTOp
{
85 RGWReplicaBounds bounds
;
87 RGWOp_BILog_GetBounds() {}
88 ~RGWOp_BILog_GetBounds() override
{}
90 int check_caps(RGWUserCaps
& caps
) override
{
91 return caps
.check_cap("bilog", RGW_CAP_READ
);
93 int verify_permission() override
{
94 return check_caps(s
->user
->caps
);
96 void execute() override
;
97 void send_response() override
;
98 const string
name() override
{
99 return "replicabilog_getbounds";
103 class RGWOp_BILog_SetBounds
: public RGWRESTOp
{
105 RGWOp_BILog_SetBounds() {}
106 ~RGWOp_BILog_SetBounds() override
{}
108 int check_caps(RGWUserCaps
& caps
) override
{
109 return caps
.check_cap("bilog", RGW_CAP_WRITE
);
111 void execute() override
;
112 const string
name() override
{
113 return "replicabilog_updatebounds";
117 class RGWOp_BILog_DeleteBounds
: public RGWRESTOp
{
119 RGWOp_BILog_DeleteBounds() {}
120 ~RGWOp_BILog_DeleteBounds() override
{}
122 int check_caps(RGWUserCaps
& caps
) override
{
123 return caps
.check_cap("bilog", RGW_CAP_WRITE
);
125 void execute() override
;
126 const string
name() override
{
127 return "replicabilog_deletebound";
131 class RGWHandler_ReplicaLog
: public RGWHandler_Auth_S3
{
133 RGWOp
*op_get() override
;
134 RGWOp
*op_delete() override
;
135 RGWOp
*op_post() override
;
137 int read_permissions(RGWOp
*) override
{
141 using RGWHandler_Auth_S3::RGWHandler_Auth_S3
;
142 ~RGWHandler_ReplicaLog() override
= default;
145 class RGWRESTMgr_ReplicaLog
: public RGWRESTMgr
{
147 RGWRESTMgr_ReplicaLog() = default;
148 ~RGWRESTMgr_ReplicaLog() override
= default;
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
);
157 #endif /*!RGW_REST_REPLICA_LOG_H*/