]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: get bucket logging stub
authorYehuda Sadeh <yehuda@inktank.com>
Wed, 26 Sep 2012 23:41:17 +0000 (16:41 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Mon, 8 Oct 2012 22:44:04 +0000 (15:44 -0700)
Trivial implementation that just returns that
bucket logging is not enabled.

Fixes: #3225
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_common.cc
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_rest_s3.h

index 77596ec00b61afa7ba986dc22195d8ba292089fe..5acf80f60d6b2aeab76d601b9e46781b0a09e10b 100644 (file)
@@ -377,6 +377,7 @@ int XMLArgs::parse()
 
       if ((name.compare("acl") == 0) ||
           (name.compare("location") == 0) ||
+          (name.compare("logging") == 0) ||
           (name.compare("delete") == 0) ||
           (name.compare("uploads") == 0) ||
           (name.compare("partNumber") == 0) ||
index 5ecd420cb8bec101e0b82509b0866eee54fa6d36..d289b2249c24f890724ae220fa66fd5245dd9ed4 100644 (file)
@@ -759,6 +759,14 @@ void RGWListBucket::execute()
                                !!(s->prot_flags & RGW_REST_SWIFT), no_ns, &is_truncated, NULL);
 }
 
+int RGWGetBucketLogging::verify_permission()
+{
+  if (s->user.user_id.compare(s->bucket_owner) != 0)
+    return -EACCES;
+
+  return 0;
+}
+
 int RGWCreateBucket::verify_permission()
 {
   if (!rgw_user_is_authenticated(s->user))
index 7b7a353110df9ec745e2771543e54015c2d6fccb..463765a7a230b78bb551506e99e9cfb18929670a 100644 (file)
@@ -185,6 +185,16 @@ public:
   virtual const char *name() { return "list_bucket"; }
 };
 
+class RGWGetBucketLogging : public RGWOp {
+public:
+  RGWGetBucketLogging() {}
+  int verify_permission();
+  void execute() {}
+
+  virtual void send_response() = 0;
+  virtual const char *name() { return "get_bucket_logging"; }
+};
+
 class RGWStatBucket : public RGWOp {
 protected:
   int ret;
index ad90a30d216405de6c831dabf9065d25a3a2f725..277cd9ac89f191808b8c7d890291c7586c3a50dc 100644 (file)
@@ -215,6 +215,18 @@ void RGWListBucket_ObjStore_S3::send_response()
   rgw_flush_formatter_and_reset(s, s->formatter);
 }
 
+void RGWGetBucketLogging_ObjStore_S3::send_response()
+{
+  dump_errno(s);
+  end_header(s, "application/xml");
+  dump_start(s);
+
+  s->formatter->open_object_section_in_ns("BucketLoggingStatus",
+                                         "http://doc.s3.amazonaws.com/doc/2006-03-01/");
+  s->formatter->close_section();
+  rgw_flush_formatter_and_reset(s, s->formatter);
+}
+
 static void dump_bucket_metadata(struct req_state *s, RGWBucketEnt& bucket)
 {
   char buf[32];
@@ -667,6 +679,8 @@ RGWOp *RGWHandler_ObjStore_Bucket_S3::get_obj_op(bool get_data)
 
 RGWOp *RGWHandler_ObjStore_Bucket_S3::op_get()
 {
+  if (s->args.sub_resource_exists("logging"))
+    return new RGWGetBucketLogging_ObjStore_S3;
   if (is_acl_op()) {
     return new RGWGetACLs_ObjStore_S3;
   } else if (s->args.exists("uploadId")) {
@@ -687,6 +701,8 @@ RGWOp *RGWHandler_ObjStore_Bucket_S3::op_head()
 
 RGWOp *RGWHandler_ObjStore_Bucket_S3::op_put()
 {
+  if (s->args.sub_resource_exists("logging"))
+    return NULL;
   if (is_acl_op()) {
     return new RGWPutACLs_ObjStore_S3;
   }
index e5625d257bc612bd41e0247834bdd4a2b87a1fb6..5bdec1b0e4f4dd1c7e61047981dcacf4a445aaa3 100644 (file)
@@ -39,6 +39,14 @@ public:
   void send_response();
 };
 
+class RGWGetBucketLogging_ObjStore_S3 : public RGWGetBucketLogging {
+public:
+  RGWGetBucketLogging_ObjStore_S3() {}
+  ~RGWGetBucketLogging_ObjStore_S3() {}
+
+  void send_response();
+};
+
 class RGWStatBucket_ObjStore_S3 : public RGWStatBucket_ObjStore {
 public:
   RGWStatBucket_ObjStore_S3() {}