From 6cc55a8842ec005a067d60b489e5fe53ea52f007 Mon Sep 17 00:00:00 2001 From: jiasirui Date: Mon, 7 Jun 2021 14:13:37 +0800 Subject: [PATCH] add new interface Change-Id: I646a0a2613aa5fda60cb4a69da15db7f093f3346 --- venusclient/common/httpclient.py | 2 +- venusclient/shell.py | 1 + venusclient/v1/config.py | 8 ++++++++ venusclient/v1/config_shell.py | 6 ++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/venusclient/common/httpclient.py b/venusclient/common/httpclient.py index b91efd6..13840ee 100644 --- a/venusclient/common/httpclient.py +++ b/venusclient/common/httpclient.py @@ -36,7 +36,7 @@ LOG = logging.getLogger(__name__) USER_AGENT = 'python-venusclient' CHUNKSIZE = 1024 * 64 # 64kB -API_VERSION = '/v1' +API_VERSION = '/v1.0' DEFAULT_API_VERSION = 'latest' diff --git a/venusclient/shell.py b/venusclient/shell.py index 33a30ce..4182e8f 100644 --- a/venusclient/shell.py +++ b/venusclient/shell.py @@ -635,4 +635,5 @@ def main(): if __name__ == "__main__": + print(os.environ) main() diff --git a/venusclient/v1/config.py b/venusclient/v1/config.py index 08fab63..3f509ad 100644 --- a/venusclient/v1/config.py +++ b/venusclient/v1/config.py @@ -33,3 +33,11 @@ class ConfigManager(basemodels.BaseModelManager): resp, body = self.api.json_request('GET', url) except Exception as e: raise RuntimeError(str(e)) + + def get_logs(self, args): + print(args) + url = '/v1/search/logs' + try: + resp, body = self.api.json_request('GET', url) + except Exception as e: + raise RuntimeError(str(e)) diff --git a/venusclient/v1/config_shell.py b/venusclient/v1/config_shell.py index 4aa5520..64b0086 100644 --- a/venusclient/v1/config_shell.py +++ b/venusclient/v1/config_shell.py @@ -17,3 +17,9 @@ def do_get_log_storage_days(cs, args): """get the days of saved logs in elasticsearch(unit day).""" endpoint = cs.config.get_days() print(endpoint) + + +def do_get_log(cs, args): + """get log content""" + endpoint = cs.config.search_logs(args) + print(endpoint)