api

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MPL-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package api implements HTTP adapters for Image Factory application services.

Index

Constants

This section is empty.

Variables

View Source
var ErrExternalPXEURLRequired = errors.New("external PXE URL is required")

ErrExternalPXEURLRequired reports a missing PXE image base URL.

Functions

This section is empty.

Types

type DownloadsHandler added in v1.8.0

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

DownloadsHandler serves the downloads of a schematic.

func NewDownloadsHandler added in v1.8.0

func NewDownloadsHandler(schematics SchematicService, talosctl TalosctlSource, usernames UsernameSource, links downloads.Links) *DownloadsHandler

NewDownloadsHandler creates the downloads HTTP adapter. usernames may be nil when authentication is disabled.

func (*DownloadsHandler) Assets added in v1.8.0

func (handler *DownloadsHandler) Assets(ctx context.Context, writer http.ResponseWriter, request *http.Request, params httprouter.Params) error

Assets serves the downloads of a schematic for one Talos version, target and architecture.

type ImageApplication

type ImageApplication interface {
	Resolve(ctx context.Context, request asset.ImageRequest) (asset.ResolvedImage, error)
}

ImageApplication resolves image requests independently of HTTP.

type ImageHandler

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

ImageHandler adapts image application results to HTTP responses.

func NewImageHandler

func NewImageHandler(service ImageApplication, options ImageHandlerOptions) *ImageHandler

NewImageHandler creates an image HTTP adapter.

func (*ImageHandler) Serve

func (handler *ImageHandler) Serve(ctx context.Context, writer http.ResponseWriter, request *http.Request, params httprouter.Params) error

Serve resolves and serves an image asset.

type ImageHandlerOptions

type ImageHandlerOptions struct {
	ExternalPXEURL *url.URL
	Logger         *zap.Logger
}

ImageHandlerOptions configures image response delivery.

type PXEApplication

type PXEApplication interface {
	ResolvePXE(ctx context.Context, request asset.PXERequest) (asset.ResolvedPXE, error)
}

PXEApplication resolves the data needed to render PXE scripts.

type PXEHandler

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

PXEHandler adapts PXE application results to HTTP scripts.

func NewPXEHandler

func NewPXEHandler(service PXEApplication, options PXEHandlerOptions) *PXEHandler

NewPXEHandler creates a PXE HTTP adapter.

func (*PXEHandler) Serve

func (handler *PXEHandler) Serve(ctx context.Context, writer http.ResponseWriter, request *http.Request, params httprouter.Params) error

Serve resolves and renders a PXE script.

type PXEHandlerOptions

type PXEHandlerOptions struct {
	ExternalPXEURL *url.URL
	AuthEnabled    bool
}

PXEHandlerOptions configures PXE script delivery.

type SchematicHandler

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

SchematicHandler adapts schematic application operations to HTTP.

func NewSchematicHandler

func NewSchematicHandler(service SchematicService) *SchematicHandler

NewSchematicHandler creates a schematic HTTP adapter.

func (*SchematicHandler) Create

func (handler *SchematicHandler) Create(ctx context.Context, writer http.ResponseWriter, request *http.Request, _ httprouter.Params) error

Create decodes, creates, and encodes a schematic.

func (*SchematicHandler) Get

func (handler *SchematicHandler) Get(ctx context.Context, writer http.ResponseWriter, _ *http.Request, params httprouter.Params) error

Get retrieves and encodes a schematic.

type SchematicService

type SchematicService interface {
	Create(ctx context.Context, configuration *schematicpkg.Schematic) (string, error)
	Get(ctx context.Context, id string) (*schematicpkg.Schematic, error)
}

SchematicService owns schematic validation, ownership, and persistence.

type TalosVersionHandler added in v1.8.0

type TalosVersionHandler struct{}

TalosVersionHandler serves what a Talos version supports.

func NewTalosVersionHandler added in v1.8.0

func NewTalosVersionHandler() *TalosVersionHandler

NewTalosVersionHandler creates the Talos version HTTP adapter.

func (*TalosVersionHandler) Boards added in v1.8.0

func (handler *TalosVersionHandler) Boards(_ context.Context, writer http.ResponseWriter, _ *http.Request, params httprouter.Params) error

Boards serves the single-board computers of a Talos version.

func (*TalosVersionHandler) Features added in v1.8.0

func (handler *TalosVersionHandler) Features(_ context.Context, writer http.ResponseWriter, _ *http.Request, params httprouter.Params) error

Features serves the features of a Talos version.

func (*TalosVersionHandler) Platforms added in v1.8.0

func (handler *TalosVersionHandler) Platforms(_ context.Context, writer http.ResponseWriter, _ *http.Request, params httprouter.Params) error

Platforms serves the cloud platforms of a Talos version.

type TalosctlApplication

type TalosctlApplication interface {
	List(ctx context.Context, version string) (normalizedVersion string, filenames []string, err error)
	Open(ctx context.Context, version, filename string, withBody bool) (artifacts.TalosctlDownload, error)
}

TalosctlApplication resolves talosctl release metadata and binaries.

type TalosctlHandler

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

TalosctlHandler adapts talosctl application operations to HTTP.

func NewTalosctlHandler

func NewTalosctlHandler(service TalosctlApplication, externalURL *url.URL) *TalosctlHandler

NewTalosctlHandler creates a talosctl HTTP adapter.

func (*TalosctlHandler) Download

func (handler *TalosctlHandler) Download(ctx context.Context, writer http.ResponseWriter, request *http.Request, params httprouter.Params) error

Download serves one talosctl binary.

func (*TalosctlHandler) List

func (handler *TalosctlHandler) List(ctx context.Context, writer http.ResponseWriter, _ *http.Request, params httprouter.Params) error

List returns download URLs for one Talos version.

type TalosctlSource added in v1.8.0

type TalosctlSource interface {
	GetTalosctlTuples(ctx context.Context, version string) ([]artifacts.TalosctlTuple, error)
}

TalosctlSource lists the talosctl binaries of a Talos version.

type UsernameSource added in v1.8.0

type UsernameSource interface {
	UsernameFromContext(ctx context.Context) (string, bool)
}

UsernameSource reports the authenticated user of a request.

Jump to

Keyboard shortcuts

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