Merge "[Services] redesign metaclass to support subclasses"
This commit is contained in:
commit
e956035c51
@ -18,6 +18,7 @@ from rally.task import service as base_service
|
|||||||
service = base_service.service
|
service = base_service.service
|
||||||
compat_layer = base_service.compat_layer
|
compat_layer = base_service.compat_layer
|
||||||
Service = base_service.Service
|
Service = base_service.Service
|
||||||
|
should_be_overridden = base_service.should_be_overridden
|
||||||
|
|
||||||
|
|
||||||
class UnifiedOpenStackService(base_service.UnifiedService):
|
class UnifiedOpenStackService(base_service.UnifiedService):
|
||||||
|
@ -30,6 +30,7 @@ class Identity(service.UnifiedOpenStackService):
|
|||||||
cloud_version = clients.keystone().version.split(".")[0][1:]
|
cloud_version = clients.keystone().version.split(".")[0][1:]
|
||||||
return cloud_version == cls._meta_get("impl")._meta_get("version")
|
return cloud_version == cls._meta_get("impl")._meta_get("version")
|
||||||
|
|
||||||
|
@service.should_be_overridden
|
||||||
def create_project(self, project_name=None, domain_name="Default"):
|
def create_project(self, project_name=None, domain_name="Default"):
|
||||||
"""Creates new project/tenant and return project object.
|
"""Creates new project/tenant and return project object.
|
||||||
|
|
||||||
@ -41,16 +42,20 @@ class Identity(service.UnifiedOpenStackService):
|
|||||||
return self._impl.create_project(project_name,
|
return self._impl.create_project(project_name,
|
||||||
domain_name=domain_name)
|
domain_name=domain_name)
|
||||||
|
|
||||||
|
@service.should_be_overridden
|
||||||
def delete_project(self, project_id):
|
def delete_project(self, project_id):
|
||||||
"""Deletes project."""
|
"""Deletes project."""
|
||||||
return self._impl.delete_project(project_id)
|
return self._impl.delete_project(project_id)
|
||||||
|
|
||||||
|
@service.should_be_overridden
|
||||||
def list_projects(self):
|
def list_projects(self):
|
||||||
"""List all projects."""
|
"""List all projects."""
|
||||||
return self._impl.list_projects()
|
return self._impl.list_projects()
|
||||||
|
|
||||||
def create_user(self, username, password, email=None, project_id=None,
|
@service.should_be_overridden
|
||||||
domain_name="Default", default_role="member"):
|
def create_user(self, username=None, password=None, email=None,
|
||||||
|
project_id=None, domain_name="Default",
|
||||||
|
default_role="member"):
|
||||||
"""Create user.
|
"""Create user.
|
||||||
|
|
||||||
:param username: name of user
|
:param username: name of user
|
||||||
@ -71,22 +76,27 @@ class Identity(service.UnifiedOpenStackService):
|
|||||||
domain_name=domain_name,
|
domain_name=domain_name,
|
||||||
default_role=default_role)
|
default_role=default_role)
|
||||||
|
|
||||||
|
@service.should_be_overridden
|
||||||
def delete_user(self, user_id):
|
def delete_user(self, user_id):
|
||||||
"""Deletes user by its id."""
|
"""Deletes user by its id."""
|
||||||
self._impl.delete_user(user_id)
|
self._impl.delete_user(user_id)
|
||||||
|
|
||||||
|
@service.should_be_overridden
|
||||||
def list_users(self):
|
def list_users(self):
|
||||||
"""List all users."""
|
"""List all users."""
|
||||||
return self._impl.list_users()
|
return self._impl.list_users()
|
||||||
|
|
||||||
|
@service.should_be_overridden
|
||||||
def delete_service(self, service_id):
|
def delete_service(self, service_id):
|
||||||
"""Deletes service."""
|
"""Deletes service."""
|
||||||
self._impl.delete_service(service_id)
|
self._impl.delete_service(service_id)
|
||||||
|
|
||||||
|
@service.should_be_overridden
|
||||||
def list_services(self):
|
def list_services(self):
|
||||||
"""List all services."""
|
"""List all services."""
|
||||||
return self._impl.list_services()
|
return self._impl.list_services()
|
||||||
|
|
||||||
|
@service.should_be_overridden
|
||||||
def create_role(self, name=None, domain_name="Default"):
|
def create_role(self, name=None, domain_name="Default"):
|
||||||
"""Create role with specific name
|
"""Create role with specific name
|
||||||
|
|
||||||
@ -97,20 +107,24 @@ class Identity(service.UnifiedOpenStackService):
|
|||||||
"""
|
"""
|
||||||
return self._impl.create_role(name=name, domain_name=domain_name)
|
return self._impl.create_role(name=name, domain_name=domain_name)
|
||||||
|
|
||||||
|
@service.should_be_overridden
|
||||||
def add_role(self, role_id, user_id, project_id):
|
def add_role(self, role_id, user_id, project_id):
|
||||||
"""Add role to user."""
|
"""Add role to user."""
|
||||||
return self._impl.add_role(role_id=role_id, user_id=user_id,
|
return self._impl.add_role(role_id=role_id, user_id=user_id,
|
||||||
project_id=project_id)
|
project_id=project_id)
|
||||||
|
|
||||||
|
@service.should_be_overridden
|
||||||
def delete_role(self, role_id):
|
def delete_role(self, role_id):
|
||||||
"""Deletes role."""
|
"""Deletes role."""
|
||||||
self._impl.delete_role(role_id)
|
self._impl.delete_role(role_id)
|
||||||
|
|
||||||
|
@service.should_be_overridden
|
||||||
def revoke_role(self, role_id, user_id, project_id):
|
def revoke_role(self, role_id, user_id, project_id):
|
||||||
"""Revokes a role from a user."""
|
"""Revokes a role from a user."""
|
||||||
return self._impl.revoke_role(role_id=role_id, user_id=user_id,
|
return self._impl.revoke_role(role_id=role_id, user_id=user_id,
|
||||||
project_id=project_id)
|
project_id=project_id)
|
||||||
|
|
||||||
|
@service.should_be_overridden
|
||||||
def list_roles(self, user_id=None, project_id=None, domain_name=None):
|
def list_roles(self, user_id=None, project_id=None, domain_name=None):
|
||||||
"""List all roles.
|
"""List all roles.
|
||||||
|
|
||||||
@ -124,6 +138,7 @@ class Identity(service.UnifiedOpenStackService):
|
|||||||
return self._impl.list_roles(user_id=user_id, project_id=project_id,
|
return self._impl.list_roles(user_id=user_id, project_id=project_id,
|
||||||
domain_name=domain_name)
|
domain_name=domain_name)
|
||||||
|
|
||||||
|
@service.should_be_overridden
|
||||||
def get_role(self, role_id):
|
def get_role(self, role_id):
|
||||||
"""Get role."""
|
"""Get role."""
|
||||||
return self._impl.get_role(role_id)
|
return self._impl.get_role(role_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user