client

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MPL-2.0 Imports: 10 Imported by: 2

Documentation

Overview

Package client implements image factory HTTP API client.

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.

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) 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) SchematicCreate

func (c *Client) SchematicCreate(ctx context.Context, schematic schematic.Schematic) (string, error)

SchematicCreate generates new schematic from the configuration.

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 WithClient

func WithClient(client http.Client) Option

WithClient overrides default client instance.

type Options

type Options struct {
	// 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