From ebe0a09fc85fab796c90efb346f5e4c3cfde2181 Mon Sep 17 00:00:00 2001 From: dtavori Date: Thu, 26 Dec 2019 13:27:04 +0200 Subject: [PATCH 1/4] fixed integration_upload added entry_execute_sync --- demisto_client/demisto_api/api/default_api.py | 119 ++++++++++++++++-- docs/DefaultApi.md | 57 ++++++++- docs/README.md | 1 + server_api_swagger.json | 41 +++++- 4 files changed, 199 insertions(+), 19 deletions(-) diff --git a/demisto_client/demisto_api/api/default_api.py b/demisto_client/demisto_api/api/default_api.py index b89529e..f83105e 100644 --- a/demisto_client/demisto_api/api/default_api.py +++ b/demisto_client/demisto_api/api/default_api.py @@ -4501,39 +4501,39 @@ def indicators_search_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def integration_upload(self, **kwargs): # noqa: E501 + def integration_upload(self, file, **kwargs): # noqa: E501 """Upload an integration # noqa: E501 Upload an integration to Demisto # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.integration_upload(async_req=True) + >>> thread = api.integration_upload(file, async_req=True) >>> result = thread.get() :param async_req bool - :param ModuleConfiguration file: + :param file file: file (required) :return: ModuleConfiguration If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.integration_upload_with_http_info(**kwargs) # noqa: E501 + return self.integration_upload_with_http_info(file, **kwargs) # noqa: E501 else: - (data) = self.integration_upload_with_http_info(**kwargs) # noqa: E501 + (data) = self.integration_upload_with_http_info(file, **kwargs) # noqa: E501 return data - def integration_upload_with_http_info(self, **kwargs): # noqa: E501 + def integration_upload_with_http_info(self, file, **kwargs): # noqa: E501 """Upload an integration # noqa: E501 Upload an integration to Demisto # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.integration_upload_with_http_info(async_req=True) + >>> thread = api.integration_upload_with_http_info(file, async_req=True) >>> result = thread.get() :param async_req bool - :param ModuleConfiguration file: + :param file file: file (required) :return: ModuleConfiguration If the method is called asynchronously, returns the request thread. @@ -4554,6 +4554,10 @@ def integration_upload_with_http_info(self, **kwargs): # noqa: E501 ) params[key] = val del params['kwargs'] + # verify the required parameter 'file' is set + if ('file' not in params or + params['file'] is None): + raise ValueError("Missing the required parameter `file` when calling `integration_upload`") # noqa: E501 collection_formats = {} @@ -4565,10 +4569,10 @@ def integration_upload_with_http_info(self, **kwargs): # noqa: E501 form_params = [] local_var_files = {} + if 'file' in params: + local_var_files['file'] = params['file'] # noqa: E501 body_params = None - if 'file' in params: - body_params = params['file'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 @@ -4596,6 +4600,101 @@ def integration_upload_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + def investigation_add_entries_sync_handler(self, **kwargs): # noqa: E501 + """Create new entry in existing investigation # noqa: E501 + + API to create an entry (markdown format) in existing investigation Body example: {\"investigationId\":\"1234\",\"data\":\"entry content…\"} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.investigation_add_entries_sync_handler(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param UpdateEntry update_entry: + :return: list[Entry] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.investigation_add_entries_sync_handler_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.investigation_add_entries_sync_handler_with_http_info(**kwargs) # noqa: E501 + return data + + def investigation_add_entries_sync_handler_with_http_info(self, **kwargs): # noqa: E501 + """Create new entry in existing investigation # noqa: E501 + + API to create an entry (markdown format) in existing investigation Body example: {\"investigationId\":\"1234\",\"data\":\"entry content…\"} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.investigation_add_entries_sync_handler_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param UpdateEntry update_entry: + :return: list[Entry] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['update_entry'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method investigation_add_entries_sync_handler" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'update_entry' in params: + body_params = params['update_entry'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json', 'application/xml']) # noqa: E501 + + # Authentication setting + auth_settings = ['api_key', 'csrf_token'] # noqa: E501 + + return self.api_client.call_api( + '/entry/execute/sync', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Entry]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + def investigation_add_entry_handler(self, **kwargs): # noqa: E501 """Create new entry in existing investigation # noqa: E501 diff --git a/docs/DefaultApi.md b/docs/DefaultApi.md index c9e52cd..0b173e9 100644 --- a/docs/DefaultApi.md +++ b/docs/DefaultApi.md @@ -50,6 +50,7 @@ Method | HTTP request | Description [**indicators_edit**](DefaultApi.md#indicators_edit) | **POST** /indicator/edit | Edit Indicator [**indicators_search**](DefaultApi.md#indicators_search) | **POST** /indicators/search | Search indicators [**integration_upload**](DefaultApi.md#integration_upload) | **POST** /settings/integration-conf/upload | Upload an integration +[**investigation_add_entries_sync_handler**](DefaultApi.md#investigation_add_entries_sync_handler) | **POST** /entry/execute/sync | Create new entry in existing investigation [**investigation_add_entry_handler**](DefaultApi.md#investigation_add_entry_handler) | **POST** /entry | Create new entry in existing investigation [**investigation_add_formatted_entry_handler**](DefaultApi.md#investigation_add_formatted_entry_handler) | **POST** /entry/formatted | Create new formatted entry in existing investigation [**revoke_user_api_key**](DefaultApi.md#revoke_user_api_key) | **POST** /apikeys/revoke/user/{username} | @@ -2248,7 +2249,7 @@ Name | Type | Description | Notes [[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) # **integration_upload** -> ModuleConfiguration integration_upload(file=file) +> ModuleConfiguration integration_upload(file) Upload an integration @@ -2264,11 +2265,11 @@ from demisto_client.demisto_api.rest import ApiException from pprint import pprint api_instance = demisto_client.configure(base_url="https://YOUR_DEMISTO_SERVER", api_key="YOUR_API_KEY") -file = demisto_client.demisto_api.ModuleConfiguration() # ModuleConfiguration | (optional) +file = '/path/to/file.txt' # file | file try: # Upload an integration - api_response = api_instance.integration_upload(file=file) + api_response = api_instance.integration_upload(file) pprint(api_response) except ApiException as e: print("Exception when calling DefaultApi->integration_upload: %s\n" % e) @@ -2278,7 +2279,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **file** | [**ModuleConfiguration**](ModuleConfiguration.md)| | [optional] + **file** | **file**| file | ### Return type @@ -2295,6 +2296,54 @@ Name | Type | Description | Notes [[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) +# **investigation_add_entries_sync_handler** +> list[Entry] investigation_add_entries_sync_handler(update_entry=update_entry) + +Create new entry in existing investigation + +API to create an entry (markdown format) in existing investigation Body example: {\"investigationId\":\"1234\",\"data\":\"entry content…\"} + +### Example +```python +from __future__ import print_function +import time +import demisto_client +import demisto_client.demisto_api +from demisto_client.demisto_api.rest import ApiException +from pprint import pprint + +api_instance = demisto_client.configure(base_url="https://YOUR_DEMISTO_SERVER", api_key="YOUR_API_KEY") +update_entry = demisto_client.demisto_api.UpdateEntry() # UpdateEntry | (optional) + +try: + # Create new entry in existing investigation + api_response = api_instance.investigation_add_entries_sync_handler(update_entry=update_entry) + pprint(api_response) +except ApiException as e: + print("Exception when calling DefaultApi->investigation_add_entries_sync_handler: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **update_entry** | [**UpdateEntry**](UpdateEntry.md)| | [optional] + +### Return type + +[**list[Entry]**](Entry.md) + +### Authorization + +[api_key](README.md#api_key), [csrf_token](README.md#csrf_token) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/json + +[[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) + # **investigation_add_entry_handler** > Entry investigation_add_entry_handler(update_entry=update_entry) diff --git a/docs/README.md b/docs/README.md index a2ec53d..71a47ac 100644 --- a/docs/README.md +++ b/docs/README.md @@ -50,6 +50,7 @@ Method | HTTP request | Description [**indicators_edit**](DefaultApi.md#indicators_edit) | **POST** /indicator/edit | Edit Indicator [**indicators_search**](DefaultApi.md#indicators_search) | **POST** /indicators/search | Search indicators [**integration_upload**](DefaultApi.md#integration_upload) | **POST** /settings/integration-conf/upload | Upload an integration +[**investigation_add_entries_sync_handler**](DefaultApi.md#investigation_add_entries_sync_handler) | **POST** /entry/execute/sync | Create new entry in existing investigation [**investigation_add_entry_handler**](DefaultApi.md#investigation_add_entry_handler) | **POST** /entry | Create new entry in existing investigation [**investigation_add_formatted_entry_handler**](DefaultApi.md#investigation_add_formatted_entry_handler) | **POST** /entry/formatted | Create new formatted entry in existing investigation [**revoke_user_api_key**](DefaultApi.md#revoke_user_api_key) | **POST** /apikeys/revoke/user/{username} | diff --git a/server_api_swagger.json b/server_api_swagger.json index cf30c2b..c57c3b7 100644 --- a/server_api_swagger.json +++ b/server_api_swagger.json @@ -214,6 +214,36 @@ } } }, + "/entry/execute/sync": { + "post": { + "description": "API to create an entry (markdown format) in existing investigation\nBody example: {\"investigationId\":\"1234\",\"data\":\"entry content…\"}", + "summary": "Create new entry in existing investigation", + "operationId": "investigationAddEntriesSyncHandler", + "parameters": [ + { + "name": "updateEntry", + "in": "body", + "schema": { + "$ref": "#/definitions/updateEntry" + } + } + ], + "responses": { + "200": { + "description": "An array of the children entries of the executed entry.", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Entry" + } + } + }, + "412": { + "description": "In case of closed investigation" + } + } + } + }, "/entry/exportArtifact": { "post": { "description": "Export an entry artifact", @@ -1421,11 +1451,11 @@ "operationId": "integrationUpload", "parameters": [ { + "type": "file", + "description": "file", "name": "file", - "in": "body", - "schema": { - "$ref": "#/definitions/ModuleConfiguration" - } + "in": "formData", + "required": true } ], "responses": { @@ -8520,4 +8550,5 @@ "csrf_token": [] } ] -} \ No newline at end of file +} + From eba40d9c86c0ce09d47628ee3257d64e11b7f731 Mon Sep 17 00:00:00 2001 From: dtavori Date: Thu, 26 Dec 2019 13:34:00 +0200 Subject: [PATCH 2/4] fixed integration_upload added entry_execute_sync --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc6f3a3..d80259c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ [1]: https://pypi.org/project/demisto-py/#history ## 2.0.7 +* Added `investigation_add_entries_sync_handler` method creating a new entry in existing investigation. * Added `download_file` method for downloading files by entry id. * Added `integration_upload` method for uploading integrations to Demisto. From 1b9c14d406c751654d775a4e6052607385cb6d65 Mon Sep 17 00:00:00 2001 From: Dan Tavori <38749041+dantavori@users.noreply.github.com> Date: Thu, 26 Dec 2019 13:58:44 +0200 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d80259c..886bd23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ [1]: https://pypi.org/project/demisto-py/#history ## 2.0.7 -* Added `investigation_add_entries_sync_handler` method creating a new entry in existing investigation. +* Added `investigation_add_entries_sync_handler` method for creating a new entry in existing investigation. * Added `download_file` method for downloading files by entry id. * Added `integration_upload` method for uploading integrations to Demisto. From e5effe2bc835cb7342d33bb1a3446f37fb32078d Mon Sep 17 00:00:00 2001 From: dtavori Date: Fri, 27 Dec 2019 19:11:46 +0200 Subject: [PATCH 4/4] fixed integration_upload added entry_execute_sync --- CHANGELOG.md | 2 +- demisto_client/demisto_api/api/default_api.py | 14 +++++++------- docs/DefaultApi.md | 10 +++++----- docs/README.md | 2 +- server_api_swagger.json | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d80259c..2663a6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ [1]: https://pypi.org/project/demisto-py/#history ## 2.0.7 -* Added `investigation_add_entries_sync_handler` method creating a new entry in existing investigation. +* Added `investigation_add_entries_sync` method creating a new entry in existing investigation. * Added `download_file` method for downloading files by entry id. * Added `integration_upload` method for uploading integrations to Demisto. diff --git a/demisto_client/demisto_api/api/default_api.py b/demisto_client/demisto_api/api/default_api.py index f83105e..7fb6d1d 100644 --- a/demisto_client/demisto_api/api/default_api.py +++ b/demisto_client/demisto_api/api/default_api.py @@ -4600,13 +4600,13 @@ def integration_upload_with_http_info(self, file, **kwargs): # noqa: E501 _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def investigation_add_entries_sync_handler(self, **kwargs): # noqa: E501 + def investigation_add_entries_sync(self, **kwargs): # noqa: E501 """Create new entry in existing investigation # noqa: E501 API to create an entry (markdown format) in existing investigation Body example: {\"investigationId\":\"1234\",\"data\":\"entry content…\"} # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.investigation_add_entries_sync_handler(async_req=True) + >>> thread = api.investigation_add_entries_sync(async_req=True) >>> result = thread.get() :param async_req bool @@ -4617,18 +4617,18 @@ def investigation_add_entries_sync_handler(self, **kwargs): # noqa: E501 """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.investigation_add_entries_sync_handler_with_http_info(**kwargs) # noqa: E501 + return self.investigation_add_entries_sync_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.investigation_add_entries_sync_handler_with_http_info(**kwargs) # noqa: E501 + (data) = self.investigation_add_entries_sync_with_http_info(**kwargs) # noqa: E501 return data - def investigation_add_entries_sync_handler_with_http_info(self, **kwargs): # noqa: E501 + def investigation_add_entries_sync_with_http_info(self, **kwargs): # noqa: E501 """Create new entry in existing investigation # noqa: E501 API to create an entry (markdown format) in existing investigation Body example: {\"investigationId\":\"1234\",\"data\":\"entry content…\"} # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.investigation_add_entries_sync_handler_with_http_info(async_req=True) + >>> thread = api.investigation_add_entries_sync_with_http_info(async_req=True) >>> result = thread.get() :param async_req bool @@ -4649,7 +4649,7 @@ def investigation_add_entries_sync_handler_with_http_info(self, **kwargs): # no if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method investigation_add_entries_sync_handler" % key + " to method investigation_add_entries_sync" % key ) params[key] = val del params['kwargs'] diff --git a/docs/DefaultApi.md b/docs/DefaultApi.md index 0b173e9..40e8f02 100644 --- a/docs/DefaultApi.md +++ b/docs/DefaultApi.md @@ -50,7 +50,7 @@ Method | HTTP request | Description [**indicators_edit**](DefaultApi.md#indicators_edit) | **POST** /indicator/edit | Edit Indicator [**indicators_search**](DefaultApi.md#indicators_search) | **POST** /indicators/search | Search indicators [**integration_upload**](DefaultApi.md#integration_upload) | **POST** /settings/integration-conf/upload | Upload an integration -[**investigation_add_entries_sync_handler**](DefaultApi.md#investigation_add_entries_sync_handler) | **POST** /entry/execute/sync | Create new entry in existing investigation +[**investigation_add_entries_sync**](DefaultApi.md#investigation_add_entries_sync) | **POST** /entry/execute/sync | Create new entry in existing investigation [**investigation_add_entry_handler**](DefaultApi.md#investigation_add_entry_handler) | **POST** /entry | Create new entry in existing investigation [**investigation_add_formatted_entry_handler**](DefaultApi.md#investigation_add_formatted_entry_handler) | **POST** /entry/formatted | Create new formatted entry in existing investigation [**revoke_user_api_key**](DefaultApi.md#revoke_user_api_key) | **POST** /apikeys/revoke/user/{username} | @@ -2296,8 +2296,8 @@ Name | Type | Description | Notes [[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) -# **investigation_add_entries_sync_handler** -> list[Entry] investigation_add_entries_sync_handler(update_entry=update_entry) +# **investigation_add_entries_sync** +> list[Entry] investigation_add_entries_sync(update_entry=update_entry) Create new entry in existing investigation @@ -2317,10 +2317,10 @@ update_entry = demisto_client.demisto_api.UpdateEntry() # UpdateEntry | (option try: # Create new entry in existing investigation - api_response = api_instance.investigation_add_entries_sync_handler(update_entry=update_entry) + api_response = api_instance.investigation_add_entries_sync(update_entry=update_entry) pprint(api_response) except ApiException as e: - print("Exception when calling DefaultApi->investigation_add_entries_sync_handler: %s\n" % e) + print("Exception when calling DefaultApi->investigation_add_entries_sync: %s\n" % e) ``` ### Parameters diff --git a/docs/README.md b/docs/README.md index 71a47ac..49880b7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -50,7 +50,7 @@ Method | HTTP request | Description [**indicators_edit**](DefaultApi.md#indicators_edit) | **POST** /indicator/edit | Edit Indicator [**indicators_search**](DefaultApi.md#indicators_search) | **POST** /indicators/search | Search indicators [**integration_upload**](DefaultApi.md#integration_upload) | **POST** /settings/integration-conf/upload | Upload an integration -[**investigation_add_entries_sync_handler**](DefaultApi.md#investigation_add_entries_sync_handler) | **POST** /entry/execute/sync | Create new entry in existing investigation +[**investigation_add_entries_sync**](DefaultApi.md#investigation_add_entries_sync) | **POST** /entry/execute/sync | Create new entry in existing investigation [**investigation_add_entry_handler**](DefaultApi.md#investigation_add_entry_handler) | **POST** /entry | Create new entry in existing investigation [**investigation_add_formatted_entry_handler**](DefaultApi.md#investigation_add_formatted_entry_handler) | **POST** /entry/formatted | Create new formatted entry in existing investigation [**revoke_user_api_key**](DefaultApi.md#revoke_user_api_key) | **POST** /apikeys/revoke/user/{username} | diff --git a/server_api_swagger.json b/server_api_swagger.json index c57c3b7..ac962a7 100644 --- a/server_api_swagger.json +++ b/server_api_swagger.json @@ -218,7 +218,7 @@ "post": { "description": "API to create an entry (markdown format) in existing investigation\nBody example: {\"investigationId\":\"1234\",\"data\":\"entry content…\"}", "summary": "Create new entry in existing investigation", - "operationId": "investigationAddEntriesSyncHandler", + "operationId": "investigationAddEntriesSync", "parameters": [ { "name": "updateEntry",