Skip to content

Commit c5880bd

Browse files
committed
wip for now
1 parent 8bbbe48 commit c5880bd

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

sandbox.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
manager.authenticate()
66

77

8-
storages = manager.get_storages(storage_type='template')
8+
storages = manager.get_templates()
9+
print(storages)

upcloud_api/cloud_manager/storage_mixin.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ def get_storages(self, storage_type='normal'):
2222
print(res)
2323
return Storage._create_storage_objs(res['storages'], cloud_manager=self)
2424

25+
def get_templates(self):
26+
"""
27+
Return a list of Storages that are templates in a dict with key as title and uuid as value.
28+
"""
29+
templates = []
30+
res = self.get_request('/storage/template')
31+
for item in res.get('storages').get('storage'):
32+
templates.append({item.get('title'): item.get('uuid')})
33+
return templates
34+
2535
def get_storage(self, storage):
2636
"""
2737
Return a Storage object from the API.

0 commit comments

Comments
 (0)