summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCasey Bodley <cbodley@redhat.com>2015-09-08 17:41:26 +0200
committerYehuda Sadeh <yehuda@redhat.com>2016-02-12 01:12:43 +0100
commitdfadc9f705f413bf9fef75cb4168193bb5c6f4c2 (patch)
tree9425cf2c6ae54deae4007a0d8d578bf6cc86b337
parentrgw: fixes for RGWZoneGroupMap::decode_json (diff)
downloadceph-dfadc9f705f413bf9fef75cb4168193bb5c6f4c2.tar.xz
ceph-dfadc9f705f413bf9fef75cb4168193bb5c6f4c2.zip
rgw: add handler for /admin/realm/period
the handler returns the existing RGWOp_Period_Get/Post ops from rgw_rest_config.h Signed-off-by: Casey Bodley <cbodley@redhat.com>
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/rgw/Makefile.am1
-rw-r--r--src/rgw/rgw_main.cc2
-rw-r--r--src/rgw/rgw_rest_realm.cc25
-rw-r--r--src/rgw/rgw_rest_realm.h14
5 files changed, 43 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index dfedb108eb5..cee8483dcf3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1188,6 +1188,7 @@ if(${WITH_RADOSGW})
rgw/rgw_rest_opstate.cc
rgw/rgw_rest_replica_log.cc
rgw/rgw_rest_config.cc
+ rgw/rgw_rest_realm.cc
rgw/rgw_http_client.cc
rgw/rgw_swift.cc
rgw/rgw_swift_auth.cc
diff --git a/src/rgw/Makefile.am b/src/rgw/Makefile.am
index d7bad91f1f9..72441cb790c 100644
--- a/src/rgw/Makefile.am
+++ b/src/rgw/Makefile.am
@@ -107,6 +107,7 @@ radosgw_SOURCES = \
rgw/rgw_rest_opstate.cc \
rgw/rgw_rest_replica_log.cc \
rgw/rgw_rest_config.cc \
+ rgw/rgw_rest_realm.cc \
rgw/rgw_http_client.cc \
rgw/rgw_swift.cc \
rgw/rgw_swift_auth.cc \
diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc
index 20d40e2799c..df3af8a8c25 100644
--- a/src/rgw/rgw_main.cc
+++ b/src/rgw/rgw_main.cc
@@ -52,6 +52,7 @@
#include "rgw_replica_log.h"
#include "rgw_rest_replica_log.h"
#include "rgw_rest_config.h"
+#include "rgw_rest_realm.h"
#include "rgw_swift_auth.h"
#include "rgw_swift.h"
#include "rgw_log.h"
@@ -1178,6 +1179,7 @@ int main(int argc, const char **argv)
admin_resource->register_resource("opstate", new RGWRESTMgr_Opstate);
admin_resource->register_resource("replica_log", new RGWRESTMgr_ReplicaLog);
admin_resource->register_resource("config", new RGWRESTMgr_Config);
+ admin_resource->register_resource("realm", new RGWRESTMgr_Realm);
rest.register_resource(g_conf->rgw_admin_entry, admin_resource);
}
diff --git a/src/rgw/rgw_rest_realm.cc b/src/rgw/rgw_rest_realm.cc
new file mode 100644
index 00000000000..50b5ce2dd6b
--- /dev/null
+++ b/src/rgw/rgw_rest_realm.cc
@@ -0,0 +1,25 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "rgw_rest_realm.h"
+#include "rgw_rest_s3.h"
+#include "rgw_rest_config.h"
+
+#define dout_subsys ceph_subsys_rgw
+
+class RGWHandler_Period : public RGWHandler_Auth_S3 {
+protected:
+ RGWOp *op_get() { return new RGWOp_Period_Get; }
+ RGWOp *op_post() { return new RGWOp_Period_Post; }
+};
+
+class RGWRESTMgr_Period : public RGWRESTMgr {
+public:
+ RGWHandler *get_handler(struct req_state *s) { return new RGWHandler_Period; }
+};
+
+RGWRESTMgr_Realm::RGWRESTMgr_Realm()
+{
+ // add the /admin/realm/period resource
+ register_resource("period", new RGWRESTMgr_Period);
+}
diff --git a/src/rgw/rgw_rest_realm.h b/src/rgw/rgw_rest_realm.h
new file mode 100644
index 00000000000..c6c1ae0517c
--- /dev/null
+++ b/src/rgw/rgw_rest_realm.h
@@ -0,0 +1,14 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#ifndef CEPH_RGW_REST_REALM_H
+#define CEPH_RGW_REST_REALM_H
+
+#include "rgw_rest.h"
+
+class RGWRESTMgr_Realm : public RGWRESTMgr {
+public:
+ RGWRESTMgr_Realm();
+};
+
+#endif