From: Casey Bodley Date: Fri, 9 Feb 2024 23:05:21 +0000 (-0500) Subject: rgw: add struct RGWGroupInfo X-Git-Tag: testing/wip-pdonnell-testing-20240416.232051-debug~25^2~74 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=b0a1fd07ba27ef93e50571ba5dae9abad6c6db72;p=ceph-ci.git rgw: add struct RGWGroupInfo Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 93abdf4f8a8..d7543701fd5 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -3065,6 +3065,36 @@ void RGWAccountInfo::generate_test_instances(std::list& o) o.push_back(p); } +void RGWGroupInfo::dump(Formatter * const f) const +{ + encode_json("id", id, f); + encode_json("tenant", tenant, f); + encode_json("name", name, f); + encode_json("path", path, f); + encode_json("account_id", account_id, f); +} + +void RGWGroupInfo::decode_json(JSONObj* obj) +{ + JSONDecoder::decode_json("id", id, obj); + JSONDecoder::decode_json("tenant", tenant, obj); + JSONDecoder::decode_json("name", name, obj); + JSONDecoder::decode_json("path", path, obj); + JSONDecoder::decode_json("account_id", account_id, obj); +} + +void RGWGroupInfo::generate_test_instances(std::list& o) +{ + o.push_back(new RGWGroupInfo); + auto p = new RGWGroupInfo; + p->id = "id"; + p->tenant = "tenant"; + p->name = "name"; + p->path = "/path/"; + p->account_id = "account"; + o.push_back(p); +} + void RGWStorageStats::dump(Formatter *f) const { encode_json("size", size, f); diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 84da4833ce6..aad3cef5915 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -833,6 +833,40 @@ struct RGWAccountInfo { }; WRITE_CLASS_ENCODER(RGWAccountInfo) +// user group metadata +struct RGWGroupInfo { + std::string id; + std::string tenant; + std::string name; + std::string path; + rgw_account_id account_id; + + void encode(bufferlist& bl) const { + ENCODE_START(1, 1, bl); + encode(id, bl); + encode(tenant, bl); + encode(name, bl); + encode(path, bl); + encode(account_id, bl); + ENCODE_FINISH(bl); + } + + void decode(bufferlist::const_iterator& bl) { + DECODE_START(1, bl); + decode(id, bl); + decode(tenant, bl); + decode(name, bl); + decode(path, bl); + decode(account_id, bl); + DECODE_FINISH(bl); + } + + void dump(Formatter* f) const; + void decode_json(JSONObj* obj); + static void generate_test_instances(std::list& o); +}; +WRITE_CLASS_ENCODER(RGWGroupInfo) + /// `RGWObjVersionTracker` /// ====================== /// diff --git a/src/tools/ceph-dencoder/rgw_types.h b/src/tools/ceph-dencoder/rgw_types.h index dde15908718..cd4b6f794ff 100644 --- a/src/tools/ceph-dencoder/rgw_types.h +++ b/src/tools/ceph-dencoder/rgw_types.h @@ -163,6 +163,7 @@ TYPE(RGWAccessKey) TYPE(RGWSubUser) TYPE(RGWUserInfo) TYPE(RGWAccountInfo) +TYPE(RGWGroupInfo) TYPE(rgw_bucket) TYPE(RGWBucketInfo) TYPE(RGWBucketEnt)