Skip to content

Commit

Permalink
Added IMS image listing (#521)
Browse files Browse the repository at this point in the history
Added IMS image listing

Reviewed-by: Anton Sidelnikov
  • Loading branch information
SebastianGode authored Feb 6, 2025
1 parent 001038d commit 55f44e5
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 4 deletions.
27 changes: 26 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
Anton Kachurin <[email protected]>
Anton Sidelnikov <[email protected]>
Artem Goncharov <[email protected]>
Artem Goncharov <[email protected]>
Artem Lifshits <[email protected]>
Artem Sh <[email protected]>
Cloud User <[email protected]>
Cloud User <[email protected]>
Daniel Schaffrath <[email protected]>
Goncharov <[email protected]>
Hugo-C <[email protected]>
Igli <[email protected]>
Irina Pereiaslavskaia <[email protected]>
Irina Pereiaslavskaia <[email protected]>
Nils Magnus <[email protected]>
Nils-Magnus <[email protected]>
Polina Gubina <[email protected]>
Reik Keutterling <[email protected]>
Rodion Gyrbu <[email protected]>
RusselSand <[email protected]>
Sebastian Gode <[email protected]>
SebastianGode <[email protected]>
T. Schreiber <[email protected]>
Tino Schr <[email protected]>
Tino Schreiber <[email protected]>
U-EMEA1\A58358743 <[email protected]>
Vineet Pruthi <[email protected]>
Vladimir Hasko <[email protected]>
Vladimir Vshivkov <[email protected]>
Vladimir Vshivkov <[email protected]>
YustinaKvr <[email protected]>
Zsolt Nagy <[email protected]>
ameszi <[email protected]>
ghodi <[email protected]>
hlange4 <[email protected]>
hodigy <[email protected]>
kucerakk <[email protected]>
opnmind <[email protected]>
otc-zuul[bot] <38854967+otc-zuul[bot]@users.noreply.github.com>
root <[email protected]>
tischrei <[email protected]>
sattila1999 <[email protected]>
wuebbels <[email protected]>
11 changes: 11 additions & 0 deletions otcextensions/sdk/imsv2/v2/_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,14 @@ def create_image(self, **attrs):
:class:`~otcextensions.sdk.imsv2.v2.image.Image`
"""
return self._create(_image.Image, **attrs)

def images(self, **attrs):
"""Retrieve a generator of images
:param dict query: Optional query parameters to be sent to limit the
resources being returned.
:returns: A generator of zone
:class:`~otcextensions.sdk.imsv2.v2.image.Image` instances
"""
return self._list(_image.Image, paginated=False, **attrs)
51 changes: 49 additions & 2 deletions otcextensions/sdk/imsv2/v2/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,49 @@


class Image(resource.Resource):
resources_key = 'images'
resource_key = 'image'
base_path = '/cloudimages/action'
base_path = '/cloudimages'

allow_create = True
allow_list = True

#: Method for creating a resource (POST, PUT)
create_method = "POST"

_query_mapping = resource.QueryParameters('limit', 'id',
'name', 'status',
'__isregistered',
'__imagetype',
'__whole_image',
'__system__cmkid',
'protected',
'visibility',
'owner',
'container_format',
'disk_format',
'min_disk',
'min_ram',
'__os_bit',
'__platform',
'marker',
'sort_key',
'sort_dir',
'__os_type',
'tag',
'member_status',
'__support_kvm',
'__support_xen',
'__support_largememory',
'__support_diskintensive',
'__support_highperformance',
'__support_xen_gpu_type',
'__support_kvm_gpu_type',
'__support_xen_hana',
'__support_kvm_infiniband',
'virtual_env_type',
'enterprise_project_id')

name = resource.Body('name')
description = resource.Body('description')
os_type = resource.Body('os_type')
Expand All @@ -39,7 +75,18 @@ class Image(resource.Resource):
image_tags = resource.Body('image_tags', type=list)
data_images = resource.Body('data_images', type=list)
job_id = resource.Body('job_id')
status = resource.Body('status')
visibility = resource.Body('visibility')
created_at = resource.Body('created_at')
updated_at = resource.Body('updated_at')
container_format = resource.Body('container_format')
disk_format = resource.Body('disk_format')
member_status = resource.Body('member_status')
virtual_env_type = resource.Body('virtual_env_type')
enterprise_project_id = resource.Body('enterprise_project_id')
protected = resource.Body('protected', type=bool)

def create(self, session, prepend_key=False, base_path=None):
# Overriden here to override prepend_key default value
return super(Image, self).create(session, prepend_key, base_path)
return super(Image, self).create(session, prepend_key, base_path
+ '/action')
2 changes: 1 addition & 1 deletion otcextensions/tests/unit/sdk/imsv2/v2/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TestImage(base.TestCase):

def test_basic(self):
sot = image.Image()
path = '/cloudimages/action'
path = '/cloudimages'
self.assertEqual(path, sot.base_path)
self.assertTrue(sot.allow_create)

Expand Down
4 changes: 4 additions & 0 deletions releasenotes/notes/imsv2_listing_images-542c27a5e8948bd7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
features:
- |
added listing images in imsv2

0 comments on commit 55f44e5

Please sign in to comment.