Example #1
0
 def Get_Ceph_User_Info(self, ceph_user_id, auth_info=None, **kwargs):
     '''
     6
     '''
     usermgr = RGWUserManager(self.conn)
     d = {}
     d['user_id'] = ceph_user_id
     user_info = RGWUserInfo(**d)
     return usermgr.get(user_info)
Example #2
0
 def Get_Ceph_User_Key(self, ceph_user_id, auth_info=None, **kwargs):
     '''
     7
     '''
     usermgr = RGWUserManager(self.conn)
     d = {}
     d['user_id'] = ceph_user_id
     user_info = RGWUserInfo(**d)
     res = usermgr.get(user_info)
     keys = []
     for k in res.keys:
         temp = {}
         temp['access_key'] = k.access_key
         temp['secret_key'] = k.secret_key
         keys.append(temp)
     return keys
Example #3
0
class RadosGWAdminTest(TestCase):
    
    def setUp(self):
        self.conn = RGWAdminConnection(ACCESS_KEY, SECRET_KEY)
        self.usagemgr = RGWUsageManager(self.conn)
        self.usermgr = RGWUserManager(self.conn)
        self.bucketmgr = RGWBucketManager(self.conn)
        self.subusermgr = RGWSubuserManager(self.conn)
        
    def tearDown(self):
        pass
    
    def test_create_user(self, user_info):
        user = self.usermgr.create(user_info)
        print(user)

    def test_get_bucket(self,bucket_info):
        bucket = self.bucketmgr.get_info(bucket_info)
        print(bucket)

    def test_link_bucket(self,bucket_info):
        bucket = self.bucketmgr.link(bucket_info)
        print(bucket)

    def test_get_bucket_policy(self,bucket_info):
        bucket = self.bucketmgr.get_policy(bucket_info)
        print(bucket)

    def test_remove_bucket(self,bucket_info):
        bucket = self.bucketmgr.remove(bucket_info)
        print(bucket)

    def test_get_user(self,user_info):
        user = self.usermgr.get(user_info)
        print(user)

    def test_create_subuser(self,subuser_info):
        subuser = self.subusermgr.create_subuser(subuser_info)
        print(subuser)


    def test_remove_subuser(self,subuser_info):
        subuser = self.subusermgr.remove_subuser(subuser_info)
        print(subuser)

    def test_create_key(self,user_info):
        key = self.usermgr.create_key(user_info)
        print(key)

    def test_get_user_quota(self,uid):
        user = self.usermgr.get_user_quota(uid)
        print(user)
    
    def test_set_user_quota(self,quota_info):
        '''
        quota_info = {uid':ID, 'max_size_kb':SIZE, 'max_objects':SIZE, enabled':true}

        '''
        user = self.usermgr.set_user_quota(uid=quota_info['uid'], max_size_kb=quota_info['max_size_kb'],
                                           max_objects=None, enabled=quota_info['enabled'])
        print(user)