28
28
DELETE_RELATIONSHIP ,
29
29
CURSOR_QUERY_V1 ,
30
30
CREATE_INSTANCE ,
31
+ INTEGRATION_JOB_VALUES ,
32
+ INTEGRATION_INSTANCE_EVENT_VALUES ,
31
33
ALL_PROPERTIES ,
32
34
CREATE_SMARTCLASS ,
33
35
CREATE_SMARTCLASS_QUERY ,
34
36
EVALUATE_SMARTCLASS ,
35
- GET_SMARTCLASS_DETAILS
37
+ GET_SMARTCLASS_DETAILS ,
36
38
)
37
39
38
40
@@ -240,7 +242,7 @@ def _limit_and_skip_query(
240
242
241
243
return {"data" : results }
242
244
243
- def _execute_syncapi_request (self , endpoint : str , payload : Dict ) :
245
+ def _execute_syncapi_request (self , endpoint : str , payload : Dict = None ) -> Dict :
244
246
"""Executes POST request to SyncAPI endpoints"""
245
247
246
248
# initiate requests session and implement retry logic of 5 request retries with 1 second between
@@ -266,7 +268,6 @@ def _execute_syncapi_request(self, endpoint: str, payload: Dict):
266
268
"JupiterOne API rate limit exceeded"
267
269
)
268
270
raise JupiterOneApiError (content .get ("errors" ))
269
-
270
271
return response .json ()
271
272
272
273
elif response .status_code == 401 :
@@ -518,14 +519,45 @@ def finalize_sync_job(self, instance_job_id: str = None):
518
519
519
520
return response
520
521
522
+ def fetch_integration_jobs (self , instance_id : str = None ):
523
+ """Fetch Integration Job details from defined integration instance.
524
+
525
+ args:
526
+ instance_id (str): The "integrationInstanceId" of the integration to fetch jobs from.
527
+ """
528
+ variables = {
529
+ "integrationInstanceId" : instance_id ,
530
+ "size" : 100
531
+ }
532
+
533
+ response = self ._execute_query (INTEGRATION_JOB_VALUES , variables = variables )
534
+
535
+ return response ['data' ]['integrationJobs' ]
536
+
537
+ def fetch_integration_job_events (self , instance_id : str = None , instance_job_id : str = None ):
538
+ """Fetch events within an integration job run.
539
+
540
+ args:
541
+ instance_id (str): The integration Instance Id of the integration to fetch job events from.
542
+ instance_job_id (str): The integration Job ID of the integration to fetch job events from.
543
+ """
544
+ variables = {
545
+ "integrationInstanceId" : instance_id ,
546
+ "jobId" : instance_job_id ,
547
+ "size" : 1000
548
+ }
549
+
550
+ response = self ._execute_query (INTEGRATION_INSTANCE_EVENT_VALUES , variables = variables )
551
+
552
+ return response ['data' ]['integrationEvents' ]
553
+
521
554
def create_smartclass (self , smartclass_name : str = None , smartclass_description : str = None ):
522
555
"""Creates a new Smart Class within Assets.
523
556
524
557
args:
525
558
smartclass_name (str): The "Smart class name" for Smart Class to be created.
526
559
smartclass_description (str): The "Description" for Smart Class to be created.
527
560
"""
528
-
529
561
variables = {
530
562
"input" : {
531
563
"tagName" : smartclass_name ,
0 commit comments