Exemplo n.º 1
0
    def execute(self, args: argparse.Namespace):
        config: TortugaScriptConfig = self.get_config()
        ws_client: TortugaWsApiClient = get_client(config, self.parent.name)

        obj_filename = args.file[0]
        data = self._load_data(obj_filename)

        pretty_print(ws_client.put(data), args.fmt)
Exemplo n.º 2
0
    def execute(self, args: argparse.Namespace):
        ws_client = get_client(args, self.parent.name)

        query = args.query
        if not query:
            query = []

        params = self._parse_params(query)

        pretty_print(ws_client.list(**params), args.fmt)
Exemplo n.º 3
0
    def execute(self, args: argparse.Namespace):
        config: TortugaScriptConfig = self.get_config()
        ws_client = get_client(config, self.parent.name)

        query = args.query
        if not query:
            query = []

        params = self._parse_params(query)

        pretty_print(ws_client.list(**params), args.fmt)
Exemplo n.º 4
0
    def execute(self, args: argparse.Namespace):
        """
        Print the current CLI configuration to stdout.

        """
        config: TortugaScriptConfig = self.get_config()
        schema = TortugaScriptConfigSchema()
        config_data = schema.dump(config).data
        try:
            config_data['auth_method'] = config.get_auth_method()
        except ConfigException:
            pass
        pretty_print(config_data, args.fmt)
Exemplo n.º 5
0
    async def send_recieve(self, ws: websockets.WebSocketClientProtocol):
        """
        The main loop that sends/receives data.

        :param ws: the web socket client

        """
        while True:
            msg = await ws.recv()

            data = json.loads(msg)
            pretty_print(data)

            if data['type'] == 'message':
                if data['name'] == 'authentication-required':
                    await self.send_auth(ws)

                if data['name'] == 'authentication-succeeded':
                    await self.send_subscribe(ws)
Exemplo n.º 6
0
    def execute(self, args: argparse.Namespace):
        ws_client: TortugaWsApiClient = get_client(args, self.parent.name)

        pretty_print(ws_client.get(args.id), args.fmt)
Exemplo n.º 7
0
 def execute(self, args: argparse.Namespace):
     pretty_print(get_available_extensions(args), args.fmt)
Exemplo n.º 8
0
    def execute(self, args: argparse.Namespace):
        config: TortugaScriptConfig = self.get_config()
        ws_client: TortugaWsApiClient = get_client(config, self.parent.name)

        pretty_print(ws_client.get(args.id[0]), args.fmt)