return 0;
}
+int RGWGetBucketLocation::verify_permission()
+{
+ if (s->user.user_id.compare(s->bucket_owner.get_id()) != 0)
+ return -EACCES;
+
+ return 0;
+}
+
int RGWCreateBucket::verify_permission()
{
if (!rgw_user_is_authenticated(s->user))
virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
};
+class RGWGetBucketLocation : public RGWOp {
+public:
+ RGWGetBucketLocation() {}
+ ~RGWGetBucketLocation() {}
+ int verify_permission();
+ void execute() {}
+
+ virtual void send_response() = 0;
+ virtual const string name() { return "get_bucket_location"; }
+ virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
+};
+
+
class RGWStatBucket : public RGWOp {
protected:
int ret;
rgw_flush_formatter_and_reset(s, s->formatter);
}
+void RGWGetBucketLocation_ObjStore_S3::send_response()
+{
+ dump_errno(s);
+ end_header(s, this);
+ dump_start(s);
+
+ string location_constraint(s->bucket_info.region);
+ if (s->bucket_info.region == "default")
+ location_constraint.clear();
+
+ s->formatter->dump_format_ns("LocationConstraint",
+ "http://doc.s3.amazonaws.com/doc/2006-03-01/",
+ "%s",location_constraint.c_str());
+
+ rgw_flush_formatter_and_reset(s, s->formatter);
+}
+
static void dump_bucket_metadata(struct req_state *s, RGWBucketEnt& bucket)
{
char buf[32];
{
if (s->info.args.sub_resource_exists("logging"))
return new RGWGetBucketLogging_ObjStore_S3;
+ else if (s->info.args.sub_resource_exists("location"))
+ return new RGWGetBucketLocation_ObjStore_S3;
if (is_acl_op()) {
return new RGWGetACLs_ObjStore_S3;
} else if (is_cors_op()) {
void send_response();
};
+class RGWGetBucketLocation_ObjStore_S3 : public RGWGetBucketLocation {
+public:
+ RGWGetBucketLocation_ObjStore_S3() {}
+ ~RGWGetBucketLocation_ObjStore_S3() {}
+
+ void send_response();
+};
+
class RGWStatBucket_ObjStore_S3 : public RGWStatBucket_ObjStore {
public:
RGWStatBucket_ObjStore_S3() {}