diff --git a/CHANGELOG.md b/CHANGELOG.md index 47a2d326..aa4db6bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ [PyPI History](https://pypi.org/project/demisto-py/#history) +## 3.2.16 +* Added support `upload_custom_packs` to upload zipped custom packs to the marketplace. + + Note: `upload_content_packs` will be deprecated from XSOAR 8.9 and XSIAM 2.5. + ## 3.2.14 * Added support for Python versions 3.11 and 3.12. diff --git a/demisto_client/demisto_api/api/default_api.py b/demisto_client/demisto_api/api/default_api.py index 84cb5d3a..beefa231 100644 --- a/demisto_client/demisto_api/api/default_api.py +++ b/demisto_client/demisto_api/api/default_api.py @@ -7265,7 +7265,7 @@ def update_entry_tags_op_with_http_info(self, **kwargs): # noqa: E501 def upload_content_packs(self, file, **kwargs): # noqa: E501 """Upload a Pack as zip file. The zip file maybe a single Pack or a zip containing multiple zipped Packs (a zip of zips) # noqa: E501 - Upload a Pack to the marketplace in the Server. Can be used to upload a Pack for an offline scenario or a Pack that hasn't been released. # noqa: E501 + Upload a Pack to the marketplace in the Server. Can be used to upload a Pack for an offline scenario or a Pack that hasn't been released. (will be deprecated from XSOAR 8.9 and XSIAM 2.5) # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.upload_content_packs(file, async_req=True) @@ -7289,7 +7289,7 @@ def upload_content_packs(self, file, **kwargs): # noqa: E501 def upload_content_packs_with_http_info(self, file, **kwargs): # noqa: E501 """Upload a Pack as zip file. The zip file maybe a single Pack or a zip containing multiple zipped Packs (a zip of zips) # noqa: E501 - Upload a Pack to the marketplace in the Server. Can be used to upload a Pack for an offline scenario or a Pack that hasn't been released. # noqa: E501 + Upload a Pack to the marketplace in the Server. Can be used to upload a Pack for an offline scenario or a Pack that hasn't been released. (will be deprecated from XSOAR 8.9 and XSIAM 2.5) # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.upload_content_packs_with_http_info(file, async_req=True) @@ -7369,6 +7369,105 @@ def upload_content_packs_with_http_info(self, file, **kwargs): # noqa: E501 _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + def upload_custom_packs(self, file, **kwargs): # noqa: E501 + """Upload a Custom Pack as zip file. The zip file maybe a single Pack or a zip containing multiple zipped Packs (a zip of zips) # noqa: E501 + + Upload a Custom Pack to the marketplace in the Server. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.upload_custom_packs(file, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param file file: file (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_custom_packs_with_http_info(file, **kwargs) # noqa: E501 + else: + (data) = self.upload_custom_packs_with_http_info(file, **kwargs) # noqa: E501 + return data + + def upload_custom_packs_with_http_info(self, file, **kwargs): # noqa: E501 + """Upload a Custom Pack as zip file. The zip file maybe a single Pack or a zip containing multiple zipped Packs (a zip of zips) # noqa: E501 + + Upload a Custom Pack to the marketplace in the Server. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.upload_custom_packs_with_http_info(file, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param file file: file (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['file'] # 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 upload_custom_packs" % key + ) + 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 `upload_custom_packs`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'file' in params: + local_var_files['file'] = params['file'] # noqa: E501 + + body_params = None + # 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 + ['multipart/form-data']) # noqa: E501 + + # Authentication setting + auth_settings = ['api_key', 'csrf_token', 'x-xdr-auth-id'] # noqa: E501 + + return self.api_client.call_api( + '/contentpacks/installed/upload/custom', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # 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 upload_report(self, file, **kwargs): # noqa: E501 """Upload report file to Demisto # noqa: E501 diff --git a/docs/DefaultApi.md b/docs/DefaultApi.md index d3d2173b..6b282c48 100644 --- a/docs/DefaultApi.md +++ b/docs/DefaultApi.md @@ -78,6 +78,7 @@ Method | HTTP request | Description [**update_entry_note**](DefaultApi.md#update_entry_note) | **POST** /entry/note | Mark entry as note [**update_entry_tags_op**](DefaultApi.md#update_entry_tags_op) | **POST** /entry/tags | Set entry tags [**upload_content_packs**](DefaultApi.md#upload_content_packs) | **POST** /contentpacks/installed/upload | Upload a Pack as zip file. The zip file maybe a single Pack or a zip containing multiple zipped Packs (a zip of zips) +[**upload_custom_packs**](DefaultApi.md#upload_custom_packs) | **POST** /contentpacks/installed/upload/custom | Upload a Custom Pack as zip file. The zip file maybe a single Pack or a zip containing multiple zipped Packs (a zip of zips) [**upload_report**](DefaultApi.md#upload_report) | **POST** /reports/upload | Upload report file to Demisto @@ -3615,7 +3616,7 @@ Name | Type | Description | Notes Upload a Pack as zip file. The zip file maybe a single Pack or a zip containing multiple zipped Packs (a zip of zips) -Upload a Pack to the marketplace in the Server. Can be used to upload a Pack for an offline scenario or a Pack that hasn't been released. +Upload a Pack to the marketplace in the Server. Can be used to upload a Pack for an offline scenario or a Pack that hasn't been released. (will be deprecated from XSOAR 8.9 and XSIAM 2.5) ### Example ```python @@ -3661,6 +3662,53 @@ void (empty response body) [[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) +# **upload_custom_packs** +> upload_custom_packs(file) + +Upload a Custom Pack as zip file. The zip file maybe a single Pack or a zip containing multiple zipped Packs (a zip of zips) + +Upload a Custom Pack to the marketplace in the Server. + +### 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") +file = '/path/to/file.txt' # file | file + +try: + # Upload a Custom Pack as zip file. The zip file maybe a single Pack or a zip containing multiple zipped Packs (a zip of zips) + api_instance.upload_custom_packs(file) +except ApiException as e: + print("Exception when calling DefaultApi->upload_custom_packs: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **file** | **file**| file | + +### Return type + +void (empty response body) + +### Authorization + +[api_key](README.md#api_key), [csrf_token](README.md#csrf_token), [x-xdr-auth-id](README.md#x-xdr-auth-id) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **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) + # **upload_report** > list[Report] upload_report(file) diff --git a/docs/README.md b/docs/README.md index ebc48e6d..efebffb3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -78,6 +78,7 @@ Method | HTTP request | Description [**update_entry_note**](DefaultApi.md#update_entry_note) | **POST** /entry/note | Mark entry as note [**update_entry_tags_op**](DefaultApi.md#update_entry_tags_op) | **POST** /entry/tags | Set entry tags [**upload_content_packs**](DefaultApi.md#upload_content_packs) | **POST** /contentpacks/installed/upload | Upload a Pack as zip file. The zip file maybe a single Pack or a zip containing multiple zipped Packs (a zip of zips) +[**upload_custom_packs**](DefaultApi.md#upload_custom_packs) | **POST** /contentpacks/installed/upload/custom | Upload a Custom Pack as zip file. The zip file maybe a single Pack or a zip containing multiple zipped Packs (a zip of zips) [**upload_report**](DefaultApi.md#upload_report) | **POST** /reports/upload | Upload report file to Demisto diff --git a/pyproject.toml b/pyproject.toml index a50f0ae3..4b3917b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "demisto-py" -version = "3.2.15" +version = "3.2.16" description = "\"A Python library for the Demisto API\"" authors = ["Demisto"] license = "Apache-2.0" diff --git a/server_api_swagger.json b/server_api_swagger.json index cee748bd..70b66aef 100644 --- a/server_api_swagger.json +++ b/server_api_swagger.json @@ -1787,7 +1787,7 @@ }, "/contentpacks/installed/upload": { "post": { - "description": "Upload a Pack to the marketplace in the Server. Can be used to upload a Pack for an offline scenario or a Pack that hasn't been released.", + "description": "Upload a Pack to the marketplace in the Server. Can be used to upload a Pack for an offline scenario or a Pack that hasn't been released. (will be deprecated from XSOAR 8.9 and XSIAM 2.5)", "consumes": [ "multipart/form-data" ], @@ -1822,6 +1822,33 @@ } } }, + "/contentpacks/installed/upload/custom": { + "post": { + "description": "Upload a Custom Pack to the marketplace in the Server.", + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "summary": "Upload a Custom Pack as zip file. The zip file maybe a single Pack or a zip containing multiple zipped Packs (a zip of zips)", + "operationId": "uploadCustomPacks", + "parameters": [ + { + "type": "file", + "description": "file", + "name": "file", + "in": "formData", + "required": true + } + ], + "responses": { + "200": { + "description": "The pack was successfully uploaded" + } + } + } + }, "/statistics/dashboards/query": { "post": { "description": "Get a given dashboard statistics result.",