RGW_OP_METADATA_SEARCH,
RGW_OP_CONFIG_BUCKET_META_SEARCH,
RGW_OP_GET_BUCKET_META_SEARCH,
+ RGW_OP_DEL_BUCKET_META_SEARCH,
};
class RGWAccessControlPolicy;
rgw_bucket_object_pre_exec(s);
}
+int RGWDelBucketMetaSearch::verify_permission()
+{
+ if (!s->auth.identity->is_owner_of(s->bucket_owner.get_id())) {
+ return -EACCES;
+ }
+
+ return 0;
+}
+
+void RGWDelBucketMetaSearch::pre_exec()
+{
+ rgw_bucket_object_pre_exec(s);
+}
+
+void RGWDelBucketMetaSearch::execute()
+{
+ s->bucket_info.mdsearch_config.clear();
+
+ op_ret = store->put_bucket_instance_info(s->bucket_info, false, real_time(), &s->bucket_attrs);
+ if (op_ret < 0) {
+ ldout(s->cct, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket.name << " returned err=" << op_ret << dendl;
+ return;
+ }
+}
+
RGWHandler::~RGWHandler()
{
virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
};
+class RGWDelBucketMetaSearch : public RGWOp {
+public:
+ RGWDelBucketMetaSearch() {}
+
+ int verify_permission();
+ void pre_exec();
+ void execute();
+
+ virtual void send_response() = 0;
+ virtual const string name() { return "delete_bucket_meta_search"; }
+ virtual RGWOpType delete_type() { return RGW_OP_DEL_BUCKET_META_SEARCH; }
+ virtual uint32_t op_mask() { return RGW_OP_TYPE_WRITE; }
+};
+
#endif /* CEPH_RGW_OP_H */
Formatter *f = s->formatter;
f->open_array_section("GetBucketMetaSearchResult");
- f->open_object_section("Entry");
for (auto& e : s->bucket_info.mdsearch_config) {
+ f->open_object_section("Entry");
string k = string("x-amz-meta-") + e.first;
f->dump_string("Key", k.c_str());
const char *type;
type = "str";
}
f->dump_string("Type", type);
+ f->close_section();
}
f->close_section();
- f->close_section();
rgw_flush_formatter(s, f);
}
+void RGWDelBucketMetaSearch_ObjStore_S3::send_response()
+{
+ if (op_ret)
+ set_req_state_err(s, op_ret);
+ dump_errno(s);
+ end_header(s, this);
+}
+
RGWOp *RGWHandler_REST_Service_S3::op_get()
{
return new RGWDeleteBucketWebsite_ObjStore_S3;
}
+ if (s->info.args.exists("mdsearch")) {
+ return new RGWDelBucketMetaSearch_ObjStore_S3;
+ }
+
return new RGWDeleteBucket_ObjStore_S3;
}
void send_response() override;
};
+class RGWDelBucketMetaSearch_ObjStore_S3 : public RGWDelBucketMetaSearch {
+public:
+ RGWDelBucketMetaSearch_ObjStore_S3() {}
+ ~RGWDelBucketMetaSearch_ObjStore_S3() {}
+
+ void send_response() override;
+};
+
class RGW_Auth_S3 {
private:
static int authorize_v2(RGWRados *store,