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

File tree

5 files changed

+91
-4
lines changed

5 files changed

+91
-4
lines changed

AUTHORS

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,42 @@
1+
Anton Kachurin <[email protected]>
12
Anton Sidelnikov <[email protected]>
3+
Artem Goncharov <[email protected]>
24
Artem Goncharov <[email protected]>
5+
Artem Lifshits <[email protected]>
6+
37
Cloud User <[email protected]>
48
Cloud User <[email protected]>
9+
Daniel Schaffrath <[email protected]>
510
Goncharov <[email protected]>
11+
12+
13+
Irina Pereiaslavskaia <[email protected]>
14+
Irina Pereiaslavskaia <[email protected]>
15+
Nils Magnus <[email protected]>
616
Nils-Magnus <[email protected]>
17+
Polina Gubina <[email protected]>
718
Reik Keutterling <[email protected]>
19+
Rodion Gyrbu <[email protected]>
20+
RusselSand <[email protected]>
21+
Sebastian Gode <[email protected]>
822
SebastianGode <[email protected]>
23+
T. Schreiber <[email protected]>
24+
Tino Schr <[email protected]>
25+
Tino Schreiber <[email protected]>
926
U-EMEA1\A58358743 <[email protected]>
1027
Vineet Pruthi <[email protected]>
28+
Vladimir Hasko <[email protected]>
29+
Vladimir Vshivkov <[email protected]>
30+
Vladimir Vshivkov <[email protected]>
31+
YustinaKvr <[email protected]>
1132
Zsolt Nagy <[email protected]>
33+
1234
35+
1336
1437
38+
1539
otc-zuul[bot] <38854967+otc-zuul[bot]@users.noreply.github.com>
1640
17-
41+
sattila1999 <[email protected]>
42+

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)