Skip to content

Commit 55f44e5

Browse files
Added IMS image listing (#521)
Added IMS image listing Reviewed-by: Anton Sidelnikov
1 parent 001038d commit 55f44e5

5 files changed

Lines changed: 91 additions & 4 deletions

File tree

AUTHORS

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,42 @@
1+
Anton Kachurin <anton.kachurin@t-systems.com>
12
Anton Sidelnikov <53078276+anton-sidelnikov@users.noreply.github.com>
3+
Artem Goncharov <Artem.goncharov@gmail.com>
24
Artem Goncharov <artem.goncharov@gmail.com>
5+
Artem Lifshits <55093318+artem-lifshits@users.noreply.github.com>
6+
Artem Sh <shakhbazianartem@gmail.com>
37
Cloud User <linux@ag-bastion.novalocal>
48
Cloud User <linux@ecs-3858.novalocal>
9+
Daniel Schaffrath <dsh2@me.com>
510
Goncharov <Artem.Goncharov@t-systems.com>
11+
Hugo-C <24675917+Hugo-C@users.noreply.github.com>
12+
Igli <iglikoxha@outlook.com>
13+
Irina Pereiaslavskaia <63649585+irina-pereiaslavskaia@users.noreply.github.com>
14+
Irina Pereiaslavskaia <irina.pereyaslavskaya@gmail.com>
15+
Nils Magnus <magnus@linuxtag.org>
616
Nils-Magnus <magnus@linuxtag.org>
17+
Polina Gubina <33940358+Polina-Gubina@users.noreply.github.com>
718
Reik Keutterling <spielkind@gmail.com>
19+
Rodion Gyrbu <rodion.gyrbu@t-systems.com>
20+
RusselSand <48719909+RusselSand@users.noreply.github.com>
21+
Sebastian Gode <sebastian.gode@telekom.de>
822
SebastianGode <70581801+SebastianGode@users.noreply.github.com>
23+
T. Schreiber <tino.schreiber@t-systems.com>
24+
Tino Schr <tino.schreiber@t-systems.com>
25+
Tino Schreiber <Tino.Schreiber@t-systems.com>
926
U-EMEA1\A58358743 <A58358743@BE1BT361.emea1.cds.t-internal.com>
1027
Vineet Pruthi <48789821+vineet-pruthi@users.noreply.github.com>
28+
Vladimir Hasko <vladimirhasko@gmail.com>
29+
Vladimir Vshivkov <32225815+enrrou@users.noreply.github.com>
30+
Vladimir Vshivkov <32225815+vladimirvshivkov@users.noreply.github.com>
31+
YustinaKvr <62885041+YustinaKvr@users.noreply.github.com>
1132
Zsolt Nagy <zsoltn@gmail.com>
33+
ameszi <morpheus89@gmail.com>
1234
ghodi <hodigy@gmail.com>
35+
hlange4 <52819910+hlange4@users.noreply.github.com>
1336
hodigy <hodigy@gmail.com>
1437
kucerakk <kucerakk@gmail.com>
38+
opnmind <opnmind@mailbox.org>
1539
otc-zuul[bot] <38854967+otc-zuul[bot]@users.noreply.github.com>
1640
root <root@ecs-3858.novalocal>
17-
tischrei <tino.schreiber@t-systems.com>
41+
sattila1999 <89084660+sattila1999@users.noreply.github.com>
42+
wuebbels <47345655+wuebbels@users.noreply.github.com>

otcextensions/sdk/imsv2/v2/_proxy.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,14 @@ def create_image(self, **attrs):
2323
:class:`~otcextensions.sdk.imsv2.v2.image.Image`
2424
"""
2525
return self._create(_image.Image, **attrs)
26+
27+
def images(self, **attrs):
28+
"""Retrieve a generator of images
29+
30+
:param dict query: Optional query parameters to be sent to limit the
31+
resources being returned.
32+
33+
:returns: A generator of zone
34+
:class:`~otcextensions.sdk.imsv2.v2.image.Image` instances
35+
"""
36+
return self._list(_image.Image, paginated=False, **attrs)

otcextensions/sdk/imsv2/v2/image.py

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,49 @@
1515

1616

1717
class Image(resource.Resource):
18+
resources_key = 'images'
1819
resource_key = 'image'
19-
base_path = '/cloudimages/action'
20+
base_path = '/cloudimages'
2021

2122
allow_create = True
23+
allow_list = True
24+
2225
#: Method for creating a resource (POST, PUT)
2326
create_method = "POST"
2427

28+
_query_mapping = resource.QueryParameters('limit', 'id',
29+
'name', 'status',
30+
'__isregistered',
31+
'__imagetype',
32+
'__whole_image',
33+
'__system__cmkid',
34+
'protected',
35+
'visibility',
36+
'owner',
37+
'container_format',
38+
'disk_format',
39+
'min_disk',
40+
'min_ram',
41+
'__os_bit',
42+
'__platform',
43+
'marker',
44+
'sort_key',
45+
'sort_dir',
46+
'__os_type',
47+
'tag',
48+
'member_status',
49+
'__support_kvm',
50+
'__support_xen',
51+
'__support_largememory',
52+
'__support_diskintensive',
53+
'__support_highperformance',
54+
'__support_xen_gpu_type',
55+
'__support_kvm_gpu_type',
56+
'__support_xen_hana',
57+
'__support_kvm_infiniband',
58+
'virtual_env_type',
59+
'enterprise_project_id')
60+
2561
name = resource.Body('name')
2662
description = resource.Body('description')
2763
os_type = resource.Body('os_type')
@@ -39,7 +75,18 @@ class Image(resource.Resource):
3975
image_tags = resource.Body('image_tags', type=list)
4076
data_images = resource.Body('data_images', type=list)
4177
job_id = resource.Body('job_id')
78+
status = resource.Body('status')
79+
visibility = resource.Body('visibility')
80+
created_at = resource.Body('created_at')
81+
updated_at = resource.Body('updated_at')
82+
container_format = resource.Body('container_format')
83+
disk_format = resource.Body('disk_format')
84+
member_status = resource.Body('member_status')
85+
virtual_env_type = resource.Body('virtual_env_type')
86+
enterprise_project_id = resource.Body('enterprise_project_id')
87+
protected = resource.Body('protected', type=bool)
4288

4389
def create(self, session, prepend_key=False, base_path=None):
4490
# Overriden here to override prepend_key default value
45-
return super(Image, self).create(session, prepend_key, base_path)
91+
return super(Image, self).create(session, prepend_key, base_path
92+
+ '/action')

otcextensions/tests/unit/sdk/imsv2/v2/test_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class TestImage(base.TestCase):
2929

3030
def test_basic(self):
3131
sot = image.Image()
32-
path = '/cloudimages/action'
32+
path = '/cloudimages'
3333
self.assertEqual(path, sot.base_path)
3434
self.assertTrue(sot.allow_create)
3535

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
features:
3+
- |
4+
added listing images in imsv2

0 commit comments

Comments
 (0)