client

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MPL-2.0 Imports: 12 Imported by: 2

Documentation

Overview

Package client implements image factory HTTP API client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsHTTPErrorCode added in v0.2.1

func IsHTTPErrorCode(err error, code int) bool

IsHTTPErrorCode checks if the error is HTTP error with a specific doe.

func IsInvalidSchematicError

func IsInvalidSchematicError(err error) bool

IsInvalidSchematicError checks if the error is invalid schematic.

func WithHeaders added in v1.3.3

func WithHeaders(headers map[string]string) requestOption

WithHeaders attaches request headers.

func WithQueryParams added in v1.3.3

func WithQueryParams(query url.Values) requestOption

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 New

func New(baseURL string, options ...Option) (*Client, error)

New creates a new Image Factory API client.

func (*Client) BaseURL added in v0.5.0

func (c *Client) BaseURL() string

BaseURL returns the base URL of the client.

func (*Client) BrokenVersions added in v1.3.3

func (c *Client) BrokenVersions(ctx context.Context) ([]string, error)

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

func (c *Client) OverlaysVersions(ctx context.Context, talosVersion string) ([]OverlayInfo, error)

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 (c *Client) SchematicGet(ctx context.Context, schematicID string) (*schematic.Schematic, error)

func (*Client) TalosctlList added in v1.2.0

func (c *Client) TalosctlList(ctx context.Context, talosVersion string) ([]string, error)

TalosctlList gets the list of talosctl download URLs for a Talos version.

func (*Client) Versions

func (c *Client) Versions(ctx context.Context) ([]string, error)

Versions gets the list of Talos versions available.

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 HTTPError added in v0.2.1

type HTTPError struct {
	Message string
	Code    int
}

HTTPError is a generic HTTP error wrapper.

func (*HTTPError) Error added in v0.2.1

func (e *HTTPError) Error() string

Error implements error interface.

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

func WithBasicAuth(username, password string) Option

WithBasicAuth adds basic authentication to each request.

func WithClient

func WithClient(client http.Client) Option

WithClient overrides default client instance.

type Options

type Options struct {
	// ExtraHeaders represents extra headers to be added to each request.
	ExtraHeaders http.Header
	// Client is the http client.
	Client http.Client
}

Options defines client options.

type OverlayInfo added in v0.3.0

type OverlayInfo struct {
	Name   string `json:"name"`
	Image  string `json:"image"`
	Ref    string `json:"ref"`
	Digest string `json:"digest"`
}

OverlayInfo defines overlay versions list response item.

Jump to

Keyboard shortcuts

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