Skip to content

Commit

Permalink
added upload as custom
Browse files Browse the repository at this point in the history
  • Loading branch information
moishce committed Oct 9, 2024
1 parent bfaf243 commit 17f2cc6
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 0 deletions.
103 changes: 103 additions & 0 deletions demisto_client/demisto_api/api/default_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
50 changes: 50 additions & 0 deletions docs/DefaultApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
32 changes: 32 additions & 0 deletions server_api_swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down

0 comments on commit 17f2cc6

Please sign in to comment.