Class CortexScanResult
java.lang.Object
org.jenkinsci.plugins.cortexcloud.shared.CortexScanResult
- All Implemented Interfaces:
Serializable
Parsed result of a Cortex CLI "image scan --output-format json" invocation.
Structure mirrors the legacy plugin's CLIScanResult so the result UI ports
cleanly. Gson SerializedName aliases keep deserialization tolerant of the exact
CLI JSON key names; the precise mapping is finalized once a real payload is
captured from a newer CLI release. Until then, gating relies on the CLI exit
code and this model populates whatever fields are present.
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcountBySeverity(String severity) static CortexScanResultfromFindings(String imageName, String imageId, List<Vulnerability> vulns, List<Vulnerability> compliance, String consoleUrl, boolean pass) Builds a result from findings already mapped out of the Cortex CLI's XDM JSON (see ScanOutputParser).intbooleanisPass()
-
Constructor Details
-
CortexScanResult
public CortexScanResult()
-
-
Method Details
-
fromFindings
public static CortexScanResult fromFindings(String imageName, String imageId, List<Vulnerability> vulns, List<Vulnerability> compliance, String consoleUrl, boolean pass) Builds a result from findings already mapped out of the Cortex CLI's XDM JSON (see ScanOutputParser). Wraps them in a single Result / EntityInfo so the existing result views render unchanged.- Parameters:
imageName- scanned image reference (from asset_name)imageId- image config digest (from image_id)vulns- vulnerability findingscompliance- compliance findings (malware / secrets / config)consoleUrl- optional deep link into the Cortex consolepass- whether the scan is considered passing
-
getResults
-
getVulnerabilityCount
public int getVulnerabilityCount()- Returns:
- total number of findings across all entities, counting both vulnerabilities and compliance findings (malware / secrets). Compliance findings are included so the reported count matches what is actually gated.
-
countBySeverity
- Returns:
- count of findings whose severity matches
severity(case-insensitive), counting both vulnerabilities and compliance findings (malware / secrets) so the printed summary matches the gating decision.
-
getConsoleUrl
-
isPass
public boolean isPass()- Returns:
- true when every result entity passed policy (used as a parser-side cross-check of the exit code).
-