]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: extend interfaces to allow sending data
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 21 Mar 2017 22:02:32 +0000 (15:02 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 30 May 2017 20:24:41 +0000 (13:24 -0700)
when retrieving REST resource

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rest_conn.cc
src/rgw/rgw_rest_conn.h

index c8d0682a0a42404fabae486b8270dd761d37d9b8..6496f129d792ffecbe0069cbf02c80c6628ce89b 100644 (file)
@@ -225,6 +225,7 @@ int RGWRESTConn::get_resource(const string& resource,
                     param_vec_t *extra_params,
                     map<string, string> *extra_headers,
                     bufferlist& bl,
+                     bufferlist *send_data,
                     RGWHTTPManager *mgr)
 {
   string url;
@@ -249,7 +250,7 @@ int RGWRESTConn::get_resource(const string& resource,
     headers.insert(extra_headers->begin(), extra_headers->end());
   }
 
-  ret = req.send_request(&key, headers, resource, nullptr, mgr);
+  ret = req.send_request(&key, headers, resource, send_data, mgr);
   if (ret < 0) {
     ldout(cct, 5) << __func__ << ": send_request() resource=" << resource << " returned ret=" << ret << dendl;
     return ret;
index bec829d6939b5e00c8e906a1f5f5f0208181d076..f4a1005b6a3d676c3f5451ff7b85de23924de827 100644 (file)
@@ -100,8 +100,12 @@ public:
   int get_resource(const string& resource,
                   param_vec_t *extra_params,
                    map<string, string>* extra_headers,
-                   bufferlist& bl, RGWHTTPManager *mgr = NULL);
+                   bufferlist& bl,
+                   bufferlist *send_data = nullptr,
+                   RGWHTTPManager *mgr = nullptr);
 
+  template <class T>
+  int get_json_resource(const string& resource, param_vec_t *params, bufferlist *in_data, T& t);
   template <class T>
   int get_json_resource(const string& resource, param_vec_t *params, T& t);
   template <class T>
@@ -110,10 +114,10 @@ public:
 
 
 template<class T>
-int RGWRESTConn::get_json_resource(const string& resource, param_vec_t *params, T& t)
+int RGWRESTConn::get_json_resource(const string& resource, param_vec_t *params, bufferlist *in_data, T& t)
 {
   bufferlist bl;
-  int ret = get_resource(resource, params, NULL, bl);
+  int ret = get_resource(resource, params, nullptr, bl, in_data);
   if (ret < 0) {
     return ret;
   }
@@ -126,6 +130,12 @@ int RGWRESTConn::get_json_resource(const string& resource, param_vec_t *params,
   return 0;
 }
 
+template<class T>
+int RGWRESTConn::get_json_resource(const string& resource, param_vec_t *params, T& t)
+{
+  return get_json_resource(resource, params, nullptr, t);
+}
+
 template<class T>
 int RGWRESTConn::get_json_resource(const string& resource,  const rgw_http_param_pair *pp, T& t)
 {