]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add access key to zone info
authorYehuda Sadeh <yehuda@inktank.com>
Mon, 20 May 2013 19:13:31 +0000 (12:13 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Mon, 20 May 2013 19:13:31 +0000 (12:13 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_common.h
src/rgw/rgw_json_enc.cc
src/rgw/rgw_rados.h

index 1403f655e8fb69bf756d72bbb836dd640a05df2d..fcbef98fc7faa745cd82e1a056ebefeb56200234 100644 (file)
@@ -309,6 +309,7 @@ struct RGWAccessKey {
      DECODE_FINISH(bl);
   }
   void dump(Formatter *f) const;
+  void dump_plain(Formatter *f) const;
   void dump(Formatter *f, const string& user, bool swift) const;
   static void generate_test_instances(list<RGWAccessKey*>& o);
 
index 030754583182bea68869439aba818f294af2d198..74042116967cfd5828aa039464818eaaf013fb5d 100644 (file)
@@ -176,6 +176,19 @@ void RGWAccessKey::dump(Formatter *f) const
   encode_json("subuser", subuser, f);
 }
 
+void RGWAccessKey::dump_plain(Formatter *f) const
+{
+  encode_json("access_key", id, f);
+  encode_json("secret_key", key, f);
+}
+
+void encode_json_plain(const char *name, const RGWAccessKey& val, Formatter *f)
+{
+  f->open_object_section(name);
+  val.dump_plain(f);
+  f->close_section();
+}
+
 void RGWAccessKey::dump(Formatter *f, const string& user, bool swift) const
 {
   string u = user;
@@ -464,6 +477,7 @@ void RGWZoneParams::dump(Formatter *f) const
   encode_json("user_email_pool", user_email_pool.data_pool, f);
   encode_json("user_swift_pool", user_swift_pool.data_pool, f);
   encode_json("user_uid_pool ", user_uid_pool.data_pool, f);
+  encode_json_plain("system_key", system_key, f);
 }
 
 static void decode_json(const char *field, rgw_bucket& bucket, JSONObj *obj)
@@ -488,6 +502,7 @@ void RGWZoneParams::decode_json(JSONObj *obj)
   ::decode_json("user_email_pool", user_email_pool, obj);
   ::decode_json("user_swift_pool", user_swift_pool, obj);
   ::decode_json("user_uid_pool ", user_uid_pool, obj);
+  JSONDecoder::decode_json("system_key", system_key, obj);
 }
 
 void RGWZone::dump(Formatter *f) const
index f487a98b7d52228932a62f85db441e89b36f469a..d4733aef8422bbbb5d75ba8e93fe362c94f736f7 100644 (file)
@@ -268,6 +268,8 @@ struct RGWZoneParams {
 
   string name;
 
+  RGWAccessKey system_key;
+
   static string get_pool_name(CephContext *cct);
   void init_name(CephContext *cct, RGWRegion& region);
   int init(CephContext *cct, RGWRados *store, RGWRegion& region);
@@ -275,7 +277,7 @@ struct RGWZoneParams {
   int store_info(CephContext *cct, RGWRados *store, RGWRegion& region);
 
   void encode(bufferlist& bl) const {
-    ENCODE_START(2, 1, bl);
+    ENCODE_START(3, 1, bl);
     ::encode(domain_root, bl);
     ::encode(control_pool, bl);
     ::encode(gc_pool, bl);
@@ -291,7 +293,7 @@ struct RGWZoneParams {
   }
 
   void decode(bufferlist::iterator& bl) {
-     DECODE_START(2, bl);
+     DECODE_START(3, bl);
     ::decode(domain_root, bl);
     ::decode(control_pool, bl);
     ::decode(gc_pool, bl);
@@ -304,6 +306,8 @@ struct RGWZoneParams {
     ::decode(user_uid_pool, bl);
     if (struct_v >= 2)
       ::decode(name, bl);
+    if (struct_v >= 3)
+      ::decode(system_key, bl);
     DECODE_FINISH(bl);
   }
   void dump(Formatter *f) const;