Skip to content

Commit 73dd31e

Browse files
committed
create API for finalizing Tier 1 reachability analyses
1 parent 4e92db2 commit 73dd31e

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

socketdev/fullscans/__init__.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,4 +895,35 @@ def gfm(self, org_slug: str, before: str, after: str) -> dict:
895895

896896
error_message = response.json().get("error", {}).get("message", "Unknown error")
897897
log.error(f"Error getting diff scan results: {response.status_code}, message: {error_message}")
898-
return {}
898+
return {}
899+
900+
def finalize_tier1(
901+
self,
902+
full_scan_id: str,
903+
tier1_reachability_scan_id: str,
904+
) -> bool:
905+
"""
906+
Finalize a tier 1 reachability scan by associating it with a full scan.
907+
908+
Args:
909+
full_scan_id: The ID of the full scan to associate with the tier 1 scan
910+
tier1_reachability_scan_id: The tier 1 reachability scan ID from the facts file
911+
912+
Returns:
913+
True if successful, False otherwise
914+
"""
915+
path = "tier1-reachability-scan/finalize"
916+
payload = json.dumps({
917+
"tier1_reachability_scan_id": tier1_reachability_scan_id,
918+
"report_run_id": full_scan_id
919+
})
920+
921+
response = self.api.do_request(
922+
path=path,
923+
method="POST",
924+
payload=payload
925+
)
926+
927+
if response.status_code in (200, 201, 204):
928+
return True
929+
return False

0 commit comments

Comments
 (0)