Replace 'value' arguments in image proxies

Replace 'value' arguments with more appropriate names.

Change-Id: Ifadb3003f412d215ddcd533d33b2cbc034a4ac43
This commit is contained in:
Brian Curtin 2015-12-14 16:25:59 -06:00
parent d2c9174b9d
commit fb64dcc54f
2 changed files with 48 additions and 48 deletions

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.image.v1 import image
from openstack.image.v1 import image as _image
from openstack import proxy
@ -26,12 +26,12 @@ class Proxy(proxy.BaseProxy):
:returns: The results of image creation
:rtype: :class:`~openstack.image.v1.image.Image`
"""
return self._create(image.Image, **attrs)
return self._create(_image.Image, **attrs)
def delete_image(self, value, ignore_missing=True):
def delete_image(self, image, ignore_missing=True):
"""Delete an image
:param value: The value can be either the ID of an image or a
:param image: The value can be either the ID of an image or a
:class:`~openstack.image.v1.image.Image` instance.
:param bool ignore_missing: When set to ``False``
:class:`~openstack.exceptions.ResourceNotFound` will be
@ -41,7 +41,7 @@ class Proxy(proxy.BaseProxy):
:returns: ``None``
"""
self._delete(image.Image, value, ignore_missing=ignore_missing)
self._delete(_image.Image, image, ignore_missing=ignore_missing)
def find_image(self, name_or_id, ignore_missing=True):
"""Find a single image
@ -54,20 +54,20 @@ class Proxy(proxy.BaseProxy):
attempting to find a nonexistent resource.
:returns: One :class:`~openstack.image.v1.image.Image` or None
"""
return self._find(image.Image, name_or_id,
return self._find(_image.Image, name_or_id,
ignore_missing=ignore_missing)
def get_image(self, value):
def get_image(self, image):
"""Get a single image
:param value: The value can be the ID of an image or a
:param image: The value can be the ID of an image or a
:class:`~openstack.image.v1.image.Image` instance.
:returns: One :class:`~openstack.image.v1.image.Image`
:raises: :class:`~openstack.exceptions.ResourceNotFound`
when no resource can be found.
"""
return self._get(image.Image, value)
return self._get(_image.Image, image)
def images(self, **query):
"""Return a generator of images
@ -78,12 +78,12 @@ class Proxy(proxy.BaseProxy):
:returns: A generator of image objects
:rtype: :class:`~openstack.image.v1.image.Image`
"""
return self._list(image.Image, paginated=True, **query)
return self._list(_image.Image, paginated=True, **query)
def update_image(self, value, **attrs):
def update_image(self, image, **attrs):
"""Update a image
:param value: Either the id of a image or a
:param image: Either the id of a image or a
:class:`~openstack.image.v1.image.Image` instance.
:attrs kwargs: The attributes to update on the image represented
by ``value``.
@ -91,4 +91,4 @@ class Proxy(proxy.BaseProxy):
:returns: The updated image
:rtype: :class:`~openstack.image.v1.image.Image`
"""
return self._update(image.Image, value, **attrs)
return self._update(_image.Image, image, **attrs)

View File

@ -10,9 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.image.v2 import image
from openstack.image.v2 import member
from openstack.image.v2 import tag
from openstack.image.v2 import image as _image
from openstack.image.v2 import member as _member
from openstack.image.v2 import tag as _tag
from openstack import proxy
@ -30,17 +30,17 @@ class Proxy(proxy.BaseProxy):
"""
data = attrs.pop('data')
img = self._create(image.Image, **attrs)
img = self._create(_image.Image, **attrs)
img.data = data
img.upload_image(self.session)
return img
def delete_image(self, value, ignore_missing=True):
def delete_image(self, image, ignore_missing=True):
"""Delete an image
:param value: The value can be either the ID of an image or a
:param image: The value can be either the ID of an image or a
:class:`~openstack.image.v2.image.Image` instance.
:param bool ignore_missing: When set to ``False``
:class:`~openstack.exceptions.ResourceNotFound` will be
@ -50,7 +50,7 @@ class Proxy(proxy.BaseProxy):
:returns: ``None``
"""
self._delete(image.Image, value, ignore_missing=ignore_missing)
self._delete(_image.Image, image, ignore_missing=ignore_missing)
def find_image(self, name_or_id, ignore_missing=True):
"""Find a single image
@ -63,20 +63,20 @@ class Proxy(proxy.BaseProxy):
attempting to find a nonexistent resource.
:returns: One :class:`~openstack.image.v2.image.Image` or None
"""
return self._find(image.Image, name_or_id,
return self._find(_image.Image, name_or_id,
ignore_missing=ignore_missing)
def get_image(self, value):
def get_image(self, image):
"""Get a single image
:param value: The value can be the ID of a image or a
:param image: The value can be the ID of a image or a
:class:`~openstack.image.v2.image.Image` instance.
:returns: One :class:`~openstack.image.v2.image.Image`
:raises: :class:`~openstack.exceptions.ResourceNotFound`
when no resource can be found.
"""
return self._get(image.Image, value)
return self._get(_image.Image, image)
def images(self, **query):
"""Return a generator of images
@ -87,12 +87,12 @@ class Proxy(proxy.BaseProxy):
:returns: A generator of image objects
:rtype: :class:`~openstack.image.v2.image.Image`
"""
return self._list(image.Image, paginated=True, **query)
return self._list(_image.Image, paginated=True, **query)
def update_image(self, value, **attrs):
def update_image(self, image, **attrs):
"""Update a image
:param value: Either the id of a image or a
:param image: Either the id of a image or a
:class:`~openstack.image.v2.image.Image` instance.
:attrs kwargs: The attributes to update on the image represented
by ``value``.
@ -100,7 +100,7 @@ class Proxy(proxy.BaseProxy):
:returns: The updated image
:rtype: :class:`~openstack.image.v2.image.Image`
"""
return self._update(image.Image, value, **attrs)
return self._update(_image.Image, image, **attrs)
def create_member(self, **attrs):
"""Create a new member from attributes
@ -112,13 +112,13 @@ class Proxy(proxy.BaseProxy):
:returns: The results of member creation
:rtype: :class:`~openstack.image.v2.member.Member`
"""
return self._create(member.Member, **attrs)
return self._create(_member.Member, **attrs)
def delete_member(self, value, ignore_missing=True):
def delete_member(self, member, ignore_missing=True):
"""Delete a member
:param value: The value can be either the ID of a member or a
:class:`~openstack.image.v2.member.Member` instance.
:param member: The value can be either the ID of a member or a
:class:`~openstack.image.v2.member.Member` instance.
:param bool ignore_missing: When set to ``False``
:class:`~openstack.exceptions.ResourceNotFound` will be
raised when the member does not exist.
@ -127,7 +127,7 @@ class Proxy(proxy.BaseProxy):
:returns: ``None``
"""
self._delete(member.Member, value, ignore_missing=ignore_missing)
self._delete(_member.Member, member, ignore_missing=ignore_missing)
def find_member(self, name_or_id, ignore_missing=True):
"""Find a single member
@ -140,20 +140,20 @@ class Proxy(proxy.BaseProxy):
attempting to find a nonexistent resource.
:returns: One :class:`~openstack.image.v2.member.Member` or None
"""
return self._find(member.Member, name_or_id,
return self._find(_member.Member, name_or_id,
ignore_missing=ignore_missing)
def get_member(self, value):
def get_member(self, member):
"""Get a single member
:param value: The value can be the ID of a member or a
:class:`~openstack.image.v2.member.Member` instance.
:param member: The value can be the ID of a member or a
:class:`~openstack.image.v2.member.Member` instance.
:returns: One :class:`~openstack.image.v2.member.Member`
:raises: :class:`~openstack.exceptions.ResourceNotFound`
when no resource can be found.
"""
return self._get(member.Member, value)
return self._get(_member.Member, member)
def members(self, **query):
"""Return a generator of members
@ -164,20 +164,20 @@ class Proxy(proxy.BaseProxy):
:returns: A generator of member objects
:rtype: :class:`~openstack.image.v2.member.Member`
"""
return self._list(member.Member, paginated=False, **query)
return self._list(_member.Member, paginated=False, **query)
def update_member(self, value, **attrs):
def update_member(self, member, **attrs):
"""Update a member
:param value: Either the id of a member or a
:class:`~openstack.image.v2.member.Member` instance.
:param member: Either the id of a member or a
:class:`~openstack.image.v2.member.Member` instance.
:attrs kwargs: The attributes to update on the member represented
by ``value``.
:returns: The updated member
:rtype: :class:`~openstack.image.v2.member.Member`
"""
return self._update(member.Member, value, **attrs)
return self._update(_member.Member, member, **attrs)
def create_tag(self, **attrs):
"""Create a new tag from attributes
@ -189,13 +189,13 @@ class Proxy(proxy.BaseProxy):
:returns: The results of tag creation
:rtype: :class:`~openstack.image.v2.tag.Tag`
"""
return self._create(tag.Tag, **attrs)
return self._create(_tag.Tag, **attrs)
def delete_tag(self, value, ignore_missing=True):
def delete_tag(self, tag, ignore_missing=True):
"""Delete a tag
:param value: The value can be either the ID of a tag or a
:class:`~openstack.image.v2.tag.Tag` instance.
:param tag: The value can be either the ID of a tag or a
:class:`~openstack.image.v2.tag.Tag` instance.
:param bool ignore_missing: When set to ``False``
:class:`~openstack.exceptions.ResourceNotFound` will be
raised when the tag does not exist.
@ -204,4 +204,4 @@ class Proxy(proxy.BaseProxy):
:returns: ``None``
"""
self._delete(tag.Tag, value, ignore_missing=ignore_missing)
self._delete(_tag.Tag, tag, ignore_missing=ignore_missing)