(name.compare("versionId") == 0) ||
(name.compare("versions") == 0) ||
(name.compare("versioning") == 0) ||
+ (name.compare("requestPayment") == 0) ||
(name.compare("torrent") == 0)) {
sub_resources[name] = val;
} else if (name[0] == 'r') { // root of all evil
// Represents the shard number for blind bucket.
const static uint32_t NUM_SHARDS_BLIND_BUCKET;
+ bool requester_pays;
+
void encode(bufferlist& bl) const {
- ENCODE_START(11, 4, bl);
+ ENCODE_START(12, 4, bl);
::encode(bucket, bl);
::encode(owner, bl);
::encode(flags, bl);
::encode(quota, bl);
::encode(num_shards, bl);
::encode(bucket_index_shard_hash_type, bl);
+ ::encode(requester_pays, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& bl) {
::decode(num_shards, bl);
if (struct_v >= 11)
::decode(bucket_index_shard_hash_type, bl);
+ if (struct_v >= 12)
+ ::decode(requester_pays, bl);
DECODE_FINISH(bl);
}
void dump(Formatter *f) const;
int versioning_status() { return flags & (BUCKET_VERSIONED | BUCKET_VERSIONS_SUSPENDED); }
bool versioning_enabled() { return versioning_status() == BUCKET_VERSIONED; }
- RGWBucketInfo() : flags(0), creation_time(0), has_instance_obj(false), num_shards(0), bucket_index_shard_hash_type(MOD) {}
+ RGWBucketInfo() : flags(0), creation_time(0), has_instance_obj(false), num_shards(0), bucket_index_shard_hash_type(MOD), requester_pays(false) {}
};
WRITE_CLASS_ENCODER(RGWBucketInfo)
encode_json("quota", quota, f);
encode_json("num_shards", num_shards, f);
encode_json("bi_shard_hash_type", (uint32_t)bucket_index_shard_hash_type, f);
+ encode_json("requester_pays", requester_pays, f);
}
void RGWBucketInfo::decode_json(JSONObj *obj) {
uint32_t hash_type;
JSONDecoder::decode_json("bi_shard_hash_type", hash_type, obj);
bucket_index_shard_hash_type = (uint8_t)hash_type;
+ JSONDecoder::decode_json("requester_pays", requester_pays, obj);
}
void RGWObjEnt::dump(Formatter *f) const
return;
}
+int RGWGetRequestPayment::verify_permission()
+{
+ return 0;
+}
+
+void RGWGetRequestPayment::pre_exec()
+{
+ rgw_bucket_object_pre_exec(s);
+}
+
+void RGWGetRequestPayment::execute()
+{
+ requester_pays = s->bucket_info.requester_pays;
+}
+
int RGWInitMultipart::verify_permission()
{
if (!verify_bucket_permission(s, RGW_PERM_WRITE))
RGW_OP_PUT_CORS,
RGW_OP_DELETE_CORS,
RGW_OP_OPTIONS_CORS,
+ RGW_OP_GET_REQUEST_PAYMENT,
RGW_OP_INIT_MULTIPART,
RGW_OP_COMPLETE_MULTIPART,
RGW_OP_ABORT_MULTIPART,
virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
};
+class RGWGetRequestPayment : public RGWOp {
+protected:
+ bool requester_pays;
+
+public:
+ RGWGetRequestPayment() : requester_pays(0) {}
+
+ int verify_permission();
+ void pre_exec();
+ void execute();
+
+ virtual void send_response() = 0;
+ virtual const string name() { return "get_request_payment"; }
+ virtual RGWOpType get_type() { return RGW_OP_GET_REQUEST_PAYMENT; }
+ virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
+};
+
class RGWInitMultipart : public RGWOp {
protected:
int ret;
info.placement_rule = selected_placement_rule;
info.num_shards = bucket_index_max_shards;
info.bucket_index_shard_hash_type = RGWBucketInfo::MOD;
+ info.requester_pays = false;
if (!creation_time)
time(&info.creation_time);
else
end_header(s, NULL);
}
+void RGWGetRequestPayment_ObjStore_S3::send_response()
+{
+ dump_errno(s);
+ end_header(s, this, "application/xml");
+ dump_start(s);
+
+ s->formatter->open_object_section_in_ns("RequestPaymentConfiguration",
+ "http://s3.amazonaws.com/doc/2006-03-01/");
+ const char *payer = requester_pays ? "Requester" : "BucketOwner";
+ s->formatter->dump_string("Payer", payer);
+ s->formatter->close_section();
+ rgw_flush_formatter_and_reset(s, s->formatter);
+}
+
int RGWInitMultipart_ObjStore_S3::get_params()
{
RGWAccessControlPolicy_S3 s3policy(s->cct);
return new RGWGetACLs_ObjStore_S3;
} else if (is_cors_op()) {
return new RGWGetCORS_ObjStore_S3;
+ } else if (is_request_payment_op()) {
+ return new RGWGetRequestPayment_ObjStore_S3;
} else if (s->info.args.exists("uploads")) {
return new RGWListBucketMultiparts_ObjStore_S3;
}
void send_response();
};
+class RGWGetRequestPayment_ObjStore_S3 : public RGWGetRequestPayment {
+public:
+ RGWGetRequestPayment_ObjStore_S3() {}
+ ~RGWGetRequestPayment_ObjStore_S3() {}
+
+ void send_response();
+};
+
class RGWInitMultipart_ObjStore_S3 : public RGWInitMultipart_ObjStore {
public:
RGWInitMultipart_ObjStore_S3() {}
bool is_obj_update_op() {
return is_acl_op() || is_cors_op();
}
+ bool is_request_payment_op() {
+ return s->info.args.exists("requestPayment");
+ }
RGWOp *get_obj_op(bool get_data);
RGWOp *op_get();