algosec-appviz 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: algosec_appviz
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: AlgoSec AppViz Library
5
5
  License: LICENSE
6
6
  License-File: LICENSE
@@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api"
6
6
  name = "algosec_appviz"
7
7
  repository = "https://github.com/bogdan-iot/algosec-appviz"
8
8
  documentation = "https://github.com/bogdan-iot/algosec-appviz/blob/master/README.md"
9
- version = "0.1.0"
9
+ version = "0.1.1"
10
10
  license = "LICENSE"
11
11
  readme = "README.md"
12
12
  description = "AlgoSec AppViz Library"
@@ -1,3 +1,4 @@
1
+ import json
1
2
  import requests
2
3
  from algosec_appviz import environment
3
4
  from datetime import datetime, timedelta
@@ -149,6 +150,53 @@ class AppViz:
149
150
 
150
151
  return result
151
152
 
153
+ def get_log_entries(self, categories=None, text_filter=None, entity_type='All', start_epoch=None, end_epoch=None):
154
+ if not categories:
155
+ raise ValueError("Categories is a mandatory parameter")
156
+ if not text_filter:
157
+ raise ValueError("text_filter is a mandatory parameter")
158
+ log_entries = []
159
+ page = 1
160
+
161
+ headers = {
162
+ 'Accept': 'application/json',
163
+ 'Authorization': f'{self._token_type} {self._token}'
164
+ }
165
+
166
+ query_json = {
167
+ "categories": categories,
168
+ "sort": {"column": "Date", "direction": "DESC"},
169
+ "freeTextFilters": text_filter
170
+ }
171
+
172
+ if start_epoch:
173
+ query_json["startDate"] = start_epoch
174
+
175
+ if end_epoch:
176
+ query_json["endDate"] = end_epoch
177
+
178
+ while True:
179
+ print(f"Getting AppViz log entries, page {page}...")
180
+ response = requests.get(url=self.url + '/BusinessFlow/rest/v2/activity_logs/search',
181
+ headers=headers,
182
+ params={
183
+ "identifier": 0,
184
+ "page_number": page,
185
+ "type": "All",
186
+ "entityType": entity_type,
187
+ "query": json.dumps(query_json)
188
+ })
189
+
190
+ content = json.loads(response.text)
191
+ log_entries.extend([x for x in content['content']])
192
+
193
+ page = page + 1
194
+
195
+ if page > content['totalPages']:
196
+ break
197
+
198
+ return log_entries
199
+
152
200
  def get_object_by_id(self, obj_id):
153
201
  response = self._make_api_call('GET',
154
202
  f'/BusinessFlow/rest/v1/network_objects/{obj_id}')
File without changes
File without changes