#include "services/svc_zone.h"
#include "services/svc_sys_obj.h"
+#include "rgw_zone.h"
#define dout_subsys ceph_subsys_rgw
std::string caps;
std::string tenant_name;
std::string op_mask_str;
+ std::string default_placement_str;
+ std::string placement_tags_str;
bool gen_key;
bool suspended;
RESTArgs::get_bool(s, "system", false, &system);
RESTArgs::get_bool(s, "exclusive", false, &exclusive);
RESTArgs::get_string(s, "op-mask", op_mask_str, &op_mask_str);
+ RESTArgs::get_string(s, "default-placement", default_placement_str, &default_placement_str);
+ RESTArgs::get_string(s, "placement-tags", placement_tags_str, &placement_tags_str);
if (!s->user->system && system) {
ldout(s->cct, 0) << "cannot set system flag by non-system user" << dendl;
if (gen_key)
op_state.set_generate_key();
+ if (!default_placement_str.empty()) {
+ rgw_placement_rule target_rule;
+ target_rule.from_str(default_placement_str);
+ if (!store->svc()->zone->get_zone_params().valid_placement(target_rule)) {
+ ldout(s->cct, 0) << "NOTICE: invalid dest placement: " << target_rule.to_str() << dendl;
+ http_ret = -EINVAL;
+ return;
+ }
+ op_state.set_default_placement(target_rule);
+ }
+
+ if (!placement_tags_str.empty()) {
+ list<string> placement_tags_list;
+ get_str_list(placement_tags_str, ",", placement_tags_list);
+ op_state.set_placement_tags(placement_tags_list);
+ }
+
if (!store->svc()->zone->is_meta_master()) {
bufferlist data;
op_ret = forward_request_to_master(s, nullptr, store, data, nullptr);
std::string key_type_str;
std::string caps;
std::string op_mask_str;
+ std::string default_placement_str;
+ std::string placement_tags_str;
bool gen_key;
bool suspended;
RESTArgs::get_bool(s, "system", false, &system);
RESTArgs::get_string(s, "op-mask", op_mask_str, &op_mask_str);
+ RESTArgs::get_string(s, "default-placement", default_placement_str, &default_placement_str);
+ RESTArgs::get_string(s, "placement-tags", placement_tags_str, &placement_tags_str);
if (!s->user->system && system) {
ldout(s->cct, 0) << "cannot set system flag by non-system user" << dendl;
}
op_state.set_op_mask(op_mask);
}
+
+ if (!default_placement_str.empty()) {
+ rgw_placement_rule target_rule;
+ target_rule.from_str(default_placement_str);
+ if (!store->svc()->zone->get_zone_params().valid_placement(target_rule)) {
+ ldout(s->cct, 0) << "NOTICE: invalid dest placement: " << target_rule.to_str() << dendl;
+ http_ret = -EINVAL;
+ return;
+ }
+ op_state.set_default_placement(target_rule);
+ }
+
+ if (!placement_tags_str.empty()) {
+ list<string> placement_tags_list;
+ get_str_list(placement_tags_str, ",", placement_tags_list);
+ op_state.set_placement_tags(placement_tags_list);
+ }
if (!store->svc()->zone->is_meta_master()) {
bufferlist data;
rgw_apply_default_user_quota(user_info.user_quota, cct->_conf);
}
+ if (op_state.default_placement_specified) {
+ user_info.default_placement = op_state.default_placement;
+ }
+
+ if (op_state.placement_tags_specified) {
+ user_info.placement_tags = op_state.placement_tags;
+ }
+
// update the request
op_state.set_user_info(user_info);
op_state.set_populated();
if (op_state.mfa_ids_specified) {
user_info.mfa_ids = op_state.mfa_ids;
}
+
+ if (op_state.default_placement_specified) {
+ user_info.default_placement = op_state.default_placement;
+ }
+
+ if (op_state.placement_tags_specified) {
+ user_info.placement_tags = op_state.placement_tags;
+ }
+
op_state.set_user_info(user_info);
// if we're supposed to modify keys, do so
// req parameters for listing user
std::string marker;
uint32_t max_entries;
+ rgw_placement_rule default_placement; // user default placement
+ bool default_placement_specified;
+
+ list<string> placement_tags; // user default placement_tags
+ bool placement_tags_specified;
void set_access_key(const std::string& access_key) {
if (access_key.empty())
mfa_ids_specified = true;
}
+ void set_default_placement(const rgw_placement_rule& _placement) {
+ default_placement = _placement;
+ default_placement_specified = true;
+ }
+
+ void set_placement_tags(const list<string>& _tags) {
+ placement_tags = _tags;
+ placement_tags_specified = true;
+ }
+
bool is_populated() { return populated; }
bool is_initialized() { return initialized; }
bool has_existing_user() { return existing_user; }
found_by_email = false;
found_by_key = false;
mfa_ids_specified = false;
+ default_placement_specified = false;
+ placement_tags_specified = false;
max_entries = 1000;
marker = "";
}