-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from demisto/add-feed-json
Add feed json support
- Loading branch information
Showing
13 changed files
with
524 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,3 +92,5 @@ git_push.sh | |
.swagger-codegen | ||
.vscode | ||
.pytest_cache | ||
py27 | ||
py37 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
195 changes: 195 additions & 0 deletions
195
demisto_client/demisto_api/models/feed_indicators_request.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
# coding: utf-8 | ||
|
||
""" | ||
Demisto API | ||
This is the public REST API to integrate with the demisto server. HTTP request can be sent using any HTTP-client. For an example dedicated client take a look at: https://github.com/demisto/demisto-py. Requests must include API-key that can be generated in the Demisto web client under 'Settings' -> 'Integrations' -> 'API keys' Optimistic Locking and Versioning\\: When using Demisto REST API, you will need to make sure to work on the latest version of the item (incident, entry, etc.), otherwise, you will get a DB version error (which not allow you to override a newer item). In addition, you can pass 'version\\: -1' to force data override (make sure that other users data might be lost). Assume that Alice and Bob both read the same data from Demisto server, then they both changed the data, and then both tried to write the new versions back to the server. Whose changes should be saved? Alice’s? Bob’s? To solve this, each data item in Demisto has a numeric incremental version. If Alice saved an item with version 4 and Bob trying to save the same item with version 3, Demisto will rollback Bob request and returns a DB version conflict error. Bob will need to get the latest item and work on it so Alice work will not get lost. Example request using 'curl'\\: ``` curl 'https://hostname:443/incidents/search' -H 'content-type: application/json' -H 'accept: application/json' -H 'Authorization: <API Key goes here>' --data-binary '{\"filter\":{\"query\":\"-status:closed -category:job\",\"period\":{\"by\":\"day\",\"fromValue\":7}}}' --compressed ``` # noqa: E501 | ||
OpenAPI spec version: 2.0.0 | ||
Generated by: https://github.com/swagger-api/swagger-codegen.git | ||
""" | ||
|
||
|
||
import pprint | ||
import re # noqa: F401 | ||
|
||
import six | ||
|
||
from demisto_client.demisto_api.models.raw_feed_indicator import RawFeedIndicator # noqa: F401,E501 | ||
|
||
|
||
class FeedIndicatorsRequest(object): | ||
"""NOTE: This class is auto generated by the swagger code generator program. | ||
Do not edit the class manually. | ||
""" | ||
|
||
""" | ||
Attributes: | ||
swagger_types (dict): The key is attribute name | ||
and the value is attribute type. | ||
attribute_map (dict): The key is attribute name | ||
and the value is json key in definition. | ||
""" | ||
swagger_types = { | ||
'bypass_exclusion_list': 'bool', | ||
'classifier_id': 'str', | ||
'indicators': 'list[RawFeedIndicator]', | ||
'mapper_id': 'str' | ||
} | ||
|
||
attribute_map = { | ||
'bypass_exclusion_list': 'bypassExclusionList', | ||
'classifier_id': 'classifierId', | ||
'indicators': 'indicators', | ||
'mapper_id': 'mapperId' | ||
} | ||
|
||
def __init__(self, bypass_exclusion_list=None, classifier_id=None, indicators=None, mapper_id=None): # noqa: E501 | ||
"""FeedIndicatorsRequest - a model defined in Swagger""" # noqa: E501 | ||
|
||
self._bypass_exclusion_list = None | ||
self._classifier_id = None | ||
self._indicators = None | ||
self._mapper_id = None | ||
self.discriminator = None | ||
|
||
if bypass_exclusion_list is not None: | ||
self.bypass_exclusion_list = bypass_exclusion_list | ||
if classifier_id is not None: | ||
self.classifier_id = classifier_id | ||
if indicators is not None: | ||
self.indicators = indicators | ||
if mapper_id is not None: | ||
self.mapper_id = mapper_id | ||
|
||
@property | ||
def bypass_exclusion_list(self): | ||
"""Gets the bypass_exclusion_list of this FeedIndicatorsRequest. # noqa: E501 | ||
:return: The bypass_exclusion_list of this FeedIndicatorsRequest. # noqa: E501 | ||
:rtype: bool | ||
""" | ||
return self._bypass_exclusion_list | ||
|
||
@bypass_exclusion_list.setter | ||
def bypass_exclusion_list(self, bypass_exclusion_list): | ||
"""Sets the bypass_exclusion_list of this FeedIndicatorsRequest. | ||
:param bypass_exclusion_list: The bypass_exclusion_list of this FeedIndicatorsRequest. # noqa: E501 | ||
:type: bool | ||
""" | ||
|
||
self._bypass_exclusion_list = bypass_exclusion_list | ||
|
||
@property | ||
def classifier_id(self): | ||
"""Gets the classifier_id of this FeedIndicatorsRequest. # noqa: E501 | ||
:return: The classifier_id of this FeedIndicatorsRequest. # noqa: E501 | ||
:rtype: str | ||
""" | ||
return self._classifier_id | ||
|
||
@classifier_id.setter | ||
def classifier_id(self, classifier_id): | ||
"""Sets the classifier_id of this FeedIndicatorsRequest. | ||
:param classifier_id: The classifier_id of this FeedIndicatorsRequest. # noqa: E501 | ||
:type: str | ||
""" | ||
|
||
self._classifier_id = classifier_id | ||
|
||
@property | ||
def indicators(self): | ||
"""Gets the indicators of this FeedIndicatorsRequest. # noqa: E501 | ||
:return: The indicators of this FeedIndicatorsRequest. # noqa: E501 | ||
:rtype: list[RawFeedIndicator] | ||
""" | ||
return self._indicators | ||
|
||
@indicators.setter | ||
def indicators(self, indicators): | ||
"""Sets the indicators of this FeedIndicatorsRequest. | ||
:param indicators: The indicators of this FeedIndicatorsRequest. # noqa: E501 | ||
:type: list[RawFeedIndicator] | ||
""" | ||
|
||
self._indicators = indicators | ||
|
||
@property | ||
def mapper_id(self): | ||
"""Gets the mapper_id of this FeedIndicatorsRequest. # noqa: E501 | ||
:return: The mapper_id of this FeedIndicatorsRequest. # noqa: E501 | ||
:rtype: str | ||
""" | ||
return self._mapper_id | ||
|
||
@mapper_id.setter | ||
def mapper_id(self, mapper_id): | ||
"""Sets the mapper_id of this FeedIndicatorsRequest. | ||
:param mapper_id: The mapper_id of this FeedIndicatorsRequest. # noqa: E501 | ||
:type: str | ||
""" | ||
|
||
self._mapper_id = mapper_id | ||
|
||
def to_dict(self): | ||
"""Returns the model properties as a dict""" | ||
result = {} | ||
|
||
for attr, _ in six.iteritems(self.swagger_types): | ||
value = getattr(self, attr) | ||
if isinstance(value, list): | ||
result[attr] = list(map( | ||
lambda x: x.to_dict() if hasattr(x, "to_dict") else x, | ||
value | ||
)) | ||
elif hasattr(value, "to_dict"): | ||
result[attr] = value.to_dict() | ||
elif isinstance(value, dict): | ||
result[attr] = dict(map( | ||
lambda item: (item[0], item[1].to_dict()) | ||
if hasattr(item[1], "to_dict") else item, | ||
value.items() | ||
)) | ||
else: | ||
result[attr] = value | ||
if issubclass(FeedIndicatorsRequest, dict): | ||
for key, value in self.items(): | ||
result[key] = value | ||
|
||
return result | ||
|
||
def to_str(self): | ||
"""Returns the string representation of the model""" | ||
return pprint.pformat(self.to_dict()) | ||
|
||
def __repr__(self): | ||
"""For `print` and `pprint`""" | ||
return self.to_str() | ||
|
||
def __eq__(self, other): | ||
"""Returns true if both objects are equal""" | ||
if not isinstance(other, FeedIndicatorsRequest): | ||
return False | ||
|
||
return self.__dict__ == other.__dict__ | ||
|
||
def __ne__(self, other): | ||
"""Returns true if both objects are not equal""" | ||
return not self == other |
Oops, something went wrong.