def list_group_roles_on_project(self, project_id, group_id): """list roles of a user on a project.""" resp, body = self.get('projects/%s/groups/%s/roles' % (project_id, group_id)) self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['roles'])
def list_group_roles_on_domain(self, domain_id, group_id): """list roles of a user on a domain.""" resp, body = self.get('domains/%s/groups/%s/roles' % (domain_id, group_id)) self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['roles'])
def list_extensions(self): """List all the extensions.""" resp, body = self.get('/extensions') self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['extensions']['values'])
def list_projects(self, params=None): url = "projects" if params: url += '?%s' % parse.urlencode(params) resp, body = self.get(url) self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['projects'])
def get_users(self, params=None): """Get the list of users.""" url = 'users' if params: url += '?%s' % parse.urlencode(params) resp, body = self.get(url) self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['users'])
def list_regions(self, params=None): """List regions.""" url = 'regions' if params: url += '?%s' % parse.urlencode(params) resp, body = self.get(url) self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['regions'])
def get_trusts(self, trustor_user_id=None, trustee_user_id=None): """GET trusts.""" if trustor_user_id: resp, body = self.get("OS-TRUST/trusts?trustor_user_id=%s" % trustor_user_id) elif trustee_user_id: resp, body = self.get("OS-TRUST/trusts?trustee_user_id=%s" % trustee_user_id) else: resp, body = self.get("OS-TRUST/trusts") self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['trusts'])
def list_user_groups(self, user_id): """Lists groups which a user belongs to.""" resp, body = self.get('users/%s/groups' % user_id) self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['groups'])
def list_users_for_tenant(self, tenant_id): """List users for a Tenant.""" resp, body = self.get('/tenants/%s/users' % tenant_id) self.expected_success(200, resp.status) return service_client.ResponseBodyList(resp, self._parse_resp(body))
def list_credentials(self): """Lists out all the available credentials.""" resp, body = self.get('credentials') self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['credentials'])
def list_roles(self): """Get the list of Roles.""" resp, body = self.get("roles") self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['roles'])
def list_services(self): resp, body = self.get('services') self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['services'])
def list_user_roles(self, tenant_id, user_id): """Returns a list of roles assigned to a user for a tenant.""" url = '/tenants/%s/users/%s/roles' % (tenant_id, user_id) resp, body = self.get(url) self.expected_success(200, resp.status) return service_client.ResponseBodyList(resp, self._parse_resp(body))
def list_user_ec2_credentials(self, user_id): resp, body = self.get('/users/%s/credentials/OS-EC2' % user_id) self.expected_success(200, resp.status) return service_client.ResponseBodyList(resp, self._parse_resp(body))
def list_services(self): """List Service - Returns Services.""" resp, body = self.get('/OS-KSADM/services') self.expected_success(200, resp.status) return service_client.ResponseBodyList(resp, self._parse_resp(body))
def get_trust_roles(self, trust_id): """GET roles delegated by a trust.""" resp, body = self.get("OS-TRUST/trusts/%s/roles" % trust_id) self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['roles'])
def list_user_projects(self, user_id): """Lists the projects on which a user has roles assigned.""" resp, body = self.get('users/%s/projects' % user_id) self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['projects'])
def list_domains(self): """List Domains.""" resp, body = self.get('domains') self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['domains'])
def list_endpoints(self): """GET endpoints.""" resp, body = self.get('endpoints') self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['endpoints'])
def list_groups(self): """Lists the groups.""" resp, body = self.get('groups') self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['groups'])
def list_group_users(self, group_id): """List users in group.""" resp, body = self.get('groups/%s/users' % group_id) self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['users'])
def get_users(self): """Get the list of users.""" resp, body = self.get("users") self.expected_success(200, resp.status) return service_client.ResponseBodyList(resp, self._parse_resp(body))