std::string id;
std::string key;
- std::pair<std::string, RGWAccessKey> key_pair;
RGWAccessKey new_key;
std::unique_ptr<rgw::sal::User> duplicate_check;
new_key.id = id;
new_key.key = key;
- key_pair.first = id;
- key_pair.second = new_key;
+ if (op_state.create_date) {
+ new_key.create_date = *op_state.create_date;
+ } else {
+ new_key.create_date = ceph::real_clock::now();
+ }
if (key_type == KEY_TYPE_S3) {
- access_keys->insert(key_pair);
+ access_keys->emplace(id, new_key);
} else if (key_type == KEY_TYPE_SWIFT) {
- swift_keys->insert(key_pair);
+ swift_keys->emplace(id, new_key);
}
return 0;
if (op_state.access_key_active) {
modify_key.active = *op_state.access_key_active;
}
+ if (op_state.create_date) {
+ modify_key.create_date = *op_state.create_date;
+ }
if (key_type == KEY_TYPE_S3) {
(*access_keys)[id] = modify_key;
std::string key; // SecretKey
std::string subuser;
bool active = true;
+ ceph::real_time create_date;
RGWAccessKey() {}
RGWAccessKey(std::string _id, std::string _key)
: id(std::move(_id)), key(std::move(_key)) {}
void encode(bufferlist& bl) const {
- ENCODE_START(3, 2, bl);
+ ENCODE_START(4, 2, bl);
encode(id, bl);
encode(key, bl);
encode(subuser, bl);
encode(active, bl);
+ encode(create_date, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::const_iterator& bl) {
- DECODE_START_LEGACY_COMPAT_LEN_32(3, 2, 2, bl);
+ DECODE_START_LEGACY_COMPAT_LEN_32(4, 2, 2, bl);
decode(id, bl);
decode(key, bl);
decode(subuser, bl);
if (struct_v >= 3) {
decode(active, bl);
}
+ if (struct_v >= 4) {
+ decode(create_date, bl);
+ }
DECODE_FINISH(bl);
}
void dump(Formatter *f) const;
encode_json("secret_key", key, f);
encode_json("subuser", subuser, f);
encode_json("active", active, f);
+ encode_json("create_date", create_date, f);
}
void RGWAccessKey::dump_plain(Formatter *f) const
}
encode_json("secret_key", key, f);
encode_json("active", active, f);
+ encode_json("create_date", create_date, f);
}
void RGWAccessKey::decode_json(JSONObj *obj) {
}
}
JSONDecoder::decode_json("active", active, obj);
+ JSONDecoder::decode_json("create_date", create_date, obj);
}
void RGWAccessKey::decode_json(JSONObj *obj, bool swift) {
}
JSONDecoder::decode_json("secret_key", key, obj, true);
JSONDecoder::decode_json("active", active, obj);
+ JSONDecoder::decode_json("create_date", create_date, obj);
}