return 0;
case OPT_ROLE_CREATE:
{
- if (role_name.empty() || assume_role_doc.empty()) {
- cerr << "ERROR: one of role name or assume role policy document is empty" << std::endl;
+ string uid;
+ user_id.to_str(uid);
+ if (role_name.empty() || assume_role_doc.empty() || uid.empty()) {
+ cerr << "ERROR: one of role name or assume role policy document or uid is empty" << std::endl;
return -EINVAL;
}
/* The following two calls will be replaced by read_decode_json or something
return -EINVAL;
}
string trust_policy = bl.to_str();
- RGWRole role(g_ceph_context, store, role_name, path, trust_policy);
+ RGWRole role(g_ceph_context, store, role_name, path, trust_policy, uid);
ret = role.create(true);
if (ret < 0) {
return -ret;
if (op_ret < 0) {
return;
}
- RGWRole role(s->cct, store, role_name, role_path, trust_policy);
+ string uid;
+ s->user->user_id.to_str(uid);
+ RGWRole role(s->cct, store, role_name, role_path, trust_policy, uid);
op_ret = role.create(true);
if (op_ret == -EEXIST) {
const string RGWRole::role_name_oid_prefix = "role_names.";
const string RGWRole::role_oid_prefix = "roles.";
const string RGWRole::role_path_oid_prefix = "role_paths.";
+const string RGWRole::role_arn_prefix = "arn:aws:iam::";
int RGWRole::store_info(bool exclusive)
{
id = uuid_str;
//arn
- arn = "arn:aws:iam::role" + path + name;
+ arn = role_arn_prefix + uid + ":role" + path + name;
// Creation time
real_clock::time_point t = real_clock::now();
static const string role_name_oid_prefix;
static const string role_oid_prefix;
static const string role_path_oid_prefix;
+ static const string role_arn_prefix;
CephContext *cct;
RGWRados *store;
string creation_date;
string trust_policy;
map<string, string> perm_policy_map;
+ string uid;
int store_info(bool exclusive);
int store_name(bool exclusive);
RGWRados *store,
string name,
string path,
- string trust_policy)
+ string trust_policy,
+ string uid)
: cct(cct),
store(store),
name(std::move(name)),
path(std::move(path)),
- trust_policy(std::move(trust_policy)) {
+ trust_policy(std::move(trust_policy)),
+ uid(std::move(uid)) {
if (this->path.empty())
this->path = "/";
}