diff options
author | Casey Bodley <cbodley@redhat.com> | 2023-11-01 20:47:59 +0100 |
---|---|---|
committer | Casey Bodley <cbodley@redhat.com> | 2024-04-10 18:53:04 +0200 |
commit | 59bbd65bac0ea41ec8cca844b9b65b9def026467 (patch) | |
tree | 03c654642f2f5aa21d51b2dda6e14342657a5c81 /src/rgw/rgw_common.h | |
parent | rgw: define account ids and names (diff) | |
download | ceph-59bbd65bac0ea41ec8cca844b9b65b9def026467.tar.xz ceph-59bbd65bac0ea41ec8cca844b9b65b9def026467.zip |
rgw: add struct RGWAccountInfo
initial design and prototype by Abhishek
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
Signed-off-by: Casey Bodley <cbodley@redhat.com>
Diffstat (limited to 'src/rgw/rgw_common.h')
-rw-r--r-- | src/rgw/rgw_common.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 24392bc0caa..cb613b23b8d 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -747,6 +747,65 @@ struct RGWUserInfo }; WRITE_CLASS_ENCODER(RGWUserInfo) +// user account metadata +struct RGWAccountInfo { + rgw_account_id id; + std::string tenant; + std::string name; + std::string email; + RGWQuotaInfo quota; + + static constexpr int32_t DEFAULT_USER_LIMIT = 1000; + int32_t max_users = DEFAULT_USER_LIMIT; + + static constexpr int32_t DEFAULT_ROLE_LIMIT = 1000; + int32_t max_roles = DEFAULT_ROLE_LIMIT; + + static constexpr int32_t DEFAULT_GROUP_LIMIT = 1000; + int32_t max_groups = DEFAULT_GROUP_LIMIT; + + static constexpr int32_t DEFAULT_BUCKET_LIMIT = 1000; + int32_t max_buckets = DEFAULT_BUCKET_LIMIT; + + static constexpr int32_t DEFAULT_ACCESS_KEY_LIMIT = 4; + int32_t max_access_keys = DEFAULT_ACCESS_KEY_LIMIT; + + void encode(bufferlist& bl) const { + ENCODE_START(1, 1, bl); + encode(id, bl); + encode(tenant, bl); + encode(name, bl); + encode(email, bl); + encode(quota, bl); + encode(max_users, bl); + encode(max_roles, bl); + encode(max_groups, bl); + encode(max_buckets, bl); + encode(max_access_keys, bl); + ENCODE_FINISH(bl); + } + + void decode(bufferlist::const_iterator& bl) { + DECODE_START(1, bl); + decode(id, bl); + decode(tenant, bl); + decode(name, bl); + decode(email, bl); + decode(quota, bl); + decode(max_users, bl); + decode(max_roles, bl); + decode(max_groups, bl); + decode(max_buckets, bl); + decode(max_access_keys, bl); + DECODE_FINISH(bl); + } + + void dump(Formatter* f) const; + void decode_json(JSONObj* obj); + static void generate_test_instances(std::list<RGWAccountInfo*>& o); +}; +WRITE_CLASS_ENCODER(RGWAccountInfo) + /// `RGWObjVersionTracker` /// ====================== /// |