const string RGWRole::role_path_oid_prefix = "role_paths.";
const string RGWRole::role_arn_prefix = "arn:aws:iam::";
-int RGWRole::store_info(bool exclusive)
+int RGWRole::store_info(bool exclusive, optional_yield y)
{
using ceph::encode;
string oid = get_info_oid_prefix() + id;
auto obj_ctx = ctl->svc->sysobj->init_obj_ctx();
return rgw_put_system_obj(obj_ctx, svc->zone->get_zone_params().roles_pool, oid,
- bl, exclusive, NULL, real_time(), NULL);
+ bl, exclusive, NULL, real_time(), y, NULL);
}
-int RGWRole::store_name(bool exclusive)
+int RGWRole::store_name(bool exclusive, optional_yield y)
{
RGWNameToId nameToId;
nameToId.obj_id = id;
auto obj_ctx = svc->sysobj->init_obj_ctx();
return rgw_put_system_obj(obj_ctx, svc->zone->get_zone_params().roles_pool, oid,
- bl, exclusive, NULL, real_time(), NULL);
+ bl, exclusive, NULL, real_time(), y, NULL);
}
-int RGWRole::store_path(bool exclusive)
+int RGWRole::store_path(bool exclusive, optional_yield y)
{
string oid = tenant + get_path_oid_prefix() + path + get_info_oid_prefix() + id;
bufferlist bl;
auto obj_ctx = svc->sysobj->init_obj_ctx();
return rgw_put_system_obj(obj_ctx, svc->zone->get_zone_params().roles_pool, oid,
- bl, exclusive, NULL, real_time(), NULL);
+ bl, exclusive, NULL, real_time(), y, NULL);
}
-int RGWRole::create(bool exclusive)
+int RGWRole::create(bool exclusive, optional_yield y)
{
int ret;
}
/* check to see the name is not used */
- ret = read_id(name, tenant, id);
+ ret = read_id(name, tenant, id, y);
if (exclusive && ret == 0) {
ldout(cct, 0) << "ERROR: name " << name << " already in use for role id "
<< id << dendl;
auto svc = ctl->svc;
auto& pool = svc->zone->get_zone_params().roles_pool;
- ret = store_info(exclusive);
+ ret = store_info(exclusive, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: storing role info in pool: " << pool.name << ": "
<< id << ": " << cpp_strerror(-ret) << dendl;
return ret;
}
- ret = store_name(exclusive);
+ ret = store_name(exclusive, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: storing role name in pool: " << pool.name << ": "
<< name << ": " << cpp_strerror(-ret) << dendl;
//Delete the role info that was stored in the previous call
string oid = get_info_oid_prefix() + id;
- int info_ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL);
+ int info_ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL, y);
if (info_ret < 0) {
ldout(cct, 0) << "ERROR: cleanup of role id from pool: " << pool.name << ": "
<< id << ": " << cpp_strerror(-info_ret) << dendl;
return ret;
}
- ret = store_path(exclusive);
+ ret = store_path(exclusive, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: storing role path in pool: " << pool.name << ": "
<< path << ": " << cpp_strerror(-ret) << dendl;
//Delete the role info that was stored in the previous call
string oid = get_info_oid_prefix() + id;
- int info_ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL);
+ int info_ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL, y);
if (info_ret < 0) {
ldout(cct, 0) << "ERROR: cleanup of role id from pool: " << pool.name << ": "
<< id << ": " << cpp_strerror(-info_ret) << dendl;
}
//Delete role name that was stored in previous call
oid = tenant + get_names_oid_prefix() + name;
- int name_ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL);
+ int name_ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL, y);
if (name_ret < 0) {
ldout(cct, 0) << "ERROR: cleanup of role name from pool: " << pool.name << ": "
<< name << ": " << cpp_strerror(-name_ret) << dendl;
return 0;
}
-int RGWRole::delete_obj()
+int RGWRole::delete_obj(optional_yield y)
{
auto svc = ctl->svc;
auto& pool = svc->zone->get_zone_params().roles_pool;
- int ret = read_name();
+ int ret = read_name(y);
if (ret < 0) {
return ret;
}
- ret = read_info();
+ ret = read_info(y);
if (ret < 0) {
return ret;
}
// Delete id
string oid = get_info_oid_prefix() + id;
- ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL);
+ ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: deleting role id from pool: " << pool.name << ": "
<< id << ": " << cpp_strerror(-ret) << dendl;
// Delete name
oid = tenant + get_names_oid_prefix() + name;
- ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL);
+ ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: deleting role name from pool: " << pool.name << ": "
<< name << ": " << cpp_strerror(-ret) << dendl;
// Delete path
oid = tenant + get_path_oid_prefix() + path + get_info_oid_prefix() + id;
- ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL);
+ ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: deleting role path from pool: " << pool.name << ": "
<< path << ": " << cpp_strerror(-ret) << dendl;
return ret;
}
-int RGWRole::get()
+int RGWRole::get(optional_yield y)
{
- int ret = read_name();
+ int ret = read_name(y);
if (ret < 0) {
return ret;
}
- ret = read_info();
+ ret = read_info(y);
if (ret < 0) {
return ret;
}
return 0;
}
-int RGWRole::get_by_id()
+int RGWRole::get_by_id(optional_yield y)
{
- int ret = read_info();
+ int ret = read_info(y);
if (ret < 0) {
return ret;
}
return 0;
}
-int RGWRole::update()
+int RGWRole::update(optional_yield y)
{
auto& pool = ctl->svc->zone->get_zone_params().roles_pool;
- int ret = store_info(false);
+ int ret = store_info(false, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: storing info in pool: " << pool.name << ": "
<< id << ": " << cpp_strerror(-ret) << dendl;
JSONDecoder::decode_json("assume_role_policy_document", trust_policy, obj);
}
-int RGWRole::read_id(const string& role_name, const string& tenant, string& role_id)
+int RGWRole::read_id(const string& role_name, const string& tenant, string& role_id, optional_yield y)
{
auto svc = ctl->svc;
auto& pool = svc->zone->get_zone_params().roles_pool;
bufferlist bl;
auto obj_ctx = svc->sysobj->init_obj_ctx();
- int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, NULL, NULL, null_yield);
+ int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, NULL, NULL, y);
if (ret < 0) {
return ret;
}
return 0;
}
-int RGWRole::read_info()
+int RGWRole::read_info(optional_yield y)
{
auto svc = ctl->svc;
auto& pool = svc->zone->get_zone_params().roles_pool;
bufferlist bl;
auto obj_ctx = svc->sysobj->init_obj_ctx();
- int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, NULL, NULL, null_yield);
+ int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, NULL, NULL, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: failed reading role info from pool: " << pool.name <<
": " << id << ": " << cpp_strerror(-ret) << dendl;
return 0;
}
-int RGWRole::read_name()
+int RGWRole::read_name(optional_yield y)
{
auto svc = ctl->svc;
auto& pool = svc->zone->get_zone_params().roles_pool;
bufferlist bl;
auto obj_ctx = svc->sysobj->init_obj_ctx();
- int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, NULL, NULL, null_yield);
+ int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, NULL, NULL, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: failed reading role name from pool: " << pool.name << ": "
<< name << ": " << cpp_strerror(-ret) << dendl;
CephContext *cct,
const string& path_prefix,
const string& tenant,
- vector<RGWRole>& roles)
+ vector<RGWRole>& roles,
+ optional_yield y)
{
auto pool = store->svc.zone->get_zone_params().roles_pool;
string prefix;
RGWRole role(cct, store->pctl);
role.set_id(id);
- int ret = role.read_info();
+ int ret = role.read_info(y);
if (ret < 0) {
return ret;
}