]> git.apps.os.sepia.ceph.com Git - ceph.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>
Fri, 12 Apr 2024 19:34:28 +0000 (15:34 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit b0a1fd07ba27ef93e50571ba5dae9abad6c6db72)

src/rgw/rgw_common.cc
src/rgw/rgw_common.h
src/tools/ceph-dencoder/rgw_types.h

index fae20c0c728e93f1ae65a7a609bca9d7862ce0e0..349b33c1cce3f82f79d5ba6b81a3d5b61fc8ddc2 100644 (file)
@@ -3064,6 +3064,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 5536c3a3e60ad85fc991c65e584e7a196fa525b5..15f90171baab55140ed69f3221dbaa8191ecd263 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 49bb35e6242b7afb7ceebda21ba2d2e6391c79ca..0fc312a374b0ac1bbb9654b89e7b34ce117451b1 100644 (file)
@@ -162,6 +162,7 @@ TYPE(RGWAccessKey)
 TYPE(RGWSubUser)
 TYPE(RGWUserInfo)
 TYPE(RGWAccountInfo)
+TYPE(RGWGroupInfo)
 TYPE(rgw_bucket)
 TYPE(RGWBucketInfo)
 TYPE(RGWBucketEnt)