diff --git a/README.md b/README.md index 2e87557..92e2d3c 100644 --- a/README.md +++ b/README.md @@ -531,6 +531,17 @@ result = j1.upload_combined_batch_json( print(f"Uploaded {len(combined_payload['entities'])} entities and {len(combined_payload['relationships'])} relationships") ``` +##### Abort Synchronization Job +```python +# Abort the sync job +result = j1.abort_sync_job(instance_job_id='') +print(f"Abort sync job: {result['status'].get('id')}") + +# Check job status +if result['job']['status'] == 'ABORTED': + print("Sync job Abort successfully") +``` + ##### Finalize Synchronization Job ```python diff --git a/jupiterone/client.py b/jupiterone/client.py index e5f9ae9..a0dff9f 100644 --- a/jupiterone/client.py +++ b/jupiterone/client.py @@ -951,7 +951,7 @@ def bulk_delete_entities( return response def finalize_sync_job(self, instance_job_id: Optional[str] = None) -> Dict[str, Any]: - """Start a synchronization job. + """Finalize a synchronization job. args: instance_job_id (str): The "Job ID" for the Custom Integration job @@ -964,6 +964,20 @@ def finalize_sync_job(self, instance_job_id: Optional[str] = None) -> Dict[str, return response + def abort_sync_job(self, instance_job_id: Optional[str] = None) -> Dict[str, Any]: + """Abort a synchronization job. + + args: + instance_job_id (str): The "Job ID" for the Custom Integration job to abort + """ + endpoint = f"/persister/synchronization/jobs/{instance_job_id}/abort" + + data = {} + + response = self._execute_syncapi_request(endpoint=endpoint, payload=data) + + return response + def fetch_integration_jobs(self, instance_id: Optional[str] = None) -> List[Dict[str, Any]]: """Fetch Integration Job details from defined integration instance. diff --git a/setup.py b/setup.py index 318fe06..ed34102 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="jupiterone", - version="2.0.1", + version="2.1.0", description="A Python client for the JupiterOne API", license="MIT License", author="JupiterOne",