From 17f2cc6326389e349fcc9f758ed5fd4dde485056 Mon Sep 17 00:00:00 2001 From: Moshe Date: Wed, 9 Oct 2024 15:26:05 +0300 Subject: [PATCH 1/5] added upload as custom --- demisto_client/demisto_api/api/default_api.py | 103 ++++++++++++++++++ docs/DefaultApi.md | 50 +++++++++ docs/README.md | 1 + server_api_swagger.json | 32 ++++++ 4 files changed, 186 insertions(+) diff --git a/demisto_client/demisto_api/api/default_api.py b/demisto_client/demisto_api/api/default_api.py index 84cb5d3a..168b2071 100644 --- a/demisto_client/demisto_api/api/default_api.py +++ b/demisto_client/demisto_api/api/default_api.py @@ -7369,6 +7369,109 @@ 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) + :param object skip_validation: if true will skip upload packs validation, use when migrating existing custom content to packs. + :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) + :param object skip_validation: if true will skip upload packs validation, use when migrating existing custom content to packs. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['file', 'skip_validation'] # 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 + if 'skip_validation' in params: + form_params.append(('skipValidation', params['skip_validation'])) # 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..fb35098d 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 @@ -3661,6 +3662,55 @@ 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, skip_validation=skip_validation) + +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 +skip_validation = NULL # object | if true will skip upload packs validation, use when migrating existing custom content to packs. (optional) + +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, skip_validation=skip_validation) +except ApiException as e: + print("Exception when calling DefaultApi->upload_custom_packs: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **file** | **file**| file | + **skip_validation** | [**object**](.md)| if true will skip upload packs validation, use when migrating existing custom content to packs. | [optional] + +### 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..8da6e046 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/server_api_swagger.json b/server_api_swagger.json index cee748bd..b702e868 100644 --- a/server_api_swagger.json +++ b/server_api_swagger.json @@ -1822,6 +1822,38 @@ } } }, + "/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 + }, + { + "description": "if true will skip upload packs validation, use when migrating existing custom content to packs.", + "name": "skipValidation", + "in": "formData" + } + ], + "responses": { + "200": { + "description": "The pack was successfully uploaded" + } + } + } + }, "/statistics/dashboards/query": { "post": { "description": "Get a given dashboard statistics result.", From 35a03478a883809ce3dbefaff277afb48692be8f Mon Sep 17 00:00:00 2001 From: Moshe Date: Tue, 29 Oct 2024 10:13:20 +0200 Subject: [PATCH 2/5] added upload as custom --- CHANGELOG.md | 3 +++ demisto_client/demisto_api/api/default_api.py | 8 ++------ docs/DefaultApi.md | 8 +++----- docs/README.md | 2 +- server_api_swagger.json | 7 +------ 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47a2d326..d86e8a24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ [PyPI History](https://pypi.org/project/demisto-py/#history) +## 3.2.15 +* Added `upload_custom_packs` to upload zipped custom packs to marketplace. + ## 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 168b2071..c70f62cd 100644 --- a/demisto_client/demisto_api/api/default_api.py +++ b/demisto_client/demisto_api/api/default_api.py @@ -7380,7 +7380,6 @@ def upload_custom_packs(self, file, **kwargs): # noqa: E501 :param async_req bool :param file file: file (required) - :param object skip_validation: if true will skip upload packs validation, use when migrating existing custom content to packs. :return: None If the method is called asynchronously, returns the request thread. @@ -7403,13 +7402,12 @@ def upload_custom_packs_with_http_info(self, file, **kwargs): # noqa: E501 :param async_req bool :param file file: file (required) - :param object skip_validation: if true will skip upload packs validation, use when migrating existing custom content to packs. :return: None If the method is called asynchronously, returns the request thread. """ - all_params = ['file', 'skip_validation'] # noqa: E501 + all_params = ['file'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -7441,8 +7439,6 @@ def upload_custom_packs_with_http_info(self, file, **kwargs): # noqa: E501 local_var_files = {} if 'file' in params: local_var_files['file'] = params['file'] # noqa: E501 - if 'skip_validation' in params: - form_params.append(('skipValidation', params['skip_validation'])) # noqa: E501 body_params = None # HTTP header `Accept` @@ -7457,7 +7453,7 @@ def upload_custom_packs_with_http_info(self, file, **kwargs): # noqa: E501 auth_settings = ['api_key', 'csrf_token', 'x-xdr-auth-id'] # noqa: E501 return self.api_client.call_api( - '/contentpacks/installed/upload/custom.', 'POST', + '/contentpacks/installed/upload/custom', 'POST', path_params, query_params, header_params, diff --git a/docs/DefaultApi.md b/docs/DefaultApi.md index fb35098d..cbf33775 100644 --- a/docs/DefaultApi.md +++ b/docs/DefaultApi.md @@ -78,7 +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_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 @@ -3663,7 +3663,7 @@ 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, skip_validation=skip_validation) +> 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) @@ -3680,11 +3680,10 @@ 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 -skip_validation = NULL # object | if true will skip upload packs validation, use when migrating existing custom content to packs. (optional) 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, skip_validation=skip_validation) + api_instance.upload_custom_packs(file) except ApiException as e: print("Exception when calling DefaultApi->upload_custom_packs: %s\n" % e) ``` @@ -3694,7 +3693,6 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **file** | **file**| file | - **skip_validation** | [**object**](.md)| if true will skip upload packs validation, use when migrating existing custom content to packs. | [optional] ### Return type diff --git a/docs/README.md b/docs/README.md index 8da6e046..efebffb3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -78,7 +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_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/server_api_swagger.json b/server_api_swagger.json index b702e868..67ae0d01 100644 --- a/server_api_swagger.json +++ b/server_api_swagger.json @@ -1822,7 +1822,7 @@ } } }, - "/contentpacks/installed/upload/custom.": { + "/contentpacks/installed/upload/custom": { "post": { "description": "Upload a Custom Pack to the marketplace in the Server.", "consumes": [ @@ -1840,11 +1840,6 @@ "name": "file", "in": "formData", "required": true - }, - { - "description": "if true will skip upload packs validation, use when migrating existing custom content to packs.", - "name": "skipValidation", - "in": "formData" } ], "responses": { From 42acb780c929efe2a2a43501b153d37626a877c0 Mon Sep 17 00:00:00 2001 From: Moshe Date: Tue, 29 Oct 2024 10:20:00 +0200 Subject: [PATCH 3/5] update version --- CHANGELOG.md | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d86e8a24..f6297742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ [PyPI History](https://pypi.org/project/demisto-py/#history) -## 3.2.15 +## 3.2.16 * Added `upload_custom_packs` to upload zipped custom packs to marketplace. ## 3.2.14 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" From eca2930e508346803f2400003818bc638fb937c8 Mon Sep 17 00:00:00 2001 From: Moshe Date: Wed, 30 Oct 2024 15:21:58 +0200 Subject: [PATCH 4/5] added note --- CHANGELOG.md | 2 +- server_api_swagger.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6297742..833cb8ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ## 3.2.16 * Added `upload_custom_packs` to upload zipped custom packs to marketplace. - + and the `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/server_api_swagger.json b/server_api_swagger.json index 67ae0d01..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" ], From 67ce2cbaef24a70da4f96505e583295dfc7d3224 Mon Sep 17 00:00:00 2001 From: Moshe Date: Mon, 4 Nov 2024 08:27:27 +0200 Subject: [PATCH 5/5] added note --- CHANGELOG.md | 6 ++++-- demisto_client/demisto_api/api/default_api.py | 4 ++-- docs/DefaultApi.md | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 833cb8ff..aa4db6bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,10 @@ [PyPI History](https://pypi.org/project/demisto-py/#history) ## 3.2.16 -* Added `upload_custom_packs` to upload zipped custom packs to marketplace. - and the `upload_content_packs` will be deprecated from XSOAR 8.9 and XSIAM 2.5 +* 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 c70f62cd..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) diff --git a/docs/DefaultApi.md b/docs/DefaultApi.md index cbf33775..6b282c48 100644 --- a/docs/DefaultApi.md +++ b/docs/DefaultApi.md @@ -3616,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