X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Frgw%2Frgw_rest_opstate.h;fp=src%2Fceph%2Fsrc%2Frgw%2Frgw_rest_opstate.h;h=82873e6bc6e7cd6d1e7c91bcb6e70b0a43764275;hb=812ff6ca9fcd3e629e49d4328905f33eee8ca3f5;hp=0000000000000000000000000000000000000000;hpb=15280273faafb77777eab341909a3f495cf248d9;p=stor4nfv.git diff --git a/src/ceph/src/rgw/rgw_rest_opstate.h b/src/ceph/src/rgw/rgw_rest_opstate.h new file mode 100644 index 0000000..82873e6 --- /dev/null +++ b/src/ceph/src/rgw/rgw_rest_opstate.h @@ -0,0 +1,111 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2013 eNovance SAS + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#ifndef RGW_REST_OPSTATE_H +#define RGW_REST_OPSTATE_H + +class RGWOp_Opstate_List : public RGWRESTOp { + bool sent_header; +public: + RGWOp_Opstate_List() : sent_header(false) {} + ~RGWOp_Opstate_List() override {} + + int check_caps(RGWUserCaps& caps) override { + return caps.check_cap("opstate", RGW_CAP_READ); + } + int verify_permission() override { + return check_caps(s->user->caps); + } + void execute() override; + void send_response() override; + virtual void send_response(list entries); + virtual void send_response_end(); + const string name() override { + return "opstate_list"; + } +}; + +class RGWOp_Opstate_Set : public RGWRESTOp { +public: + RGWOp_Opstate_Set() {} + ~RGWOp_Opstate_Set() override {} + + int check_caps(RGWUserCaps& caps) override { + return caps.check_cap("opstate", RGW_CAP_WRITE); + } + void execute() override; + const string name() override { + return "set_opstate"; + } +}; + +class RGWOp_Opstate_Renew : public RGWRESTOp { +public: + RGWOp_Opstate_Renew() {} + ~RGWOp_Opstate_Renew() override {} + + int check_caps(RGWUserCaps& caps) override { + return caps.check_cap("opstate", RGW_CAP_WRITE); + } + void execute() override; + const string name() override { + return "renew_opstate"; + } +}; + +class RGWOp_Opstate_Delete : public RGWRESTOp { +public: + RGWOp_Opstate_Delete() {} + ~RGWOp_Opstate_Delete() override {} + + int check_caps(RGWUserCaps& caps) override { + return caps.check_cap("opstate", RGW_CAP_WRITE); + } + void execute() override; + const string name() override { + return "delete_opstate"; + } +}; + +class RGWHandler_Opstate : public RGWHandler_Auth_S3 { +protected: + RGWOp *op_get() override { + return new RGWOp_Opstate_List; + } + RGWOp *op_delete() override { + return new RGWOp_Opstate_Delete; + } + RGWOp *op_post() override; + + int read_permissions(RGWOp*) override { + return 0; + } +public: + using RGWHandler_Auth_S3::RGWHandler_Auth_S3; + ~RGWHandler_Opstate() override = default; +}; + +class RGWRESTMgr_Opstate : public RGWRESTMgr { +public: + RGWRESTMgr_Opstate() = default; + ~RGWRESTMgr_Opstate() override = default; + + RGWHandler_REST* get_handler(struct req_state*, + const rgw::auth::StrategyRegistry& auth_registry, + const std::string&) override { + return new RGWHandler_Opstate(auth_registry); + } +}; + +#endif /*!RGW_REST_OPSTATE_H*/