]> git.proxmox.com Git - ceph.git/blame - ceph/src/rgw/rgw_rest_user_policy.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / rgw / rgw_rest_user_policy.h
CommitLineData
11fdf7f2 1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
9f95a23c 2// vim: ts=8 sw=2 smarttab ft=cpp
11fdf7f2 3
9f95a23c 4#pragma once
f67539c2 5#include "rgw_rest.h"
11fdf7f2
TL
6
7class RGWRestUserPolicy : public RGWRESTOp {
8protected:
9 static constexpr int MAX_POLICY_NAME_LEN = 128;
10 string policy_name;
11 string user_name;
12 string policy;
13
14 bool validate_input();
15
16public:
f67539c2 17 int verify_permission(optional_yield y) override;
11fdf7f2
TL
18 virtual uint64_t get_op() = 0;
19 void send_response() override;
20 void dump(Formatter *f) const;
21};
22
23class RGWUserPolicyRead : public RGWRestUserPolicy {
24public:
25 RGWUserPolicyRead() = default;
9f95a23c 26 int check_caps(const RGWUserCaps& caps) override;
11fdf7f2
TL
27};
28
29class RGWUserPolicyWrite : public RGWRestUserPolicy {
30public:
31 RGWUserPolicyWrite() = default;
9f95a23c 32 int check_caps(const RGWUserCaps& caps) override;
11fdf7f2
TL
33};
34
35class RGWPutUserPolicy : public RGWUserPolicyWrite {
36public:
37 RGWPutUserPolicy() = default;
f67539c2 38 void execute(optional_yield y) override;
11fdf7f2
TL
39 int get_params();
40 const char* name() const override { return "put_user-policy"; }
41 uint64_t get_op() override;
42 RGWOpType get_type() override { return RGW_OP_PUT_USER_POLICY; }
43};
44
45class RGWGetUserPolicy : public RGWUserPolicyRead {
46public:
47 RGWGetUserPolicy() = default;
f67539c2 48 void execute(optional_yield y) override;
11fdf7f2
TL
49 int get_params();
50 const char* name() const override { return "get_user_policy"; }
51 uint64_t get_op() override;
52 RGWOpType get_type() override { return RGW_OP_GET_USER_POLICY; }
53};
54
55class RGWListUserPolicies : public RGWUserPolicyRead {
56public:
57 RGWListUserPolicies() = default;
f67539c2 58 void execute(optional_yield y) override;
11fdf7f2
TL
59 int get_params();
60 const char* name() const override { return "list_user_policies"; }
61 uint64_t get_op() override;
62 RGWOpType get_type() override { return RGW_OP_LIST_USER_POLICIES; }
63};
64
65class RGWDeleteUserPolicy : public RGWUserPolicyWrite {
66public:
67 RGWDeleteUserPolicy() = default;
f67539c2 68 void execute(optional_yield y) override;
11fdf7f2
TL
69 int get_params();
70 const char* name() const override { return "delete_user_policy"; }
71 uint64_t get_op() override;
72 RGWOpType get_type() override { return RGW_OP_DELETE_USER_POLICY; }
73};