Skip to content

Commit

Permalink
Update client library
Browse files Browse the repository at this point in the history
  • Loading branch information
jleaniz committed Aug 1, 2024
1 parent 5a142cc commit a8204b3
Show file tree
Hide file tree
Showing 4 changed files with 244 additions and 0 deletions.
1 change: 1 addition & 0 deletions turbinia/api/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,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* | [**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
*TurbiniaTasksApi* | [**get_workers_status**](docs/TurbiniaTasksApi.md#get_workers_status) | **GET** /api/task/workers | Get Workers Status
Expand Down
75 changes: 75 additions & 0 deletions turbinia/api/client/docs/TurbiniaTasksApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,86 @@ All URIs are relative to *http://localhost*

Method | HTTP request | Description
------------- | ------------- | -------------
[**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


# **get_task_report**
> object get_task_report(task_id)
Get Task Report

Retrieves the MarkDown report of a Turbinia task. 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)
task_id = 'task_id_example' # str |

try:
# Get Task Report
api_response = api_instance.get_task_report(task_id)
print("The response of TurbiniaTasksApi->get_task_report:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling TurbiniaTasksApi->get_task_report: %s\n" % e)
```



### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**task_id** | **str**| |

### Return type

**object**

### Authorization

[oAuth2](../README.md#oAuth2)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: 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_statistics**
> CompleteTurbiniaStats get_task_statistics(days=days, task_id=task_id, request_id=request_id, user=user)
Expand Down
141 changes: 141 additions & 0 deletions turbinia/api/client/turbinia_api_lib/api/turbinia_tasks_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,147 @@ def __init__(self, api_client=None) -> None:
api_client = ApiClient.get_default()
self.api_client = api_client

@validate_arguments
def get_task_report(self, task_id : StrictStr, **kwargs) -> object: # noqa: E501
"""Get Task Report # noqa: E501
Retrieves the MarkDown report of a Turbinia task. 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.get_task_report(task_id, async_req=True)
>>> result = thread.get()
:param task_id: (required)
:type task_id: 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: object
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
message = "Error! Please call the get_task_report_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.get_task_report_with_http_info(task_id, **kwargs) # noqa: E501

@validate_arguments
def get_task_report_with_http_info(self, task_id : StrictStr, **kwargs) -> ApiResponse: # noqa: E501
"""Get Task Report # noqa: E501
Retrieves the MarkDown report of a Turbinia task. 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.get_task_report_with_http_info(task_id, async_req=True)
>>> result = thread.get()
:param task_id: (required)
:type task_id: 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(object, status_code(int), headers(HTTPHeaderDict))
"""

_params = locals()

_all_params = [
'task_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 get_task_report" % _key
)
_params[_key] = _val
del _params['kwargs']

_collection_formats = {}

# process the path parameters
_path_params = {}
if _params['task_id'] is not None:
_path_params['task_id'] = _params['task_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/json']) # noqa: E501

# authentication setting
_auth_settings = ['oAuth2'] # noqa: E501

_response_types_map = {
'200': "object",
'422': "HTTPValidationError",
}

return self.api_client.call_api(
'/api/task/report/{task_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_task_statistics(self, days : Optional[StrictInt] = None, task_id : Optional[StrictStr] = None, request_id : Optional[StrictStr] = None, user : Optional[StrictStr] = None, **kwargs) -> CompleteTurbiniaStats: # noqa: E501
"""Get Task Statistics # noqa: E501
Expand Down
27 changes: 27 additions & 0 deletions turbinia/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,33 @@ paths:
summary: Get Task Output
tags:
- Turbinia Request Results
/api/task/report/{task_id}:
get:
description: "Retrieves the MarkDown report of a Turbinia task.\n\nRaises:\n\
\ HTTPException: if another exception is caught."
operationId: get_task_report
parameters:
- in: path
name: task_id
required: true
schema:
title: Task Id
type: string
responses:
'200':
content:
application/json:
schema: {}
description: Successful Response
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
description: Validation Error
summary: Get Task Report
tags:
- Turbinia Tasks
/api/task/statistics:
get:
description: "Retrieves statistics for Turbinia execution.\n\nArgs:\n days\
Expand Down

0 comments on commit a8204b3

Please sign in to comment.