From 17f2cc6326389e349fcc9f758ed5fd4dde485056 Mon Sep 17 00:00:00 2001 From: Moshe Date: Wed, 9 Oct 2024 15:26:05 +0300 Subject: [PATCH] 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.",