]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_rest_user_policy.h
import ceph 15.2.10
[ceph.git] / ceph / src / rgw / rgw_rest_user_policy.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 #pragma once
5
6 class RGWRestUserPolicy : public RGWRESTOp {
7 protected:
8 static constexpr int MAX_POLICY_NAME_LEN = 128;
9 string policy_name;
10 string user_name;
11 string policy;
12
13 bool validate_input();
14
15 public:
16 int verify_permission() override;
17 virtual uint64_t get_op() = 0;
18 void send_response() override;
19 void dump(Formatter *f) const;
20 };
21
22 class RGWUserPolicyRead : public RGWRestUserPolicy {
23 public:
24 RGWUserPolicyRead() = default;
25 int check_caps(const RGWUserCaps& caps) override;
26 };
27
28 class RGWUserPolicyWrite : public RGWRestUserPolicy {
29 public:
30 RGWUserPolicyWrite() = default;
31 int check_caps(const RGWUserCaps& caps) override;
32 };
33
34 class RGWPutUserPolicy : public RGWUserPolicyWrite {
35 public:
36 RGWPutUserPolicy() = default;
37 void execute() override;
38 int get_params();
39 const char* name() const override { return "put_user-policy"; }
40 uint64_t get_op() override;
41 RGWOpType get_type() override { return RGW_OP_PUT_USER_POLICY; }
42 };
43
44 class RGWGetUserPolicy : public RGWUserPolicyRead {
45 public:
46 RGWGetUserPolicy() = default;
47 void execute() override;
48 int get_params();
49 const char* name() const override { return "get_user_policy"; }
50 uint64_t get_op() override;
51 RGWOpType get_type() override { return RGW_OP_GET_USER_POLICY; }
52 };
53
54 class RGWListUserPolicies : public RGWUserPolicyRead {
55 public:
56 RGWListUserPolicies() = default;
57 void execute() override;
58 int get_params();
59 const char* name() const override { return "list_user_policies"; }
60 uint64_t get_op() override;
61 RGWOpType get_type() override { return RGW_OP_LIST_USER_POLICIES; }
62 };
63
64 class RGWDeleteUserPolicy : public RGWUserPolicyWrite {
65 public:
66 RGWDeleteUserPolicy() = default;
67 void execute() override;
68 int get_params();
69 const char* name() const override { return "delete_user_policy"; }
70 uint64_t get_op() override;
71 RGWOpType get_type() override { return RGW_OP_DELETE_USER_POLICY; }
72 };