9
9
10
10
from cartography .client .core .tx import load
11
11
from cartography .graph .job import GraphJob
12
- from cartography .models .aws .guardduty .findings import GuardDutyFindingSchema
13
12
from cartography .models .aws .guardduty .detector import GuardDutyDetectorSchema
13
+ from cartography .models .aws .guardduty .findings import GuardDutyFindingSchema
14
14
from cartography .stats import get_stats_client
15
15
from cartography .util import aws_handle_regions
16
16
from cartography .util import aws_paginate
@@ -230,12 +230,14 @@ def get_detector_details(
230
230
return detector_details
231
231
232
232
233
- def transform_detector_details (detector_details : List [Dict [str , Any ]], region : str ) -> List [Dict [str , Any ]]:
233
+ def transform_detector_details (
234
+ detector_details : List [Dict [str , Any ]], region : str
235
+ ) -> List [Dict [str , Any ]]:
234
236
"""
235
237
Transform GuardDuty detector details from API response to schema format.
236
238
"""
237
239
transformed_detectors = []
238
-
240
+
239
241
for detector in detector_details :
240
242
# Extract detector ID from the response
241
243
detector_id = detector .get ("DetectorId" )
@@ -252,9 +254,9 @@ def transform_detector_details(detector_details: List[Dict[str, Any]], region: s
252
254
"UpdatedAt" : detector .get ("UpdatedAt" ),
253
255
"Region" : region ,
254
256
}
255
-
257
+
256
258
transformed_detectors .append (transformed_detector )
257
-
259
+
258
260
return transformed_detectors
259
261
260
262
@@ -273,7 +275,9 @@ def load_guardduty_detectors(
273
275
for detector in data :
274
276
detector_id = detector .get ("DetectorId" )
275
277
if detector_id :
276
- detector ["Arn" ] = f"arn:aws:guardduty:{ region } :{ aws_account_id } :detector/{ detector_id } "
278
+ detector ["Arn" ] = (
279
+ f"arn:aws:guardduty:{ region } :{ aws_account_id } :detector/{ detector_id } "
280
+ )
277
281
278
282
load (
279
283
neo4j_session ,
@@ -298,7 +302,7 @@ def cleanup_guardduty(
298
302
GuardDutyFindingSchema (), common_job_parameters
299
303
)
300
304
cleanup_job .run (neo4j_session )
301
-
305
+
302
306
# Cleanup detectors
303
307
detector_cleanup_job = GraphJob .from_node_schema (
304
308
GuardDutyDetectorSchema (), common_job_parameters
0 commit comments