}
meta.otp.reset(RGWOTPMetaHandlerAllocator::alloc());
+ meta.role = std::make_unique<RGWRoleMetadataHandler>(svc.role);
user.reset(new RGWUserCtl(svc.zone, svc.user, (RGWUserMetadataHandler *)meta.user.get()));
bucket.reset(new RGWBucketCtl(svc.zone,
meta.bucket = _ctl.meta.bucket.get();
meta.bucket_instance = _ctl.meta.bucket_instance.get();
meta.otp = _ctl.meta.otp.get();
+ meta.role = _ctl.meta.role.get();
user = _ctl.user.get();
bucket = _ctl.bucket.get();
otp = _ctl.otp.get();
+ role = _ctl.role.get();
r = meta.user->attach(meta.mgr);
if (r < 0) {
return r;
}
+ r = meta.role->attach(meta.mgr);
+ if (r < 0) {
+ ldout(cct, 0) << "ERROR: failed to start init otp ctl (" << cpp_strerror(-r) << dendl;
+ return r;
+ }
return 0;
}
#include "svc_role.h"
-const std::string role_name_oid_prefix = "role_names.";
-const std::string role_oid_prefix = "roles.";
-const std::string role_path_oid_prefix = "role_paths.";
-const std::string role_arn_prefix = "arn:aws:iam::";
-
std::string RGWSI_Role::get_role_meta_key(const std::string& role_id)
{
return role_oid_prefix + role_id;
#include "svc_role_rados.h"
#include "svc_meta_be_sobj.h"
+#include "svc_meta.h"
#include "rgw_role.h"
#include "rgw_zone.h"
+#include "svc_zone.h"
#define dout_subsys ceph_subsys_rgw
+class RGWSI_Role_Module : public RGWSI_MBSObj_Handler_Module {
+ RGWSI_Role_RADOS::Svc& svc;
+ std::string prefix;
+public:
+ RGWSI_Role_Module(RGWSI_Role_RADOS::Svc& _svc): RGWSI_MBSObj_Handler_Module("Role"),
+ svc(_svc) {}
+
+ void get_pool_and_oid(const std::string& key,
+ rgw_pool *pool,
+ std::string *oid) override
+ {
+ if (pool) {
+ *pool = svc.zone->get_zone_params().roles_pool;
+ }
+
+ if (oid) {
+ *oid = key;
+ }
+ }
+
+ bool is_valid_oid(const std::string& oid) override {
+ return !boost::algorithm::starts_with(oid, role_name_oid_prefix) ||
+ !boost::algorithm::starts_with(oid, role_path_oid_prefix);
+ }
+
+ std::string key_to_oid(const std::string& key) override {
+ return key;
+ }
+
+ std::string oid_to_key(const std::string& oid) override {
+ return oid;
+ }
+
+ const std::string& get_oid_prefix() {
+ return prefix;
+ }
+};
+
RGWSI_MetaBackend_Handler* RGWSI_Role_RADOS::get_be_handler()
{
return be_handler;
svc.sysobj = _sysobj_svc;
}
+int RGWSI_Role_RADOS::do_start(optional_yield y, const DoutPrefixProvider *dpp)
+{
+
+ int r = svc.meta->create_be_handler(RGWSI_MetaBackend::Type::MDBE_SOBJ,
+ &be_handler);
+ if (r < 0) {
+ ldout(ctx(), 0) << "ERROR: failed to create be_handler for Roles: r="
+ << r <<dendl;
+ return r;
+ }
+
+ auto module = new RGWSI_Role_Module(svc);
+ RGWSI_MetaBackend_Handler_SObj* bh= static_cast<RGWSI_MetaBackend_Handler_SObj *>(be_handler);
+ be_module.reset(module);
+ bh->set_module(module);
+ return 0;
+}
+
int RGWSI_Role_RADOS::store_info(RGWSI_MetaBackend::Context *ctx,
const rgw::sal::RGWRole& role,
RGWObjVersionTracker * const objv_tracker,
RGWSI_SysObj *_sysobj_svc);
RGWSI_MetaBackend_Handler * get_be_handler() override;
+ int do_start(optional_yield y, const DoutPrefixProvider *dpp) override;
int store_info(RGWSI_MetaBackend::Context *ctx,
const rgw::sal::RGWRole& role,