"acls": [ { "type": <id | email | uri>,
"source_id": <source_id>,
"dest_id": <dest_id> } ... ],
+ "location_constraint": <location-constraint>,
"target_path": <target_path>,
"target_storage_class": <target-storage-class>,
"multipart_sync_threshold": {object_size},
"acls": [ { "type": <id | email | uri>,
"source_id": <source_id>,
"dest_id": <dest_id> } ... ],
+ "location_constraint": <location-constraint>,
"target_path": <target_path>,
"target_storage_class": <target-storage-class>,
"multipart_sync_threshold": {object_size},
For example: ``target_path = rgwx-archive-${zonegroup}/``
+* ``location_constraint`` (string)
+
+ Specifies the region where the target bucket will be created on the remote S3 endpoint. For AWS, this location needs to be specified only if the region is other than US East (us-east-1).
+
* ``target_storage_class`` (string)
A string that defines the target storage class to which the object transitions.
"access_key": "",
"secret": "",
"host_style": "path",
+ "location_constraint": "";
"target_storage_class": "",
"target_path": "",
"acl_mappings": [],
bufferlist out_bl;
int ret = 0;
pair<string, string> key(tier_ctx.storage_class, tier_ctx.target_bucket_name);
+ stringstream ss;
+ XMLFormatter formatter;
+ bufferlist bl;
+ std::string lconstraint;
+
+ struct CreateBucketReq {
+ std::optional<std::string> lconstraint;
+
+ explicit CreateBucketReq(std::optional<std::string> _lconstraint) : lconstraint(_lconstraint) {}
+
+ void dump_xml(Formatter *f) const {
+ if (lconstraint) {
+ encode_xml("LocationConstraint", lconstraint, f);
+ };
+ }
+ } req_enc(lconstraint);
+
struct CreateBucketResult {
std::string code;
} result;
ldpp_dout(tier_ctx.dpp, 30) << "Cloud_tier_ctx: creating bucket:" << tier_ctx.target_bucket_name << dendl;
- bufferlist bl;
string resource = tier_ctx.target_bucket_name;
+ if (!tier_ctx.location_constraint.empty()) {
+ req_enc.lconstraint = tier_ctx.location_constraint;
+ encode_xml("CreateBucketConfiguration", req_enc, &formatter);
+
+ formatter.flush(ss);
+ bl.append(ss.str());
+ }
+
ret = tier_ctx.conn.send_resource(tier_ctx.dpp, "PUT", resource, nullptr, nullptr,
out_bl, &bl, nullptr, null_yield);
/* Remote */
RGWRESTConn& conn;
+ std::string location_constraint;
std::string target_bucket_name;
std::string target_storage_class;
tier_ctx.storage_class = tier->get_storage_class();
tier_ctx.restore_storage_class = rtier->get_rt().restore_storage_class;
tier_ctx.tier_type = rtier->get_rt().tier_type;
+ tier_ctx.location_constraint = rtier->get_rt().t.s3.location_constraint;
ldpp_dout(dpp, 20) << "Restoring object(" << get_key() << ") from the cloud endpoint(" << endpoint << ")" << dendl;
tier_ctx.multipart_min_part_size = rtier->get_rt().t.s3.multipart_min_part_size;
tier_ctx.multipart_sync_threshold = rtier->get_rt().t.s3.multipart_sync_threshold;
tier_ctx.storage_class = tier->get_storage_class();
+ tier_ctx.location_constraint = rtier->get_rt().t.s3.location_constraint;
ldpp_dout(dpp, 0) << "Transitioning object(" << o.key << ") to the cloud endpoint(" << endpoint << ")" << dendl;
host_style = VirtualStyle;
}
}
+ if (config.exists("location_constraint")) {
+ location_constraint = config["location_constraint"];
+ }
if (config.exists("target_storage_class")) {
target_storage_class = config["target_storage_class"];
}
/* default */
host_style = PathStyle;
}
+ if (config.exists("location_constraint")) {
+ location_constraint.clear();
+ }
if (config.exists("target_storage_class")) {
target_storage_class.clear();
}
} else {
host_style = VirtualStyle;
}
+ JSONDecoder::decode_json("location_constraint", location_constraint, obj);
JSONDecoder::decode_json("target_storage_class", target_storage_class, obj);
JSONDecoder::decode_json("target_path", target_path, obj);
JSONDecoder::decode_json("acl_mappings", acl_mappings, obj);
encode_json("region", region, f);
string s = (host_style == PathStyle ? "path" : "virtual");
encode_json("host_style", s, f);
+ encode_json("location_constraint", location_constraint, f);
encode_json("target_storage_class", target_storage_class, f);
encode_json("target_path", target_path, f);
encode_json("acl_mappings", acl_mappings, f);
}
} // namespace rgw
-
std::string region;
HostStyle host_style{PathStyle};
std::string target_storage_class;
+ std::string location_constraint;
/* Should below be bucket/zone specific?? */
std::string target_path;
int clear_params(const JSONFormattable& config);
void encode(bufferlist& bl) const {
- ENCODE_START(1, 1, bl);
+ ENCODE_START(2, 1, bl);
encode(endpoint, bl);
encode(key, bl);
encode(region, bl);
encode(acl_mappings, bl);
encode(multipart_sync_threshold, bl);
encode(multipart_min_part_size, bl);
+ encode(location_constraint, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::const_iterator& bl) {
- DECODE_START(1, bl);
+ DECODE_START(2, bl);
decode(endpoint, bl);
decode(key, bl);
decode(region, bl);
decode(acl_mappings, bl);
decode(multipart_sync_threshold, bl);
decode(multipart_min_part_size, bl);
+
+ if (struct_v >= 2) {
+ decode(location_constraint, bl);
+ }
+
DECODE_FINISH(bl);
}
void dump(Formatter *f) const;