diff options
Diffstat (limited to 'cli/objects/client.py')
-rw-r--r-- | cli/objects/client.py | 89 |
1 files changed, 45 insertions, 44 deletions
diff --git a/cli/objects/client.py b/cli/objects/client.py index 4dc64fd..dbb7f15 100644 --- a/cli/objects/client.py +++ b/cli/objects/client.py @@ -9,49 +9,50 @@ import argparse from cli.utils import print_json + class OgClient(): - @staticmethod - def list_clients(rest): - r = rest.get('/clients') - print_json(r.text) - - @staticmethod - def list_client_hardware(rest, args): - parser = argparse.ArgumentParser() - parser.add_argument('--client-ip', - nargs=1, - type=str, - required=True, - help='client IP') - parsed_args = parser.parse_args(args) - - payload = {'client': parsed_args.client_ip} - r = rest.get('/hardware', payload=payload) - print_json(r.text) - - @staticmethod - def get_client_properties(rest, args): - parser = argparse.ArgumentParser() - parser.add_argument('--client-ip', - nargs=1, - required=True, - help='client IP') - parsed_args = parser.parse_args(args) - - payload = {'client': parsed_args.client_ip} - r = rest.get('/client/info', payload=payload) - print_json(r.text) - - @staticmethod - def send_refresh(rest, args): - parser = argparse.ArgumentParser() - parser.add_argument('--client-ip', - action='append', - default=[], - required=True, - help='Client IP') - parsed_args = parser.parse_args(args) - - payload = {'clients': parsed_args.client_ip} - rest.post('/refresh', payload=payload) + @staticmethod + def list_clients(rest): + r = rest.get('/clients') + print_json(r.text) + + @staticmethod + def list_client_hardware(rest, args): + parser = argparse.ArgumentParser() + parser.add_argument('--client-ip', + nargs=1, + type=str, + required=True, + help='client IP') + parsed_args = parser.parse_args(args) + + payload = {'client': parsed_args.client_ip} + r = rest.get('/hardware', payload=payload) + print_json(r.text) + + @staticmethod + def get_client_properties(rest, args): + parser = argparse.ArgumentParser() + parser.add_argument('--client-ip', + nargs=1, + required=True, + help='client IP') + parsed_args = parser.parse_args(args) + + payload = {'client': parsed_args.client_ip} + r = rest.get('/client/info', payload=payload) + print_json(r.text) + + @staticmethod + def send_refresh(rest, args): + parser = argparse.ArgumentParser() + parser.add_argument('--client-ip', + action='append', + default=[], + required=True, + help='Client IP') + parsed_args = parser.parse_args(args) + + payload = {'clients': parsed_args.client_ip} + rest.post('/refresh', payload=payload) |