]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: usage REST api handles cateogories
authorYehuda Sadeh <yehuda@inktank.com>
Mon, 26 Nov 2012 22:56:18 +0000 (14:56 -0800)
committerYehuda Sadeh <yehuda@inktank.com>
Mon, 26 Nov 2012 23:55:00 +0000 (15:55 -0800)
Fixes: #3528
The usage REST api was missing the categories filter.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_rest_usage.cc

index 428744538e582b26460dd4bc5f3dbcd7320648ea..e087bcc512c2d1e111a2b89eca0f4dac0191fe7f 100644 (file)
@@ -2,6 +2,8 @@
 #include "rgw_usage.h"
 #include "rgw_rest_usage.h"
 
+#include "include/str_list.h"
+
 #define dout_subsys ceph_subsys_rgw
 
 class RGWOp_Usage_Get : public RGWRESTOp {
@@ -31,6 +33,18 @@ void RGWOp_Usage_Get::execute() {
   RESTArgs::get_bool(s, "show-entries", true, &show_entries);
   RESTArgs::get_bool(s, "show-summary", true, &show_summary);
 
+  string cat_str;
+  RESTArgs::get_string(s, "categories", cat_str, &cat_str);
+
+  if (!cat_str.empty()) {
+    list<string> cat_list;
+    list<string>::iterator iter;
+    get_str_list(cat_str, cat_list);
+    for (iter = cat_list.begin(); iter != cat_list.end(); ++iter) {
+      categories[*iter] = true;
+    }
+  }
+
   http_ret = RGWUsage::show(store, uid, start, end, show_entries, show_summary, &categories, flusher);
 }