Browse Source

Added fleet management

Change-Id: If593beb069adafe6eb6e13c9b78c8e4eb257840e
Carmelo Romeo 6 months ago
parent
commit
68d2d90906
1 changed files with 35 additions and 0 deletions
  1. 35
    0
      iotronic_ui/api/iotronic.py

+ 35
- 0
iotronic_ui/api/iotronic.py View File

@@ -225,3 +225,38 @@ def attach_port(request, board_id, network_id, subnet_id):
225 225
 def detach_port(request, board_id, port_id):
226 226
     """Detach port from the board."""
227 227
     iotronicclient(request).portonboard.detach_port(board_id, port_id)
228
+
229
+
230
+# FLEETS MANAGEMENT
231
+def fleet_list(request, detail=None):
232
+    """Get fleets list."""
233
+    return iotronicclient(request).fleet.list()
234
+
235
+
236
+def fleet_get(request, fleet_id, fields):
237
+    """Get fleet info."""
238
+    return iotronicclient(request).fleet.get(fleet_id, fields)
239
+
240
+
241
+def fleet_create(request, name, description):
242
+    """Create fleet."""
243
+    params = {"name": name,
244
+              "description": description}
245
+
246
+    iotronicclient(request).fleet.create(**params)
247
+
248
+
249
+def fleet_delete(request, fleet_id):
250
+    """Delete fleet."""
251
+    iotronicclient(request).fleet.delete(fleet_id)
252
+
253
+
254
+def fleet_update(request, fleet_id, patch):
255
+    """Update fleet."""
256
+    iotronicclient(request).fleet.update(fleet_id, patch)
257
+
258
+
259
+def fleet_get_boards(request, fleet_id):
260
+    """Get fleet boards."""
261
+    return iotronicclient(request).fleet.boards_in_fleet(fleet=fleet_id)
262
+

Loading…
Cancel
Save