Improve docs for v3 projects
In preparation to add functional tests for v3 projects, this change proposes to detail the method docs, because the tests need to be based on them. Change-Id: I3961945a2833fcd4a04c8e2fa294ecd3a12cfbe2
This commit is contained in:
@@ -68,13 +68,19 @@ class ProjectManager(base.CrudManager):
|
|||||||
enabled=True, parent=None, **kwargs):
|
enabled=True, parent=None, **kwargs):
|
||||||
"""Create a project.
|
"""Create a project.
|
||||||
|
|
||||||
:param str name: project name.
|
:param str name: the name of the project.
|
||||||
:param domain: the project domain.
|
:param domain: the domain of the project.
|
||||||
:type domain: :py:class:`keystoneclient.v3.domains.Domain` or str
|
:type domain: str or :class:`keystoneclient.v3.domains.Domain`
|
||||||
:param str description: the project description. (optional)
|
:param str description: the description of the project.
|
||||||
:param boolean enabled: if the project is enabled. (optional)
|
:param bool enabled: whether the project is enabled.
|
||||||
:param parent: the project's parent in the hierarchy. (optional)
|
:param parent: the parent of the project in the hierarchy.
|
||||||
:type parent: :py:class:`keystoneclient.v3.projects.Project` or str
|
:type parent: str or :class:`keystoneclient.v3.projects.Project`
|
||||||
|
:param kwargs: any other attribute provided will be passed to the
|
||||||
|
server.
|
||||||
|
|
||||||
|
:returns: the created project returned from server.
|
||||||
|
:rtype: :class:`keystoneclient.v3.projects.Project`
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# NOTE(rodrigods): the API must be backwards compatible, so if an
|
# NOTE(rodrigods): the API must be backwards compatible, so if an
|
||||||
# application was passing a 'parent_id' before as kwargs, the call
|
# application was passing a 'parent_id' before as kwargs, the call
|
||||||
@@ -94,11 +100,16 @@ class ProjectManager(base.CrudManager):
|
|||||||
def list(self, domain=None, user=None, **kwargs):
|
def list(self, domain=None, user=None, **kwargs):
|
||||||
"""List projects.
|
"""List projects.
|
||||||
|
|
||||||
If domain or user are provided, then filter projects with
|
:param domain: the domain of the projects to be filtered on.
|
||||||
those attributes.
|
:type domain: str or :class:`keystoneclient.v3.domains.Domain`
|
||||||
|
:param user: filter in projects the specified user has role
|
||||||
|
assignments on.
|
||||||
|
:type user: str or :class:`keystoneclient.v3.users.User`
|
||||||
|
:param kwargs: any other attribute provided will filter projects on.
|
||||||
|
|
||||||
|
:returns: a list of projects.
|
||||||
|
:rtype: list of :class:`keystoneclient.v3.projects.Project`
|
||||||
|
|
||||||
If ``**kwargs`` are provided, then filter projects with
|
|
||||||
attributes matching ``**kwargs``.
|
|
||||||
"""
|
"""
|
||||||
base_url = '/users/%s' % base.getid(user) if user else None
|
base_url = '/users/%s' % base.getid(user) if user else None
|
||||||
return super(ProjectManager, self).list(
|
return super(ProjectManager, self).list(
|
||||||
@@ -124,26 +135,27 @@ class ProjectManager(base.CrudManager):
|
|||||||
@positional()
|
@positional()
|
||||||
def get(self, project, subtree_as_list=False, parents_as_list=False,
|
def get(self, project, subtree_as_list=False, parents_as_list=False,
|
||||||
subtree_as_ids=False, parents_as_ids=False):
|
subtree_as_ids=False, parents_as_ids=False):
|
||||||
"""Get a project.
|
"""Retrieve a project.
|
||||||
|
|
||||||
:param project: project to be retrieved.
|
:param project: the project to be retrieved from the server.
|
||||||
:type project: :py:class:`keystoneclient.v3.projects.Project` or str
|
:type project: str or :class:`keystoneclient.v3.projects.Project`
|
||||||
:param boolean subtree_as_list: retrieve projects below this project
|
:param bool subtree_as_list: retrieve projects below this project
|
||||||
in the hierarchy as a flat list.
|
in the hierarchy as a flat list.
|
||||||
(optional)
|
:param bool parents_as_list: retrieve projects above this project
|
||||||
:param boolean parents_as_list: retrieve projects above this project
|
|
||||||
in the hierarchy as a flat list.
|
in the hierarchy as a flat list.
|
||||||
(optional)
|
:param bool subtree_as_ids: retrieve the IDs from the projects below
|
||||||
:param boolean subtree_as_ids: retrieve the IDs from the projects below
|
|
||||||
this project in the hierarchy as a
|
this project in the hierarchy as a
|
||||||
structured dictionary. (optional)
|
structured dictionary.
|
||||||
:param boolean parents_as_ids: retrieve the IDs from the projects above
|
:param bool parents_as_ids: retrieve the IDs from the projects above
|
||||||
this project in the hierarchy as a
|
this project in the hierarchy as a
|
||||||
structured dictionary. (optional)
|
structured dictionary.
|
||||||
|
:returns: the specified project returned from server.
|
||||||
|
:rtype: :class:`keystoneclient.v3.projects.Project`
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.ValidationError: if subtree_as_list
|
:raises keystoneclient.exceptions.ValidationError: if subtree_as_list
|
||||||
and subtree_as_ids or parents_as_list and parents_as_ids are
|
and subtree_as_ids or parents_as_list and parents_as_ids are
|
||||||
included at the same time in the call.
|
included at the same time in the call.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self._check_not_parents_as_ids_and_parents_as_list(
|
self._check_not_parents_as_ids_and_parents_as_list(
|
||||||
parents_as_ids, parents_as_list)
|
parents_as_ids, parents_as_list)
|
||||||
@@ -169,6 +181,21 @@ class ProjectManager(base.CrudManager):
|
|||||||
@positional(enforcement=positional.WARN)
|
@positional(enforcement=positional.WARN)
|
||||||
def update(self, project, name=None, domain=None, description=None,
|
def update(self, project, name=None, domain=None, description=None,
|
||||||
enabled=None, **kwargs):
|
enabled=None, **kwargs):
|
||||||
|
"""Update a project.
|
||||||
|
|
||||||
|
:param project: the project to be updated on the server.
|
||||||
|
:type project: str or :class:`keystoneclient.v3.projects.Project`
|
||||||
|
:param str name: the new name of the project.
|
||||||
|
:param domain: the new domain of the project.
|
||||||
|
:type domain: str or :class:`keystoneclient.v3.domains.Domain`
|
||||||
|
:param str description: the new description of the project.
|
||||||
|
:param bool enabled: whether the project is enabled.
|
||||||
|
:param kwargs: any other attribute provided will be passed to server.
|
||||||
|
|
||||||
|
:returns: the updated project returned from server.
|
||||||
|
:rtype: :class:`keystoneclient.v3.projects.Project`
|
||||||
|
|
||||||
|
"""
|
||||||
return super(ProjectManager, self).update(
|
return super(ProjectManager, self).update(
|
||||||
project_id=base.getid(project),
|
project_id=base.getid(project),
|
||||||
domain_id=base.getid(domain),
|
domain_id=base.getid(domain),
|
||||||
@@ -178,5 +205,13 @@ class ProjectManager(base.CrudManager):
|
|||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
def delete(self, project):
|
def delete(self, project):
|
||||||
|
"""Delete a project.
|
||||||
|
|
||||||
|
:param project: the project to be deleted on the server.
|
||||||
|
:type project: str or :class:`keystoneclient.v3.projects.Project`
|
||||||
|
|
||||||
|
:returns: 204 No Content.
|
||||||
|
|
||||||
|
"""
|
||||||
return super(ProjectManager, self).delete(
|
return super(ProjectManager, self).delete(
|
||||||
project_id=base.getid(project))
|
project_id=base.getid(project))
|
||||||
|
Reference in New Issue
Block a user