]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: add struct RGWGroupInfo
authorCasey Bodley <cbodley@redhat.com>
Fri, 9 Feb 2024 23:05:21 +0000 (18:05 -0500)
committerCasey Bodley <cbodley@redhat.com>
Wed, 10 Apr 2024 17:09:15 +0000 (13:09 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_common.cc
src/rgw/rgw_common.h
src/tools/ceph-dencoder/rgw_types.h

index 93abdf4f8a84fe3efb510c4e41a61cd055e1a4da..d7543701fd53527e0723ee2162dab771ea149032 100644 (file)
@@ -3065,6 +3065,36 @@ void RGWAccountInfo::generate_test_instances(std::list<RGWAccountInfo*>& 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<RGWGroupInfo*>& 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);
index 84da4833ce69a2afa140c63c049a7ae96d6c5b44..aad3cef59150ab056fa1b7d11fea65e424ab516d 100644 (file)
@@ -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<RGWGroupInfo*>& o);
+};
+WRITE_CLASS_ENCODER(RGWGroupInfo)
+
 /// `RGWObjVersionTracker`
 /// ======================
 ///
index dde159087180deee93b637a0775b413eaf0ff28b..cd4b6f794ffa2b8dcd80d122f330c4c592b59209 100644 (file)
@@ -163,6 +163,7 @@ TYPE(RGWAccessKey)
 TYPE(RGWSubUser)
 TYPE(RGWUserInfo)
 TYPE(RGWAccountInfo)
+TYPE(RGWGroupInfo)
 TYPE(rgw_bucket)
 TYPE(RGWBucketInfo)
 TYPE(RGWBucketEnt)