Class CortexScanResult

java.lang.Object
org.jenkinsci.plugins.cortexcloud.shared.CortexScanResult
All Implemented Interfaces:
Serializable

public class CortexScanResult extends Object implements 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:
  • Constructor Details

  • 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 findings
      compliance - compliance findings (malware / secrets / config)
      consoleUrl - optional deep link into the Cortex console
      pass - whether the scan is considered passing
    • getResults

      public CortexScanResult.Result[] 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

      public int countBySeverity(String severity)
      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

      public String getConsoleUrl()
    • isPass

      public boolean isPass()
      Returns:
      true when every result entity passed policy (used as a parser-side cross-check of the exit code).