diff --git a/turbinia/api/client/README.md b/turbinia/api/client/README.md index 2e1c6ee90..561c45d53 100644 --- a/turbinia/api/client/README.md +++ b/turbinia/api/client/README.md @@ -95,6 +95,7 @@ Class | Method | HTTP request | Description *TurbiniaConfigurationApi* | [**get_request_options**](docs/TurbiniaConfigurationApi.md#get_request_options) | **GET** /api/config/request_options | Get Request Options *TurbiniaConfigurationApi* | [**get_version**](docs/TurbiniaConfigurationApi.md#get_version) | **GET** /api/config/version | Get Version *TurbiniaConfigurationApi* | [**read_config**](docs/TurbiniaConfigurationApi.md#read_config) | **GET** /api/config/ | Read Config +*TurbiniaEvidenceApi* | [**download_by_evidence_id**](docs/TurbiniaEvidenceApi.md#download_by_evidence_id) | **GET** /api/evidence/download/{evidence_id} | Download By Evidence Id *TurbiniaEvidenceApi* | [**get_evidence_attributes**](docs/TurbiniaEvidenceApi.md#get_evidence_attributes) | **GET** /api/evidence/types/{evidence_type} | Get Evidence Attributes *TurbiniaEvidenceApi* | [**get_evidence_by_id**](docs/TurbiniaEvidenceApi.md#get_evidence_by_id) | **GET** /api/evidence/{evidence_id} | Get Evidence By Id *TurbiniaEvidenceApi* | [**get_evidence_summary**](docs/TurbiniaEvidenceApi.md#get_evidence_summary) | **GET** /api/evidence/summary | Get Evidence Summary @@ -102,7 +103,9 @@ Class | Method | HTTP request | Description *TurbiniaEvidenceApi* | [**query_evidence**](docs/TurbiniaEvidenceApi.md#query_evidence) | **GET** /api/evidence/query | Query Evidence *TurbiniaEvidenceApi* | [**upload_evidence**](docs/TurbiniaEvidenceApi.md#upload_evidence) | **POST** /api/evidence/upload | Upload Evidence *TurbiniaJobsApi* | [**read_jobs**](docs/TurbiniaJobsApi.md#read_jobs) | **GET** /api/jobs/ | Read Jobs -*TurbiniaLogsApi* | [**get_logs**](docs/TurbiniaLogsApi.md#get_logs) | **GET** /api/logs/{query} | Get Logs +*TurbiniaLogsApi* | [**get_api_server_logs**](docs/TurbiniaLogsApi.md#get_api_server_logs) | **GET** /api/logs/api_server | Get Api Server Logs +*TurbiniaLogsApi* | [**get_server_logs**](docs/TurbiniaLogsApi.md#get_server_logs) | **GET** /api/logs/server | Get Server Logs +*TurbiniaLogsApi* | [**get_turbinia_logs**](docs/TurbiniaLogsApi.md#get_turbinia_logs) | **GET** /api/logs/{hostname} | Get Turbinia Logs *TurbiniaRequestResultsApi* | [**get_plaso_file**](docs/TurbiniaRequestResultsApi.md#get_plaso_file) | **GET** /api/result/plasofile/{task_id} | Get Plaso File *TurbiniaRequestResultsApi* | [**get_request_output**](docs/TurbiniaRequestResultsApi.md#get_request_output) | **GET** /api/result/request/{request_id} | Get Request Output *TurbiniaRequestResultsApi* | [**get_task_output**](docs/TurbiniaRequestResultsApi.md#get_task_output) | **GET** /api/result/task/{task_id} | Get Task Output @@ -110,6 +113,7 @@ Class | Method | HTTP request | Description *TurbiniaRequestsApi* | [**get_request_report**](docs/TurbiniaRequestsApi.md#get_request_report) | **GET** /api/request/report/{request_id} | Get Request Markdown Report *TurbiniaRequestsApi* | [**get_request_status**](docs/TurbiniaRequestsApi.md#get_request_status) | **GET** /api/request/{request_id} | Get Request Status *TurbiniaRequestsApi* | [**get_requests_summary**](docs/TurbiniaRequestsApi.md#get_requests_summary) | **GET** /api/request/summary | Get Requests Summary +*TurbiniaTasksApi* | [**download_output_path**](docs/TurbiniaTasksApi.md#download_output_path) | **GET** /api/download/output/{file_path} | Get Task Report *TurbiniaTasksApi* | [**get_task_report**](docs/TurbiniaTasksApi.md#get_task_report) | **GET** /api/task/report/{task_id} | Get Task Report *TurbiniaTasksApi* | [**get_task_statistics**](docs/TurbiniaTasksApi.md#get_task_statistics) | **GET** /api/task/statistics | Get Task Statistics *TurbiniaTasksApi* | [**get_task_status**](docs/TurbiniaTasksApi.md#get_task_status) | **GET** /api/task/{task_id} | Get Task Status diff --git a/turbinia/api/client/docs/TurbiniaEvidenceApi.md b/turbinia/api/client/docs/TurbiniaEvidenceApi.md index 3a5847263..8e31b71ae 100644 --- a/turbinia/api/client/docs/TurbiniaEvidenceApi.md +++ b/turbinia/api/client/docs/TurbiniaEvidenceApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- +[**download_by_evidence_id**](TurbiniaEvidenceApi.md#download_by_evidence_id) | **GET** /api/evidence/download/{evidence_id} | Download By Evidence Id [**get_evidence_attributes**](TurbiniaEvidenceApi.md#get_evidence_attributes) | **GET** /api/evidence/types/{evidence_type} | Get Evidence Attributes [**get_evidence_by_id**](TurbiniaEvidenceApi.md#get_evidence_by_id) | **GET** /api/evidence/{evidence_id} | Get Evidence By Id [**get_evidence_summary**](TurbiniaEvidenceApi.md#get_evidence_summary) | **GET** /api/evidence/summary | Get Evidence Summary @@ -12,6 +13,80 @@ Method | HTTP request | Description [**upload_evidence**](TurbiniaEvidenceApi.md#upload_evidence) | **POST** /api/evidence/upload | Upload Evidence +# **download_by_evidence_id** +> bytearray download_by_evidence_id(evidence_id) + +Download By Evidence Id + +Retrieves an evidence in Redis by using its UUID. Args: evidence_id (str): The UUID of the evidence. Raises: HTTPException: if the evidence is not found. Returns: FileResponse: The evidence file. + +### Example + +* OAuth Authentication (oAuth2): +```python +import time +import os +import turbinia_api_lib +from turbinia_api_lib.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = turbinia_api_lib.Configuration( + host = "http://localhost" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with turbinia_api_lib.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = turbinia_api_lib.TurbiniaEvidenceApi(api_client) + evidence_id = None # object | + + try: + # Download By Evidence Id + api_response = api_instance.download_by_evidence_id(evidence_id) + print("The response of TurbiniaEvidenceApi->download_by_evidence_id:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TurbiniaEvidenceApi->download_by_evidence_id: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **evidence_id** | [**object**](.md)| | + +### Return type + +**bytearray** + +### Authorization + +[oAuth2](../README.md#oAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/octet-stream, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **get_evidence_attributes** > object get_evidence_attributes(evidence_type) diff --git a/turbinia/api/client/docs/TurbiniaLogsApi.md b/turbinia/api/client/docs/TurbiniaLogsApi.md index 2e30228cd..27ab0626b 100644 --- a/turbinia/api/client/docs/TurbiniaLogsApi.md +++ b/turbinia/api/client/docs/TurbiniaLogsApi.md @@ -4,13 +4,15 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- -[**get_logs**](TurbiniaLogsApi.md#get_logs) | **GET** /api/logs/{query} | Get Logs +[**get_api_server_logs**](TurbiniaLogsApi.md#get_api_server_logs) | **GET** /api/logs/api_server | Get Api Server Logs +[**get_server_logs**](TurbiniaLogsApi.md#get_server_logs) | **GET** /api/logs/server | Get Server Logs +[**get_turbinia_logs**](TurbiniaLogsApi.md#get_turbinia_logs) | **GET** /api/logs/{hostname} | Get Turbinia Logs -# **get_logs** -> object get_logs(query) +# **get_api_server_logs** +> str get_api_server_logs(num_lines=num_lines) -Get Logs +Get Api Server Logs Retrieve log data. @@ -41,15 +43,15 @@ configuration.access_token = os.environ["ACCESS_TOKEN"] with turbinia_api_lib.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = turbinia_api_lib.TurbiniaLogsApi(api_client) - query = 'query_example' # str | + num_lines = 500 # int | (optional) (default to 500) try: - # Get Logs - api_response = api_instance.get_logs(query) - print("The response of TurbiniaLogsApi->get_logs:\n") + # Get Api Server Logs + api_response = api_instance.get_api_server_logs(num_lines=num_lines) + print("The response of TurbiniaLogsApi->get_api_server_logs:\n") pprint(api_response) except Exception as e: - print("Exception when calling TurbiniaLogsApi->get_logs: %s\n" % e) + print("Exception when calling TurbiniaLogsApi->get_api_server_logs: %s\n" % e) ``` @@ -58,11 +60,11 @@ with turbinia_api_lib.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **query** | **str**| | + **num_lines** | **int**| | [optional] [default to 500] ### Return type -**object** +**str** ### Authorization @@ -71,7 +73,157 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json + - **Accept**: application/text, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_server_logs** +> str get_server_logs(num_lines=num_lines) + +Get Server Logs + +Retrieve log data. + +### Example + +* OAuth Authentication (oAuth2): +```python +import time +import os +import turbinia_api_lib +from turbinia_api_lib.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = turbinia_api_lib.Configuration( + host = "http://localhost" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with turbinia_api_lib.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = turbinia_api_lib.TurbiniaLogsApi(api_client) + num_lines = 500 # int | (optional) (default to 500) + + try: + # Get Server Logs + api_response = api_instance.get_server_logs(num_lines=num_lines) + print("The response of TurbiniaLogsApi->get_server_logs:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TurbiniaLogsApi->get_server_logs: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **num_lines** | **int**| | [optional] [default to 500] + +### Return type + +**str** + +### Authorization + +[oAuth2](../README.md#oAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/text, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_turbinia_logs** +> str get_turbinia_logs(hostname, num_lines=num_lines) + +Get Turbinia Logs + +Retrieve log data. Turbinia currently stores logs on plaintext files. The log files are named .log for each instance of a worker, server or API server. In some deployments, the same file can contain all logs (e.g. running all services locally in the same container). + +### Example + +* OAuth Authentication (oAuth2): +```python +import time +import os +import turbinia_api_lib +from turbinia_api_lib.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = turbinia_api_lib.Configuration( + host = "http://localhost" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with turbinia_api_lib.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = turbinia_api_lib.TurbiniaLogsApi(api_client) + hostname = 'hostname_example' # str | + num_lines = 500 # int | (optional) (default to 500) + + try: + # Get Turbinia Logs + api_response = api_instance.get_turbinia_logs(hostname, num_lines=num_lines) + print("The response of TurbiniaLogsApi->get_turbinia_logs:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TurbiniaLogsApi->get_turbinia_logs: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **hostname** | **str**| | + **num_lines** | **int**| | [optional] [default to 500] + +### Return type + +**str** + +### Authorization + +[oAuth2](../README.md#oAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/text, application/json ### HTTP response details | Status code | Description | Response headers | diff --git a/turbinia/api/client/docs/TurbiniaTasksApi.md b/turbinia/api/client/docs/TurbiniaTasksApi.md index 3f729c81b..2d63a3314 100644 --- a/turbinia/api/client/docs/TurbiniaTasksApi.md +++ b/turbinia/api/client/docs/TurbiniaTasksApi.md @@ -4,12 +4,87 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- +[**download_output_path**](TurbiniaTasksApi.md#download_output_path) | **GET** /api/download/output/{file_path} | Get Task Report [**get_task_report**](TurbiniaTasksApi.md#get_task_report) | **GET** /api/task/report/{task_id} | Get Task Report [**get_task_statistics**](TurbiniaTasksApi.md#get_task_statistics) | **GET** /api/task/statistics | Get Task Statistics [**get_task_status**](TurbiniaTasksApi.md#get_task_status) | **GET** /api/task/{task_id} | Get Task Status [**get_workers_status**](TurbiniaTasksApi.md#get_workers_status) | **GET** /api/task/workers | Get Workers Status +# **download_output_path** +> bytearray download_output_path(file_path) + +Get Task Report + +Download by path. Raises: HTTPException: if another exception is caught. + +### Example + +* OAuth Authentication (oAuth2): +```python +import time +import os +import turbinia_api_lib +from turbinia_api_lib.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = turbinia_api_lib.Configuration( + host = "http://localhost" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with turbinia_api_lib.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = turbinia_api_lib.TurbiniaTasksApi(api_client) + file_path = 'file_path_example' # str | + + try: + # Get Task Report + api_response = api_instance.download_output_path(file_path) + print("The response of TurbiniaTasksApi->download_output_path:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TurbiniaTasksApi->download_output_path: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **file_path** | **str**| | + +### Return type + +**bytearray** + +### Authorization + +[oAuth2](../README.md#oAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/octet-stream, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **get_task_report** > object get_task_report(task_id) diff --git a/turbinia/api/client/poetry.lock b/turbinia/api/client/poetry.lock index dbba78942..fe9ddce66 100644 --- a/turbinia/api/client/poetry.lock +++ b/turbinia/api/client/poetry.lock @@ -88,13 +88,13 @@ typing = ["typing-extensions (>=4.8)"] [[package]] name = "flake8" -version = "7.1.0" +version = "7.1.1" description = "the modular source code checker: pep8 pyflakes and co" optional = false python-versions = ">=3.8.1" files = [ - {file = "flake8-7.1.0-py2.py3-none-any.whl", hash = "sha256:2e416edcc62471a64cea09353f4e7bdba32aeb079b6e360554c659a122b1bc6a"}, - {file = "flake8-7.1.0.tar.gz", hash = "sha256:48a07b626b55236e0fb4784ee69a465fbf59d79eec1f5b4785c3d3bc57d17aa5"}, + {file = "flake8-7.1.1-py2.py3-none-any.whl", hash = "sha256:597477df7860daa5aa0fdd84bf5208a043ab96b8e96ab708770ae0364dd03213"}, + {file = "flake8-7.1.1.tar.gz", hash = "sha256:049d058491e228e03e67b390f311bbf88fce2dbaa8fa673e7aea87b7198b8d38"}, ] [package.dependencies] @@ -168,13 +168,13 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "pycodestyle" -version = "2.12.0" +version = "2.12.1" description = "Python style guide checker" optional = false python-versions = ">=3.8" files = [ - {file = "pycodestyle-2.12.0-py2.py3-none-any.whl", hash = "sha256:949a39f6b86c3e1515ba1787c2022131d165a8ad271b11370a8819aa070269e4"}, - {file = "pycodestyle-2.12.0.tar.gz", hash = "sha256:442f950141b4f43df752dd303511ffded3a04c2b6fb7f65980574f0c31e6e79c"}, + {file = "pycodestyle-2.12.1-py2.py3-none-any.whl", hash = "sha256:46f0fb92069a7c28ab7bb558f05bfc0110dac69a0cd23c61ea0040283a9d78b3"}, + {file = "pycodestyle-2.12.1.tar.gz", hash = "sha256:6838eae08bbce4f6accd5d5572075c63626a15ee3e6f842df996bf62f6d73521"}, ] [[package]] @@ -326,17 +326,17 @@ files = [ [[package]] name = "tox" -version = "4.16.0" +version = "4.17.1" description = "tox is a generic virtualenv management and test command line tool" optional = false python-versions = ">=3.8" files = [ - {file = "tox-4.16.0-py3-none-any.whl", hash = "sha256:61e101061b977b46cf00093d4319438055290ad0009f84497a07bf2d2d7a06d0"}, - {file = "tox-4.16.0.tar.gz", hash = "sha256:43499656f9949edb681c0f907f86fbfee98677af9919d8b11ae5ad77cb800748"}, + {file = "tox-4.17.1-py3-none-any.whl", hash = "sha256:2974597c0353577126ab014f52d1a399fb761049e165ff34427f84e8cfe6c990"}, + {file = "tox-4.17.1.tar.gz", hash = "sha256:2c41565a571e34480bd401d668a4899806169a4633e972ac296c54406d2ded8a"}, ] [package.dependencies] -cachetools = ">=5.3.3" +cachetools = ">=5.4" chardet = ">=5.2" colorama = ">=0.4.6" filelock = ">=3.15.4" @@ -348,8 +348,8 @@ tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""} virtualenv = ">=20.26.3" [package.extras] -docs = ["furo (>=2024.5.6)", "sphinx (>=7.3.7)", "sphinx-argparse-cli (>=1.16)", "sphinx-autodoc-typehints (>=2.2.2)", "sphinx-copybutton (>=0.5.2)", "sphinx-inline-tabs (>=2023.4.21)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.11)"] -testing = ["build[virtualenv] (>=1.2.1)", "covdefaults (>=2.3)", "detect-test-pollution (>=1.2)", "devpi-process (>=1)", "diff-cover (>=9.1)", "distlib (>=0.3.8)", "flaky (>=3.8.1)", "hatch-vcs (>=0.4)", "hatchling (>=1.25)", "psutil (>=6)", "pytest (>=8.2.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)", "pytest-xdist (>=3.6.1)", "re-assert (>=1.1)", "setuptools (>=70.2)", "time-machine (>=2.14.2)", "wheel (>=0.43)"] +docs = ["furo (>=2024.7.18)", "sphinx (>=7.4.7)", "sphinx-argparse-cli (>=1.16)", "sphinx-autodoc-typehints (>=2.2.3)", "sphinx-copybutton (>=0.5.2)", "sphinx-inline-tabs (>=2023.4.21)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.11)"] +testing = ["build[virtualenv] (>=1.2.1)", "covdefaults (>=2.3)", "detect-test-pollution (>=1.2)", "devpi-process (>=1)", "diff-cover (>=9.1.1)", "distlib (>=0.3.8)", "flaky (>=3.8.1)", "hatch-vcs (>=0.4)", "hatchling (>=1.25)", "psutil (>=6)", "pytest (>=8.3.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)", "pytest-xdist (>=3.6.1)", "re-assert (>=1.1)", "setuptools (>=70.3)", "time-machine (>=2.14.2)", "wheel (>=0.43)"] [[package]] name = "typing-extensions" diff --git a/turbinia/api/client/pyproject.toml b/turbinia/api/client/pyproject.toml index 274e6c2b8..2047de99d 100644 --- a/turbinia/api/client/pyproject.toml +++ b/turbinia/api/client/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "turbinia-api-lib" -version = "1.0.5" +version = "1.0.6" description = "Turbinia API Server" authors = ["OpenAPI Generator Community "] license = "Apache License 2.0" diff --git a/turbinia/api/client/turbinia_api_lib/api/turbinia_evidence_api.py b/turbinia/api/client/turbinia_api_lib/api/turbinia_evidence_api.py index 1a5aadf50..451dbfe8b 100644 --- a/turbinia/api/client/turbinia_api_lib/api/turbinia_evidence_api.py +++ b/turbinia/api/client/turbinia_api_lib/api/turbinia_evidence_api.py @@ -43,6 +43,147 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_arguments + def download_by_evidence_id(self, evidence_id : Any, **kwargs) -> bytearray: # noqa: E501 + """Download By Evidence Id # noqa: E501 + + Retrieves an evidence in Redis by using its UUID. Args: evidence_id (str): The UUID of the evidence. Raises: HTTPException: if the evidence is not found. Returns: FileResponse: The evidence file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.download_by_evidence_id(evidence_id, async_req=True) + >>> result = thread.get() + + :param evidence_id: (required) + :type evidence_id: object + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: bytearray + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the download_by_evidence_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.download_by_evidence_id_with_http_info(evidence_id, **kwargs) # noqa: E501 + + @validate_arguments + def download_by_evidence_id_with_http_info(self, evidence_id : Any, **kwargs) -> ApiResponse: # noqa: E501 + """Download By Evidence Id # noqa: E501 + + Retrieves an evidence in Redis by using its UUID. Args: evidence_id (str): The UUID of the evidence. Raises: HTTPException: if the evidence is not found. Returns: FileResponse: The evidence file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.download_by_evidence_id_with_http_info(evidence_id, async_req=True) + >>> result = thread.get() + + :param evidence_id: (required) + :type evidence_id: object + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(bytearray, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'evidence_id' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method download_by_evidence_id" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['evidence_id'] is not None: + _path_params['evidence_id'] = _params['evidence_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/octet-stream', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['oAuth2'] # noqa: E501 + + _response_types_map = { + '200': "bytearray", + '422': "HTTPValidationError", + } + + return self.api_client.call_api( + '/api/evidence/download/{evidence_id}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments def get_evidence_attributes(self, evidence_type : Any, **kwargs) -> object: # noqa: E501 """Get Evidence Attributes # noqa: E501 diff --git a/turbinia/api/client/turbinia_api_lib/api/turbinia_logs_api.py b/turbinia/api/client/turbinia_api_lib/api/turbinia_logs_api.py index 18884431a..a4a10d6ad 100644 --- a/turbinia/api/client/turbinia_api_lib/api/turbinia_logs_api.py +++ b/turbinia/api/client/turbinia_api_lib/api/turbinia_logs_api.py @@ -18,9 +18,9 @@ from pydantic import validate_arguments, ValidationError -from pydantic import StrictStr +from pydantic import StrictInt, StrictStr -from typing import Any +from typing import Optional from turbinia_api_lib.api_client import ApiClient @@ -44,18 +44,18 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client @validate_arguments - def get_logs(self, query : StrictStr, **kwargs) -> object: # noqa: E501 - """Get Logs # noqa: E501 + def get_api_server_logs(self, num_lines : Optional[StrictInt] = None, **kwargs) -> str: # noqa: E501 + """Get Api Server Logs # noqa: E501 Retrieve log data. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_logs(query, async_req=True) + >>> thread = api.get_api_server_logs(num_lines, async_req=True) >>> result = thread.get() - :param query: (required) - :type query: str + :param num_lines: + :type num_lines: int :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _request_timeout: timeout setting for this request. @@ -65,27 +65,27 @@ def get_logs(self, query : StrictStr, **kwargs) -> object: # noqa: E501 :return: Returns the result object. If the method is called asynchronously, returns the request thread. - :rtype: object + :rtype: str """ kwargs['_return_http_data_only'] = True if '_preload_content' in kwargs: - message = "Error! Please call the get_logs_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + message = "Error! Please call the get_api_server_logs_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 raise ValueError(message) - return self.get_logs_with_http_info(query, **kwargs) # noqa: E501 + return self.get_api_server_logs_with_http_info(num_lines, **kwargs) # noqa: E501 @validate_arguments - def get_logs_with_http_info(self, query : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 - """Get Logs # noqa: E501 + def get_api_server_logs_with_http_info(self, num_lines : Optional[StrictInt] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get Api Server Logs # noqa: E501 Retrieve log data. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_logs_with_http_info(query, async_req=True) + >>> thread = api.get_api_server_logs_with_http_info(num_lines, async_req=True) >>> result = thread.get() - :param query: (required) - :type query: str + :param num_lines: + :type num_lines: int :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _preload_content: if False, the ApiResponse.data will @@ -108,13 +108,13 @@ def get_logs_with_http_info(self, query : StrictStr, **kwargs) -> ApiResponse: :return: Returns the result object. If the method is called asynchronously, returns the request thread. - :rtype: tuple(object, status_code(int), headers(HTTPHeaderDict)) + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) """ _params = locals() _all_params = [ - 'query' + 'num_lines' ] _all_params.extend( [ @@ -133,7 +133,7 @@ def get_logs_with_http_info(self, query : StrictStr, **kwargs) -> ApiResponse: if _key not in _all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_logs" % _key + " to method get_api_server_logs" % _key ) _params[_key] = _val del _params['kwargs'] @@ -142,12 +142,302 @@ def get_logs_with_http_info(self, query : StrictStr, **kwargs) -> ApiResponse: # process the path parameters _path_params = {} - if _params['query'] is not None: - _path_params['query'] = _params['query'] + # process the query parameters + _query_params = [] + if _params.get('num_lines') is not None: # noqa: E501 + _query_params.append(('num_lines', _params['num_lines'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/text', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['oAuth2'] # noqa: E501 + + _response_types_map = { + '200': "str", + '422': "HTTPValidationError", + } + + return self.api_client.call_api( + '/api/logs/api_server', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def get_server_logs(self, num_lines : Optional[StrictInt] = None, **kwargs) -> str: # noqa: E501 + """Get Server Logs # noqa: E501 + + Retrieve log data. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_server_logs(num_lines, async_req=True) + >>> result = thread.get() + + :param num_lines: + :type num_lines: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the get_server_logs_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.get_server_logs_with_http_info(num_lines, **kwargs) # noqa: E501 + + @validate_arguments + def get_server_logs_with_http_info(self, num_lines : Optional[StrictInt] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get Server Logs # noqa: E501 + + Retrieve log data. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_server_logs_with_http_info(num_lines, async_req=True) + >>> result = thread.get() + + :param num_lines: + :type num_lines: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'num_lines' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_server_logs" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} # process the query parameters _query_params = [] + if _params.get('num_lines') is not None: # noqa: E501 + _query_params.append(('num_lines', _params['num_lines'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/text', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['oAuth2'] # noqa: E501 + + _response_types_map = { + '200': "str", + '422': "HTTPValidationError", + } + + return self.api_client.call_api( + '/api/logs/server', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def get_turbinia_logs(self, hostname : StrictStr, num_lines : Optional[StrictInt] = None, **kwargs) -> str: # noqa: E501 + """Get Turbinia Logs # noqa: E501 + + Retrieve log data. Turbinia currently stores logs on plaintext files. The log files are named .log for each instance of a worker, server or API server. In some deployments, the same file can contain all logs (e.g. running all services locally in the same container). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_turbinia_logs(hostname, num_lines, async_req=True) + >>> result = thread.get() + + :param hostname: (required) + :type hostname: str + :param num_lines: + :type num_lines: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the get_turbinia_logs_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.get_turbinia_logs_with_http_info(hostname, num_lines, **kwargs) # noqa: E501 + + @validate_arguments + def get_turbinia_logs_with_http_info(self, hostname : StrictStr, num_lines : Optional[StrictInt] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get Turbinia Logs # noqa: E501 + + Retrieve log data. Turbinia currently stores logs on plaintext files. The log files are named .log for each instance of a worker, server or API server. In some deployments, the same file can contain all logs (e.g. running all services locally in the same container). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_turbinia_logs_with_http_info(hostname, num_lines, async_req=True) + >>> result = thread.get() + + :param hostname: (required) + :type hostname: str + :param num_lines: + :type num_lines: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'hostname', + 'num_lines' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_turbinia_logs" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['hostname'] is not None: + _path_params['hostname'] = _params['hostname'] + + + # process the query parameters + _query_params = [] + if _params.get('num_lines') is not None: # noqa: E501 + _query_params.append(('num_lines', _params['num_lines'])) + # process the header parameters _header_params = dict(_params.get('_headers', {})) # process the form parameters @@ -157,18 +447,18 @@ def get_logs_with_http_info(self, query : StrictStr, **kwargs) -> ApiResponse: _body_params = None # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + ['application/text', 'application/json']) # noqa: E501 # authentication setting _auth_settings = ['oAuth2'] # noqa: E501 _response_types_map = { - '200': "object", + '200': "str", '422': "HTTPValidationError", } return self.api_client.call_api( - '/api/logs/{query}', 'GET', + '/api/logs/{hostname}', 'GET', _path_params, _query_params, _header_params, diff --git a/turbinia/api/client/turbinia_api_lib/api/turbinia_tasks_api.py b/turbinia/api/client/turbinia_api_lib/api/turbinia_tasks_api.py index 56bda6256..c4fac1733 100644 --- a/turbinia/api/client/turbinia_api_lib/api/turbinia_tasks_api.py +++ b/turbinia/api/client/turbinia_api_lib/api/turbinia_tasks_api.py @@ -20,7 +20,7 @@ from pydantic import StrictBool, StrictInt, StrictStr -from typing import Any, Optional +from typing import Any, Optional, Union from turbinia_api_lib.models.complete_turbinia_stats import CompleteTurbiniaStats @@ -44,6 +44,147 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_arguments + def download_output_path(self, file_path : StrictStr, **kwargs) -> bytearray: # noqa: E501 + """Get Task Report # noqa: E501 + + Download by path. Raises: HTTPException: if another exception is caught. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.download_output_path(file_path, async_req=True) + >>> result = thread.get() + + :param file_path: (required) + :type file_path: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: bytearray + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the download_output_path_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.download_output_path_with_http_info(file_path, **kwargs) # noqa: E501 + + @validate_arguments + def download_output_path_with_http_info(self, file_path : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 + """Get Task Report # noqa: E501 + + Download by path. Raises: HTTPException: if another exception is caught. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.download_output_path_with_http_info(file_path, async_req=True) + >>> result = thread.get() + + :param file_path: (required) + :type file_path: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(bytearray, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'file_path' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method download_output_path" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['file_path'] is not None: + _path_params['file_path'] = _params['file_path'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/octet-stream', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['oAuth2'] # noqa: E501 + + _response_types_map = { + '200': "bytearray", + '422': "HTTPValidationError", + } + + return self.api_client.call_api( + '/api/download/output/{file_path}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments def get_task_report(self, task_id : StrictStr, **kwargs) -> object: # noqa: E501 """Get Task Report # noqa: E501