interlynkapi

package
v2.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package interlynkapi provides a client for the Interlynk Component Quality API. When --enable-component-analysis is provided to sbomqs score, components are extracted from the SBOM, POSTed to `/api/v1/doctor/check` in batches, and the resulting findings populate the Component Quality category instead of returning N/A.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BySeverity

type BySeverity struct {
	Critical int `json:"critical"`
	High     int `json:"high"`
	Medium   int `json:"medium"`
	Low      int `json:"low"`
}

BySeverity holds per-severity finding counts.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the HTTP client for the Interlynk Component Quality API.

func NewClient

func NewClient(baseURL, apiKey string) *Client

NewClient constructs a new instance of Client. apiKey may be empty for unauthenticated tier. If baseURL includes the API path (/api/v1/doctor/check), it will be trimmed to the base URL only, as the client appends the path internally.

func (*Client) FetchComponentQuality

func (c *Client) FetchComponentQuality(ctx context.Context, comps []sbom.GetComponent) (*ComponentQualityResult, error)

FetchComponentQuality is the top-level entry point for component quality scoring. It orchestrates three sequential steps:

  1. Build API payloads from SBOM components.
  2. Send those payloads to the Interlynk API in batches.
  3. Merge all batch responses into a single result.

type ComponentPayload

type ComponentPayload struct {
	Name    string   `json:"name"`
	Version string   `json:"version,omitempty"`
	Purl    *string  `json:"purl"`
	Cpes    []string `json:"cpes"`
	License *string  `json:"license"`
}

ComponentPayload is one component in the API request body.

type ComponentQualityResult

type ComponentQualityResult struct {
	// FindingsByCompIndex maps original component index => findings.
	FindingsByCompIndex map[int][]Finding
	// TotalComponents is the total number of components sent to the API.
	TotalComponents int
	// Tier is the service tier returned by the last successful batch ("authenticated" | "unauthenticated").
	Tier string
}

ComponentQualityResult holds the merged findings across all batches. FindingsByCompIndex maps the original (pre-batching) component index to all findings reported for that component.

type ComponentRef

type ComponentRef struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

ComponentRef is the component summary echoed back inside each Finding.

type DoctorRequest

type DoctorRequest struct {
	Components []ComponentPayload `json:"components"`
}

DoctorRequest is the full POST body sent to /api/v1/doctor/check.

type DoctorResponse

type DoctorResponse struct {
	Findings  []Finding `json:"findings"`
	Summary   Summary   `json:"summary"`
	Tier      string    `json:"tier"`
	ChecksRun []string  `json:"checks_run"`
}

DoctorResponse is the full JSON body returned by /api/v1/doctor/check.

type Finding

type Finding struct {
	// Index is the zero-based position of the component in the batch request.
	// Null for SBOM-level findings (not tied to a specific component).
	Index       *int         `json:"index"`
	Component   ComponentRef `json:"component"`
	CheckCode   string       `json:"check_code"`
	Domain      string       `json:"domain"`
	Severity    string       `json:"severity"` // Severity is one of: critical, high, medium, low
	Message     string       `json:"message"`
	Findings    interface{}  `json:"findings"` // Additional nested findings data (varies by check)
	AutoFixable bool         `json:"auto_fixable"`
}

Finding represents one issue detected for a component or the SBOM itself.

type Summary

type Summary struct {
	Total             int                   `json:"total"`
	BySeverity        BySeverity            `json:"by_severity"`
	ByDomain          map[string]BySeverity `json:"by_domain"`
	ComponentsChecked int                   `json:"components_checked"`
}

Summary is the top-level summary block in the API response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL