@@ -108,6 +108,37 @@ def results(self, search_id, start=0, end=0, api_version='latest'):
108
108
.format (search_id , response .content ))
109
109
return response .json ()
110
110
111
+ def delete (self , search_id , api_version = 'latest' ):
112
+ ''' Deletes a previous Ariel search.
113
+ search_id: Ariel search ID
114
+ api_version: QRadar API version to use, defaults to latest.
115
+ Returns a tuple containing search status and search ID.
116
+ Raises ArielError if the search could not be deleted.
117
+ '''
118
+ response = qpylib .REST ('DELETE' , ArielSearch .SEARCH_ENDPOINT .format (search_id ),
119
+ headers = self ._build_headers (api_version ))
120
+ if response .status_code != 200 :
121
+ raise ArielError ('Ariel search {0} could not be deleted: HTTP {1} was returned'
122
+ .format (search_id , response .status_code ))
123
+ response_json = response .json ()
124
+ return (response_json ['status' ], response_json ['search_id' ])
125
+
126
+ def cancel (self , search_id , api_version = 'latest' ):
127
+ ''' Cancels an ongoing Ariel search.
128
+ search_id: Ariel search ID.
129
+ api_version: QRadar API version to use, defaults to latest.
130
+ Returns a tuple containing search status and search ID.
131
+ Raises ArielError if the search could not be cancelled.
132
+ '''
133
+ response = qpylib .REST ('POST' , ArielSearch .SEARCH_ENDPOINT .format (search_id ),
134
+ headers = self ._build_headers (api_version ),
135
+ params = {'status' : 'CANCELLED' })
136
+ if response .status_code != 200 :
137
+ raise ArielError ('Ariel search {0} could not be cancelled: HTTP {1} was returned'
138
+ .format (search_id , response .status_code ))
139
+ response_json = response .json ()
140
+ return (response_json ['status' ], response_json ['search_id' ])
141
+
111
142
@staticmethod
112
143
def _build_headers (api_version ):
113
144
headers = {'Accept' : 'application/json' }
0 commit comments