Add image tasks schema methods

A follow-up of https://review.openstack.org/#/c/637540/ to bring tasks
schema methods to the image proxy and add all schema methods to proxy
docs
Release-note is inherited here (no need for a separate RN)

Change-Id: I5486d4955f4a8c04088f2b7d5466c0e45bec18a8
This commit is contained in:
Artem Goncharov 2019-02-26 14:32:12 +01:00 committed by Monty Taylor
parent 30d8a15bcd
commit 96eae95e3b
3 changed files with 46 additions and 0 deletions

View File

@ -52,3 +52,15 @@ Task Operations
.. automethod:: openstack.image.v2._proxy.Proxy.create_task
.. automethod:: openstack.image.v2._proxy.Proxy.get_task
.. automethod:: openstack.image.v2._proxy.Proxy.wait_for_task
Schema Operations
^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.image.v2._proxy.Proxy
.. automethod:: openstack.image.v2._proxy.Proxy.get_images_schema
.. automethod:: openstack.image.v2._proxy.Proxy.get_image_schema
.. automethod:: openstack.image.v2._proxy.Proxy.get_members_schema
.. automethod:: openstack.image.v2._proxy.Proxy.get_member_schema
.. automethod:: openstack.image.v2._proxy.Proxy.get_tasks_schema
.. automethod:: openstack.image.v2._proxy.Proxy.get_task_schema

View File

@ -640,3 +640,23 @@ class Proxy(_base_proxy.BaseImageProxy):
failures = ['failure'] if failures is None else failures
return resource.wait_for_status(
self, task, status, failures, interval, wait)
def get_tasks_schema(self):
"""Get image tasks schema
:returns: One :class:`~openstack.image.v2.schema.Schema`
:raises: :class:`~openstack.exceptions.ResourceNotFound`
when no resource can be found.
"""
return self._get(_schema.Schema, requires_id=False,
base_path='/schemas/tasks')
def get_task_schema(self):
"""Get image task schema
:returns: One :class:`~openstack.image.v2.schema.Schema`
:raises: :class:`~openstack.exceptions.ResourceNotFound`
when no resource can be found.
"""
return self._get(_schema.Schema, requires_id=False,
base_path='/schemas/task')

View File

@ -215,3 +215,17 @@ class TestImageProxy(test_proxy_base.TestProxyBase):
self.proxy.wait_for_task,
method_args=[value],
expected_args=[value, 'success', ['failure'], 2, 120])
def test_tasks_schema_get(self):
self._verify2("openstack.proxy.Proxy._get",
self.proxy.get_tasks_schema,
expected_args=[schema.Schema],
expected_kwargs={'base_path': '/schemas/tasks',
'requires_id': False})
def test_task_schema_get(self):
self._verify2("openstack.proxy.Proxy._get",
self.proxy.get_task_schema,
expected_args=[schema.Schema],
expected_kwargs={'base_path': '/schemas/task',
'requires_id': False})