Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for SearchIncidents incorrect model used #45

Merged
merged 7 commits into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

[1]: https://pypi.org/project/demisto-py/#history

## 2.0.14
Fixed an issue where the attribute mapping for the `search_incidents` model was incorrectly looking for `incidents` not `data`.

## 2.0.13
* Fixed the `filter` parameter in `search_incidents` method to be required as specified in the API.

Expand Down
29 changes: 10 additions & 19 deletions demisto_client/demisto_api/api/default_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

from __future__ import absolute_import

import json
import re # noqa: F401

# python 2 and python 3 compatibility library
Expand Down Expand Up @@ -3797,26 +3796,22 @@ def get_widget_with_http_info(self, id, **kwargs): # noqa: E501
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)

def import_classifier(self, file, **kwargs): # noqa: E501
def import_classifier(self, file, classifier_id, **kwargs): # noqa: E501
"""Import a classifier # noqa: E501

Import a classifier to Cortex XSOAR # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.import_classifier(file, async_req=True)
>>> thread = api.import_classifier(file, classifier_id, async_req=True)
>>> result = thread.get()

:param async_req bool
:param file file: file (required)
:param str classifier_id: associated typeID for the layout (required)
:return: InstanceClassifier
If the method is called asynchronously,
returns the request thread.
"""
with open(file, 'r') as classifier_json_file:
amshamah419 marked this conversation as resolved.
Show resolved Hide resolved
data = classifier_json_file.read()

classifier_data_json = json.loads(data)
classifier_id = classifier_data_json.get('id')
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.import_classifier_with_http_info(file, classifier_id, **kwargs) # noqa: E501
Expand Down Expand Up @@ -4205,7 +4200,7 @@ def import_incident_types_handler_with_http_info(self, file, **kwargs): # noqa:
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)

def import_layout(self, file, **kwargs): # noqa: E501
def import_layout(self, file, type, kind, **kwargs): # noqa: E501
"""Import a layout # noqa: E501

Import a layout to Cortex XSOAR # noqa: E501
Expand All @@ -4216,16 +4211,12 @@ def import_layout(self, file, **kwargs): # noqa: E501

:param async_req bool
:param file file: file (required)
:param str type: associated typeID for the layout (required)
:param str kind: layout kind details (required)
:return: LayoutAPI
If the method is called asynchronously,
returns the request thread.
"""
with open(file, 'r') as layout_json_file:
data = layout_json_file.read()

layout_data_json = json.loads(data)
type = layout_data_json.get('typeId')
kind = layout_data_json.get('kind')
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.import_layout_with_http_info(file, type, kind, **kwargs) # noqa: E501
Expand Down Expand Up @@ -4309,7 +4300,7 @@ def import_layout_with_http_info(self, file, type, kind, **kwargs): # noqa: E50
auth_settings = ['api_key', 'csrf_token'] # noqa: E501

return self.api_client.call_api(
'/layouts/import', 'POST',
'/v2/layouts/import', 'POST',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -6105,7 +6096,7 @@ def search_incidents(self, filter, **kwargs): # noqa: E501

:param async_req bool
:param SearchIncidentsData filter: (required)
:return: Incident
:return: InlineResponse200
If the method is called asynchronously,
returns the request thread.
"""
Expand All @@ -6127,7 +6118,7 @@ def search_incidents_with_http_info(self, filter, **kwargs): # noqa: E501

:param async_req bool
:param SearchIncidentsData filter: (required)
:return: Incident
:return: InlineResponse200
If the method is called asynchronously,
returns the request thread.
"""
Expand Down Expand Up @@ -6185,7 +6176,7 @@ def search_incidents_with_http_info(self, filter, **kwargs): # noqa: E501
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Incident', # noqa: E501
response_type='InlineResponse200', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
Expand Down
2 changes: 1 addition & 1 deletion demisto_client/demisto_api/models/inline_response200.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class InlineResponse200(object):
}

attribute_map = {
'incidents': 'incidents',
'incidents': 'data',
'total': 'total'
}

Expand Down
16 changes: 11 additions & 5 deletions docs/DefaultApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,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)

# **import_classifier**
> InstanceClassifier import_classifier(file)
> InstanceClassifier import_classifier(file, classifier_id)

Import a classifier

Expand All @@ -1924,10 +1924,11 @@ 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
classifier_id = 'classifier_id_example' # str | associated typeID for the layout

try:
# Import a classifier
api_response = api_instance.import_classifier(file)
api_response = api_instance.import_classifier(file, classifier_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->import_classifier: %s\n" % e)
Expand All @@ -1938,6 +1939,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**file** | **file**| file |
**classifier_id** | **str**| associated typeID for the layout |

### Return type

Expand Down Expand Up @@ -2099,7 +2101,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)

# **import_layout**
> LayoutAPI import_layout(file)
> LayoutAPI import_layout(file, type, kind)

Import a layout

Expand All @@ -2116,10 +2118,12 @@ 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
type = 'type_example' # str | associated typeID for the layout
kind = 'kind_example' # str | layout kind details

try:
# Import a layout
api_response = api_instance.import_layout(file)
api_response = api_instance.import_layout(file, type, kind)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->import_layout: %s\n" % e)
Expand All @@ -2129,7 +2133,9 @@ except ApiException as e:

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**file** | **file**| file |
**file** | **file**| file |
**type** | **str**| associated typeID for the layout |
**kind** | **str**| layout kind details |

### Return type

Expand Down
9 changes: 9 additions & 0 deletions docs/ExpirationPolicy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ExpirationPolicy

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)


9 changes: 9 additions & 0 deletions docs/ExpirationSettingsSource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ExpirationSettingsSource

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)


17 changes: 17 additions & 0 deletions docs/ExpirationSource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ExpirationSource

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**brand** | **str** | | [optional]
**expiration_interval** | **int** | | [optional]
**expiration_policy** | [**ExpirationPolicy**](ExpirationPolicy.md) | | [optional]
**instance** | **str** | | [optional]
**module_id** | **str** | | [optional]
**set_time** | **datetime** | | [optional]
**source** | [**ExpirationSettingsSource**](ExpirationSettingsSource.md) | | [optional]
**user** | **str** | | [optional]

[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)


28 changes: 28 additions & 0 deletions docs/FeedIndicator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# FeedIndicator

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**expiration_source** | [**ExpirationSource**](ExpirationSource.md) | | [optional]
**bypass_exclusion_list** | **bool** | | [optional]
**classifier_version** | **int** | | [optional]
**expiration_interval** | **int** | | [optional]
**expiration_policy** | [**ExpirationPolicy**](ExpirationPolicy.md) | | [optional]
**feed_config** | **dict(str, object)** | | [optional]
**fetch_time** | **datetime** | | [optional]
**fields** | [**CustomFields**](CustomFields.md) | | [optional]
**is_enrichment** | **bool** | | [optional]
**modified_time** | **datetime** | | [optional]
**module_id** | **str** | | [optional]
**raw_json** | **dict(str, object)** | | [optional]
**reliability** | [**Reliability**](Reliability.md) | | [optional]
**score** | **int** | | [optional]
**source_brand** | **str** | | [optional]
**source_instance** | **str** | | [optional]
**timestamp** | **datetime** | | [optional]
**type** | **str** | indicator fields | [optional]
**value** | **str** | | [optional]

[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)


9 changes: 9 additions & 0 deletions docs/FeedIndicators.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# FeedIndicators

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)


17 changes: 17 additions & 0 deletions docs/FormDisplay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# FormDisplay

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**body_background_color** | **str** | | [optional]
**body_font_color** | **str** | | [optional]
**header_background_color** | **str** | | [optional]
**header_font_color** | **str** | | [optional]
**sender** | **str** | | [optional]
**submit_button_background_color** | **str** | | [optional]
**submit_button_font_color** | **str** | | [optional]
**submit_text** | **str** | | [optional]

[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)


9 changes: 9 additions & 0 deletions docs/Incidents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Incidents

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)


11 changes: 11 additions & 0 deletions docs/IndicatorEditBulkResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# IndicatorEditBulkResponse

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**total** | **int** | | [optional]
**updated** | **int** | | [optional]

[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)


32 changes: 32 additions & 0 deletions docs/InstanceClassifier.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# InstanceClassifier

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**brand_name** | **str** | | [optional]
**commit_message** | **str** | | [optional]
**custom** | **bool** | | [optional]
**default_incident_type** | **str** | | [optional]
**feed** | **bool** | | [optional]
**from_server_version** | [**Version**](Version.md) | | [optional]
**id** | **str** | | [optional]
**incident_samples** | [**Incidents**](Incidents.md) | | [optional]
**indicator_samples** | [**FeedIndicators**](FeedIndicators.md) | | [optional]
**instance_id** | **str** | | [optional]
**instance_name** | **str** | | [optional]
**is_default** | **bool** | | [optional]
**item_version** | [**Version**](Version.md) | | [optional]
**key_type_map** | **dict(str, str)** | | [optional]
**mapping** | [**dict(str, Mapper)**](Mapper.md) | | [optional]
**modified** | **datetime** | | [optional]
**pack_id** | **str** | | [optional]
**primary_term** | **int** | | [optional]
**propagation_labels** | **list[str]** | | [optional]
**sequence_number** | **int** | | [optional]
**should_commit** | **bool** | | [optional]
**sort_values** | **list[str]** | | [optional]
**version** | **int** | | [optional]

[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)


30 changes: 30 additions & 0 deletions docs/Layout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Layout

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**commit_message** | **str** | | [optional]
**from_server_version** | [**Version**](Version.md) | | [optional]
**id** | **str** | | [optional]
**item_version** | [**Version**](Version.md) | | [optional]
**kind** | **str** | | [optional]
**modified** | **datetime** | | [optional]
**name** | **str** | | [optional]
**pack_id** | **str** | | [optional]
**prev_kind** | **str** | | [optional]
**prev_type_id** | **str** | | [optional]
**primary_term** | **int** | | [optional]
**propagation_labels** | **list[str]** | | [optional]
**sections** | [**list[LayoutSection]**](LayoutSection.md) | | [optional]
**sequence_number** | **int** | | [optional]
**should_commit** | **bool** | | [optional]
**sort_values** | **list[str]** | | [optional]
**system** | **bool** | | [optional]
**to_server_version** | [**Version**](Version.md) | | [optional]
**type_id** | **str** | | [optional]
**vc_should_ignore** | **bool** | | [optional]
**version** | **int** | | [optional]

[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)


12 changes: 12 additions & 0 deletions docs/LayoutAPI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# LayoutAPI

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**kind** | **str** | | [optional]
**layout** | [**Layout**](Layout.md) | | [optional]
**type_id** | **str** | | [optional]

[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)


17 changes: 17 additions & 0 deletions docs/LayoutField.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# LayoutField

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**field_id** | **str** | | [optional]
**id** | **str** | | [optional]
**is_visible** | **bool** | | [optional]
**modified** | **datetime** | | [optional]
**primary_term** | **int** | | [optional]
**sequence_number** | **int** | | [optional]
**sort_values** | **list[str]** | | [optional]
**version** | **int** | | [optional]

[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)


Loading