Documentation
¶
Overview ¶
Package trustifyv2 provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.
Package trustifyv2 provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.
Package trustifyv2 provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.
Index ¶
- Constants
- func GetSwagger() (swagger *openapi3.T, err error)
- func NewGetSbomAdvisoriesRequest(server string, id string) (*http.Request, error)
- func NewListPurlsRequest(server string, params *ListPurlsParams) (*http.Request, error)
- func NewListSbomsByPackageRequest(server string, params *ListSbomsByPackageParams) (*http.Request, error)
- func NewListSbomsRequest(server string, params *ListSbomsParams) (*http.Request, error)
- func NewUploadSbomRequest(server string, params *UploadSbomParams, body UploadSbomJSONRequestBody) (*http.Request, error)
- func NewUploadSbomRequestWithBody(server string, params *UploadSbomParams, contentType string, body io.Reader) (*http.Request, error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- type AuthError
- type Client
- func (c *Client) GetSbomAdvisories(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) ListPurls(ctx context.Context, params *ListPurlsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) ListSboms(ctx context.Context, params *ListSbomsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) ListSbomsByPackage(ctx context.Context, params *ListSbomsByPackageParams, ...) (*http.Response, error)
- func (c *Client) UploadSbom(ctx context.Context, params *UploadSbomParams, body UploadSbomJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) UploadSbomWithBody(ctx context.Context, params *UploadSbomParams, contentType string, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) GetSbomAdvisoriesWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetSbomAdvisoriesResponse, error)
- func (c *ClientWithResponses) ListPurlsWithResponse(ctx context.Context, params *ListPurlsParams, reqEditors ...RequestEditorFn) (*ListPurlsResponse, error)
- func (c *ClientWithResponses) ListSbomsByPackageWithResponse(ctx context.Context, params *ListSbomsByPackageParams, ...) (*ListSbomsByPackageResponse, error)
- func (c *ClientWithResponses) ListSbomsWithResponse(ctx context.Context, params *ListSbomsParams, reqEditors ...RequestEditorFn) (*ListSbomsResponse, error)
- func (c *ClientWithResponses) UploadSbomWithBodyWithResponse(ctx context.Context, params *UploadSbomParams, contentType string, ...) (*UploadSbomResponse, error)
- func (c *ClientWithResponses) UploadSbomWithResponse(ctx context.Context, params *UploadSbomParams, body UploadSbomJSONRequestBody, ...) (*UploadSbomResponse, error)
- type ClientWithResponsesInterface
- type ConnectionError
- type Finding
- type GetSbomAdvisoriesResponse
- type HttpRequestDoer
- type Issuer
- type ListPurlsParams
- type ListPurlsResponse
- type ListSbomsByPackageParams
- type ListSbomsByPackageResponse
- type ListSbomsParams
- type ListSbomsResponse
- type PurlBase
- type PurlListResponse
- type PurlSummary
- type PurlVersion
- type RequestEditorFn
- type SbomAdvisory
- type SbomListResponse
- type SbomStatus
- type SbomSummary
- type SbomUploadResponse
- type Severity
- type UploadSbomJSONBody
- type UploadSbomJSONRequestBody
- type UploadSbomParams
- type UploadSbomResponse
- type VulnerabilityClient
Constants ¶
const ( AuthModeNone = "none" AuthModeClientCredentials = "client-credentials" )
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
func NewGetSbomAdvisoriesRequest ¶
NewGetSbomAdvisoriesRequest generates requests for GetSbomAdvisories
func NewListPurlsRequest ¶
func NewListPurlsRequest(server string, params *ListPurlsParams) (*http.Request, error)
NewListPurlsRequest generates requests for ListPurls
func NewListSbomsByPackageRequest ¶
func NewListSbomsByPackageRequest(server string, params *ListSbomsByPackageParams) (*http.Request, error)
NewListSbomsByPackageRequest generates requests for ListSbomsByPackage
func NewListSbomsRequest ¶
func NewListSbomsRequest(server string, params *ListSbomsParams) (*http.Request, error)
NewListSbomsRequest generates requests for ListSboms
func NewUploadSbomRequest ¶
func NewUploadSbomRequest(server string, params *UploadSbomParams, body UploadSbomJSONRequestBody) (*http.Request, error)
NewUploadSbomRequest calls the generic UploadSbom builder with application/json body
func NewUploadSbomRequestWithBody ¶
func NewUploadSbomRequestWithBody(server string, params *UploadSbomParams, contentType string, body io.Reader) (*http.Request, error)
NewUploadSbomRequestWithBody generates requests for UploadSbom with any type of body
Types ¶
type Client ¶
type Client struct {
// The endpoint of the server conforming to this interface, with scheme,
// https://api.deepmap.com for example. This can contain a path relative
// to the server, such as https://api.deepmap.com/dev-test, and all the
// paths in the swagger spec will be appended to the server.
Server string
// Doer for performing requests, typically a *http.Client with any
// customized settings, such as certificate chains.
Client HttpRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors []RequestEditorFn
}
Client which conforms to the OpenAPI3 specification for this service.
func NewClient ¶
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) GetSbomAdvisories ¶
func (*Client) ListPurls ¶
func (c *Client) ListPurls(ctx context.Context, params *ListPurlsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) ListSboms ¶
func (c *Client) ListSboms(ctx context.Context, params *ListSbomsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) ListSbomsByPackage ¶
func (c *Client) ListSbomsByPackage(ctx context.Context, params *ListSbomsByPackageParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) UploadSbom ¶
func (c *Client) UploadSbom(ctx context.Context, params *UploadSbomParams, body UploadSbomJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) UploadSbomWithBody ¶
type ClientInterface ¶
type ClientInterface interface {
// ListPurls request
ListPurls(ctx context.Context, params *ListPurlsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// ListSboms request
ListSboms(ctx context.Context, params *ListSbomsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// UploadSbomWithBody request with any body
UploadSbomWithBody(ctx context.Context, params *UploadSbomParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
UploadSbom(ctx context.Context, params *UploadSbomParams, body UploadSbomJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// ListSbomsByPackage request
ListSbomsByPackage(ctx context.Context, params *ListSbomsByPackageParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetSbomAdvisories request
GetSbomAdvisories(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error)
}
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithHTTPClient ¶
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) GetSbomAdvisoriesWithResponse ¶
func (c *ClientWithResponses) GetSbomAdvisoriesWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetSbomAdvisoriesResponse, error)
GetSbomAdvisoriesWithResponse request returning *GetSbomAdvisoriesResponse
func (*ClientWithResponses) ListPurlsWithResponse ¶
func (c *ClientWithResponses) ListPurlsWithResponse(ctx context.Context, params *ListPurlsParams, reqEditors ...RequestEditorFn) (*ListPurlsResponse, error)
ListPurlsWithResponse request returning *ListPurlsResponse
func (*ClientWithResponses) ListSbomsByPackageWithResponse ¶
func (c *ClientWithResponses) ListSbomsByPackageWithResponse(ctx context.Context, params *ListSbomsByPackageParams, reqEditors ...RequestEditorFn) (*ListSbomsByPackageResponse, error)
ListSbomsByPackageWithResponse request returning *ListSbomsByPackageResponse
func (*ClientWithResponses) ListSbomsWithResponse ¶
func (c *ClientWithResponses) ListSbomsWithResponse(ctx context.Context, params *ListSbomsParams, reqEditors ...RequestEditorFn) (*ListSbomsResponse, error)
ListSbomsWithResponse request returning *ListSbomsResponse
func (*ClientWithResponses) UploadSbomWithBodyWithResponse ¶
func (c *ClientWithResponses) UploadSbomWithBodyWithResponse(ctx context.Context, params *UploadSbomParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UploadSbomResponse, error)
UploadSbomWithBodyWithResponse request with arbitrary body returning *UploadSbomResponse
func (*ClientWithResponses) UploadSbomWithResponse ¶
func (c *ClientWithResponses) UploadSbomWithResponse(ctx context.Context, params *UploadSbomParams, body UploadSbomJSONRequestBody, reqEditors ...RequestEditorFn) (*UploadSbomResponse, error)
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface {
// ListPurlsWithResponse request
ListPurlsWithResponse(ctx context.Context, params *ListPurlsParams, reqEditors ...RequestEditorFn) (*ListPurlsResponse, error)
// ListSbomsWithResponse request
ListSbomsWithResponse(ctx context.Context, params *ListSbomsParams, reqEditors ...RequestEditorFn) (*ListSbomsResponse, error)
// UploadSbomWithBodyWithResponse request with any body
UploadSbomWithBodyWithResponse(ctx context.Context, params *UploadSbomParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UploadSbomResponse, error)
UploadSbomWithResponse(ctx context.Context, params *UploadSbomParams, body UploadSbomJSONRequestBody, reqEditors ...RequestEditorFn) (*UploadSbomResponse, error)
// ListSbomsByPackageWithResponse request
ListSbomsByPackageWithResponse(ctx context.Context, params *ListSbomsByPackageParams, reqEditors ...RequestEditorFn) (*ListSbomsByPackageResponse, error)
// GetSbomAdvisoriesWithResponse request
GetSbomAdvisoriesWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetSbomAdvisoriesResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type ConnectionError ¶
ConnectionError is returned when the HTTP request to Trustify fails.
func (*ConnectionError) Error ¶
func (e *ConnectionError) Error() string
func (*ConnectionError) Unwrap ¶
func (e *ConnectionError) Unwrap() error
type Finding ¶
type Finding struct {
ImageDigest string
CVEID string
Status string
Severity string
AdvisoryID string
Issuer *Issuer
CVSSScore *float64
Description string
PublishedAt *time.Time
}
Finding represents a single vulnerability finding for an image digest, matching the vulnerability_findings table schema. This is our domain type; it is not generated and stays here permanently.
type GetSbomAdvisoriesResponse ¶
type GetSbomAdvisoriesResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *[]SbomAdvisory
}
func ParseGetSbomAdvisoriesResponse ¶
func ParseGetSbomAdvisoriesResponse(rsp *http.Response) (*GetSbomAdvisoriesResponse, error)
ParseGetSbomAdvisoriesResponse parses an HTTP response from a GetSbomAdvisoriesWithResponse call
func (GetSbomAdvisoriesResponse) Status ¶
func (r GetSbomAdvisoriesResponse) Status() string
Status returns HTTPResponse.Status
func (GetSbomAdvisoriesResponse) StatusCode ¶
func (r GetSbomAdvisoriesResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type Issuer ¶
type Issuer struct {
// CpeKey The CPE key of the organization, if known.
CpeKey *string `json:"cpe_key"`
// Id The opaque UUID of the organization.
Id openapi_types.UUID `json:"id"`
// Name The name of the organization.
Name string `json:"name"`
// Website The website of the organization, if known.
Website *string `json:"website"`
}
Issuer The issuer of an advisory (e.g., Red Hat, NVD).
type ListPurlsParams ¶
type ListPurlsParams struct {
// Q Search query (text search across PURL fields). Use pipe for OR (e.g., digest1|digest2).
Q *string `form:"q,omitempty" json:"q,omitempty"`
// Limit Maximum number of results to return
Limit *int64 `form:"limit,omitempty" json:"limit,omitempty"`
// Offset Number of results to skip
Offset *int64 `form:"offset,omitempty" json:"offset,omitempty"`
}
ListPurlsParams defines parameters for ListPurls.
type ListPurlsResponse ¶
type ListPurlsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *PurlListResponse
}
func ParseListPurlsResponse ¶
func ParseListPurlsResponse(rsp *http.Response) (*ListPurlsResponse, error)
ParseListPurlsResponse parses an HTTP response from a ListPurlsWithResponse call
func (ListPurlsResponse) Status ¶
func (r ListPurlsResponse) Status() string
Status returns HTTPResponse.Status
func (ListPurlsResponse) StatusCode ¶
func (r ListPurlsResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type ListSbomsByPackageParams ¶
type ListSbomsByPackageParams struct {
// Purl Package URL to search for
Purl string `form:"purl" json:"purl"`
// Limit Maximum number of results to return
Limit *int64 `form:"limit,omitempty" json:"limit,omitempty"`
// Offset Number of results to skip
Offset *int64 `form:"offset,omitempty" json:"offset,omitempty"`
}
ListSbomsByPackageParams defines parameters for ListSbomsByPackage.
type ListSbomsByPackageResponse ¶
type ListSbomsByPackageResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *SbomListResponse
}
func ParseListSbomsByPackageResponse ¶
func ParseListSbomsByPackageResponse(rsp *http.Response) (*ListSbomsByPackageResponse, error)
ParseListSbomsByPackageResponse parses an HTTP response from a ListSbomsByPackageWithResponse call
func (ListSbomsByPackageResponse) Status ¶
func (r ListSbomsByPackageResponse) Status() string
Status returns HTTPResponse.Status
func (ListSbomsByPackageResponse) StatusCode ¶
func (r ListSbomsByPackageResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type ListSbomsParams ¶
type ListSbomsParams struct {
// Q Search query (e.g., sha256~<digest> or name~<image>)
Q *string `form:"q,omitempty" json:"q,omitempty"`
// Limit Maximum number of results to return
Limit *int64 `form:"limit,omitempty" json:"limit,omitempty"`
// Offset Number of results to skip
Offset *int64 `form:"offset,omitempty" json:"offset,omitempty"`
}
ListSbomsParams defines parameters for ListSboms.
type ListSbomsResponse ¶
type ListSbomsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *SbomListResponse
}
func ParseListSbomsResponse ¶
func ParseListSbomsResponse(rsp *http.Response) (*ListSbomsResponse, error)
ParseListSbomsResponse parses an HTTP response from a ListSbomsWithResponse call
func (ListSbomsResponse) Status ¶
func (r ListSbomsResponse) Status() string
Status returns HTTPResponse.Status
func (ListSbomsResponse) StatusCode ¶
func (r ListSbomsResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type PurlBase ¶
type PurlBase struct {
// Purl Base PURL without version or qualifiers
Purl string `json:"purl"`
Uuid string `json:"uuid"`
}
PurlBase defines model for PurlBase.
type PurlListResponse ¶
type PurlListResponse struct {
Items []PurlSummary `json:"items"`
Total int64 `json:"total"`
}
PurlListResponse defines model for PurlListResponse.
type PurlSummary ¶
type PurlSummary struct {
Base *PurlBase `json:"base,omitempty"`
// Purl The Package URL string
Purl string `json:"purl"`
Qualifiers *map[string]string `json:"qualifiers"`
// Uuid Unique identifier for this PURL
Uuid string `json:"uuid"`
Version *PurlVersion `json:"version,omitempty"`
}
PurlSummary defines model for PurlSummary.
type PurlVersion ¶
type PurlVersion struct {
Purl string `json:"purl"`
Uuid string `json:"uuid"`
Version string `json:"version"`
}
PurlVersion defines model for PurlVersion.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type SbomAdvisory ¶
type SbomAdvisory struct {
// DocumentId CVE ID (e.g., CVE-2023-44487)
DocumentId string `json:"document_id"`
// Identifier Advisory identifier (e.g., URL or reference)
Identifier string `json:"identifier"`
// Issuer The issuer of an advisory (e.g., Red Hat, NVD).
Issuer *Issuer `json:"issuer,omitempty"`
Modified *time.Time `json:"modified"`
Published *time.Time `json:"published"`
Status []SbomStatus `json:"status"`
Title *string `json:"title"`
Uuid string `json:"uuid"`
}
SbomAdvisory defines model for SbomAdvisory.
type SbomListResponse ¶
type SbomListResponse struct {
Items []SbomSummary `json:"items"`
Total int64 `json:"total"`
}
SbomListResponse defines model for SbomListResponse.
type SbomStatus ¶
type SbomStatus struct {
AverageScore float64 `json:"average_score"`
// AverageSeverity Qualitative Severity Rating Scale
AverageSeverity Severity `json:"average_severity"`
Description *string `json:"description"`
// Identifier CVE identifier
Identifier string `json:"identifier"`
Published *time.Time `json:"published"`
// Status Vulnerability status (affected, fixed, not_affected, unknown)
Status string `json:"status"`
Title *string `json:"title"`
}
SbomStatus defines model for SbomStatus.
type SbomSummary ¶
type SbomSummary struct {
// Id SBOM ID (URN format)
Id string `json:"id"`
// Name SBOM name (usually the image reference)
Name string `json:"name"`
Published *time.Time `json:"published"`
// Sha256 SHA256 digest of the SBOM content
Sha256 *string `json:"sha256"`
}
SbomSummary defines model for SbomSummary.
type SbomUploadResponse ¶
type SbomUploadResponse struct {
// DocumentId Document ID (URN format)
DocumentId *string `json:"document_id,omitempty"`
// Id ID of the uploaded SBOM
Id string `json:"id"`
}
SbomUploadResponse defines model for SbomUploadResponse.
type UploadSbomJSONBody ¶
type UploadSbomJSONBody = string
UploadSbomJSONBody defines parameters for UploadSbom.
type UploadSbomJSONRequestBody ¶
type UploadSbomJSONRequestBody = UploadSbomJSONBody
UploadSbomJSONRequestBody defines body for UploadSbom for application/json ContentType.
type UploadSbomParams ¶
type UploadSbomParams struct {
// Labels Labels to associate with the SBOM (e.g., image digest as sha256~<digest>)
Labels *string `form:"labels,omitempty" json:"labels,omitempty"`
}
UploadSbomParams defines parameters for UploadSbom.
type UploadSbomResponse ¶
type UploadSbomResponse struct {
Body []byte
HTTPResponse *http.Response
JSON201 *SbomUploadResponse
}
func ParseUploadSbomResponse ¶
func ParseUploadSbomResponse(rsp *http.Response) (*UploadSbomResponse, error)
ParseUploadSbomResponse parses an HTTP response from a UploadSbomWithResponse call
func (UploadSbomResponse) Status ¶
func (r UploadSbomResponse) Status() string
Status returns HTTPResponse.Status
func (UploadSbomResponse) StatusCode ¶
func (r UploadSbomResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type VulnerabilityClient ¶
type VulnerabilityClient interface {
// GetVulnerabilitiesForDigests queries Trustify for all CVE findings associated
// with the given image digests. It returns a map from image digest to findings.
// Digests not found in Trustify will have an empty slice in the map.
GetVulnerabilitiesForDigests(ctx context.Context, digests []string) (map[string][]Finding, error)
// UploadSBOM uploads an SBOM document to Trustify, associating it with the
// given image digest. The SBOM should be in CycloneDX or SPDX JSON format.
UploadSBOM(ctx context.Context, sbomData []byte, imageDigest string) error
}
VulnerabilityClient queries the Trustify v2 API for vulnerability findings.
func NewVulnerabilityClient ¶
func NewVulnerabilityClient(ctx context.Context, cfg *config.TrustifyConfig) (VulnerabilityClient, error)
NewVulnerabilityClient creates a new Trustify v2 client from the provided configuration. Returns an AuthError if client-credentials mode is selected but OIDC discovery fails. Returns nil, nil when cfg is nil (feature disabled).