Documentation
¶
Overview ¶
Package client implements image factory HTTP API client.
Index ¶
- func IsHTTPErrorCode(err error, code int) bool
- func IsInvalidSchematicError(err error) bool
- func WithHeaders(headers map[string]string) requestOption
- func WithQueryParams(query url.Values) requestOption
- func WithRequestData(data []byte) requestOption
- type Client
- func (c *Client) BaseURL() string
- func (c *Client) BrokenVersions(ctx context.Context) ([]string, error)
- func (c *Client) ExtensionsVersions(ctx context.Context, talosVersion string) ([]ExtensionInfo, error)
- func (c *Client) OverlaysVersions(ctx context.Context, talosVersion string) ([]OverlayInfo, error)
- func (c *Client) ScanReport(ctx context.Context, schematicID, talosVersion, arch, filename string) ([]byte, error)
- func (c *Client) SchematicCreate(ctx context.Context, sc schematic.Schematic) (string, *schematic.Schematic, error)
- func (c *Client) SchematicGet(ctx context.Context, schematicID string) (*schematic.Schematic, error)
- func (c *Client) TalosctlList(ctx context.Context, talosVersion string) ([]string, error)
- func (c *Client) Versions(ctx context.Context) ([]string, error)
- type ExtensionInfo
- type HTTPError
- type InvalidSchematicError
- type Option
- type Options
- type OverlayInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsHTTPErrorCode ¶ added in v0.2.1
IsHTTPErrorCode checks if the error is HTTP error with a specific doe.
func IsInvalidSchematicError ¶
IsInvalidSchematicError checks if the error is invalid schematic.
func WithHeaders ¶ added in v1.3.3
WithHeaders attaches request headers.
func WithQueryParams ¶ added in v1.3.3
WithQueryParams attaches URL query parameters.
func WithRequestData ¶ added in v1.3.3
func WithRequestData(data []byte) requestOption
WithRequestData attaches a request body.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the Image Factory HTTP API client.
func (*Client) BrokenVersions ¶ added in v1.3.3
BrokenVersions gets the list of Talos versions marked as broken by the factory.
func (*Client) ExtensionsVersions ¶
func (c *Client) ExtensionsVersions(ctx context.Context, talosVersion string) ([]ExtensionInfo, error)
ExtensionsVersions gets the version of the extension for a Talos version.
func (*Client) OverlaysVersions ¶ added in v0.3.0
OverlaysVersions gets the version of the extension for a Talos version.
func (*Client) ScanReport ¶ added in v1.3.3
func (c *Client) ScanReport(ctx context.Context, schematicID, talosVersion, arch, filename string) ([]byte, error)
ScanReport downloads a vulnerability scan report for the given schematic, Talos version, architecture, and report filename. The filename extension selects the report format: ".sarif" → SARIF, ".cdx" → CycloneDX, ".json" → JSON, ".table" → plain-text table.
func (*Client) SchematicCreate ¶
func (c *Client) SchematicCreate(ctx context.Context, sc schematic.Schematic) (string, *schematic.Schematic, error)
SchematicCreate generates new schematic from the configuration.
It returns the schematic ID and the normalized schematic as returned by the factory. The normalized schematic should be considered authoritative as it may differ from the input (for example, the factory may set the owner field for authenticated requests).
func (*Client) SchematicGet ¶ added in v0.9.0
func (*Client) TalosctlList ¶ added in v1.2.0
TalosctlList gets the list of talosctl download URLs for a Talos version.
type ExtensionInfo ¶
type ExtensionInfo struct {
Name string `json:"name"`
Ref string `json:"ref"`
Digest string `json:"digest"`
Author string `json:"author"`
Description string `json:"description"`
}
ExtensionInfo defines extensions versions list response item.
type InvalidSchematicError ¶
type InvalidSchematicError struct {
// contains filtered or unexported fields
}
InvalidSchematicError is parsed from 400 response from the server.
func (*InvalidSchematicError) Error ¶
func (e *InvalidSchematicError) Error() string
Error implements error interface.
type Option ¶
type Option func(*Options)
Option defines a single client option setter.
func WithBasicAuth ¶ added in v1.2.0
WithBasicAuth adds basic authentication to each request.
func WithClient ¶
WithClient overrides default client instance.