swift_resource->register_resource("healthcheck",
set_logging(new RGWRESTMgr_SWIFT_HealthCheck));
- RGWRESTMgr* const swift_info_resource = new RGWRESTMgr_SWIFT_Info;
- rest.register_resource("info", set_logging(swift_info_resource));
+ swift_resource->register_resource("info",
+ set_logging(new RGWRESTMgr_SWIFT_Info));
if (! swift_at_root) {
rest.register_resource(g_conf->rgw_swift_url_prefix,
return NULL;
}
-RGWOp* RGWHandler_REST_SWIFT_Info::op_get() {
-
- return new RGWInfo_ObjStore_SWIFT;
-}
-
RGWOp *RGWHandler_REST_Bucket_SWIFT::get_obj_op(bool get_data)
{
if (is_acl_op()) {
g_conf->rgw_swift_url_prefix.c_str(), tenant_path.c_str());
}
- string uri = "/info";
- if ((s->decoded_uri[0] != '/' ||
- s->decoded_uri.compare(0, blen, buf) != 0) &&
- s->decoded_uri.compare(uri) != 0) {
- return -ENOENT;
- }
-
- int ret;
- //Set the formatter to JSON by default for /info api
- if (s->decoded_uri.compare(uri) == 0) {
- ret = allocate_formatter(s, RGW_FORMAT_JSON, false);
- }
- else {
- ret = allocate_formatter(s, RGW_FORMAT_PLAIN, true);
+ if (s->decoded_uri[0] != '/' ||
+ s->decoded_uri.compare(0, blen, buf) != 0) {
+ return -ENOENT;
}
+ int ret = allocate_formatter(s, RGW_FORMAT_PLAIN, true);
if (ret < 0)
return ret;
RGWHandler_REST* RGWRESTMgr_SWIFT_Info::get_handler(struct req_state *s)
{
- int ret = RGWHandler_REST_SWIFT::init_from_header(s);
- if (ret < 0) {
- return nullptr;
- }
-
+ s->prot_flags |= RGW_REST_SWIFT;
return new RGWHandler_REST_SWIFT_Info;
}
virtual ~RGWHandler_REST_Service_SWIFT() {}
};
-class RGWHandler_REST_SWIFT_Info : public RGWHandler_REST_SWIFT {
-protected:
- RGWOp *op_get();
-public:
- RGWHandler_REST_SWIFT_Info() = default;
- virtual ~RGWHandler_REST_SWIFT_Info() = default;
-};
-
class RGWHandler_REST_Bucket_SWIFT : public RGWHandler_REST_SWIFT {
protected:
bool is_obj_update_op() {
};
+class RGWHandler_REST_SWIFT_Info : public RGWHandler_REST_SWIFT {
+public:
+ RGWHandler_REST_SWIFT_Info() = default;
+ ~RGWHandler_REST_SWIFT_Info() = default;
+
+ RGWOp *op_get() override {
+ return new RGWInfo_ObjStore_SWIFT();
+ }
+
+ int init(RGWRados* const store,
+ struct req_state* const state,
+ RGWClientIO* const cio) override {
+ state->dialect = "swift";
+ state->formatter = new JSONFormatter;
+ state->format = RGW_FORMAT_JSON;
+
+ return RGWHandler::init(store, state, cio);
+ }
+
+ int authorize() override {
+ return 0;
+ }
+
+ int postauth_init() override {
+ return 0;
+ }
+
+ int read_permissions(RGWOp *) override {
+ return 0;
+ }
+};
+
class RGWRESTMgr_SWIFT_Info : public RGWRESTMgr {
public:
RGWRESTMgr_SWIFT_Info() = default;