summaryrefslogtreecommitdiffstats
path: root/cli/cli.py
diff options
context:
space:
mode:
Diffstat (limited to 'cli/cli.py')
-rw-r--r--cli/cli.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/cli/cli.py b/cli/cli.py
index dd6b723..02cae6b 100644
--- a/cli/cli.py
+++ b/cli/cli.py
@@ -13,6 +13,7 @@ from cli.objects.images import OgImage
from cli.objects.disks import OgDisk
from cli.objects.poweroff import OgPoweroff
from cli.objects.reboot import OgReboot
+from cli.objects.server import OgServer
import argparse
import requests
import sys
@@ -68,7 +69,8 @@ class OgCLI():
def list(self, args):
choices = ['clients', 'scopes', 'modes', 'hardware',
- 'client', 'images', 'disks']
+ 'client', 'images', 'disks', 'server',
+ 'servers']
parser = argparse.ArgumentParser(prog='ogcli list')
parser.add_argument('item', choices=choices)
parsed_args = parser.parse_args([args[0]])
@@ -87,15 +89,19 @@ class OgCLI():
OgImage.list_images(self.rest)
elif parsed_args.item == 'disks':
OgDisk.list_disks(self.rest, args[1:])
+ elif parsed_args.item in ['server', 'servers']:
+ OgServer.list_servers(self.rest)
def set(self, args):
- choices = ['modes', 'mode']
+ choices = ['modes', 'mode', 'server']
parser = argparse.ArgumentParser(prog='ogcli set')
parser.add_argument('item', choices=choices)
parsed_args = parser.parse_args([args[0]])
- if parsed_args.item in choices:
+ if parsed_args.item in ['modes', 'mode']:
OgModes.set_modes(self.rest, args[1:])
+ elif parsed_args.item == 'server':
+ OgServer.set_server(self.rest, args[1:])
def send(self, args):
choices = ['reboot', 'refresh', 'poweroff', 'wol']
@@ -147,3 +153,21 @@ class OgCLI():
if parsed_args.update_obj == 'image':
OgImage.update_image(self.rest, args[1:])
+
+ def delete(self, args):
+ choices = ['server']
+ parser = argparse.ArgumentParser(prog='ogcli remove')
+ parser.add_argument('delete_obj', choices=choices)
+ parsed_args = parser.parse_args([args[0]])
+
+ if parsed_args.delete_obj == 'server':
+ OgServer.delete_server(self.rest, args[1:])
+
+ def add(self, args):
+ choices = ['server']
+ parser = argparse.ArgumentParser(prog='ogcli remove')
+ parser.add_argument('add_obj', choices=choices)
+ parsed_args = parser.parse_args([args[0]])
+
+ if parsed_args.add_obj == 'server':
+ OgServer.add_server(self.rest, args[1:])