Documentation
¶
Overview ¶
Package http implements the HTTP frontend.
Index ¶
Constants ¶
const ( TargetMetal = "metal" TargetCloud = "cloud" TargetSBC = "sbc" )
Target constants.
Variables ¶
This section is empty.
Functions ¶
func MatchError ¶ added in v1.1.0
MatchError matches the error and returns the appropriate HTTP status code and log level. It also calls the callback with the message and code to write the response.
func SetURLValuesFromSchematic ¶ added in v1.3.0
func SetURLValuesFromSchematic(params *WizardParams, s *schematic.Schematic)
SetURLValuesFromSchematic reverses ToSchematic, populating the schematic-derived fields of WizardParams from a schematic.
Target is set to TargetSBC when the schematic carries an overlay, otherwise it is left empty since the schematic alone cannot distinguish between metal and cloud targets.
Types ¶
type Frontend ¶
type Frontend struct {
// contains filtered or unexported fields
}
Frontend is the HTTP frontend.
func NewFrontend ¶
func NewFrontend( logger *zap.Logger, schematicFactory *schematic.Factory, assetBuilder *asset.Builder, artifactsManager *artifacts.Manager, secureBootService *secureboot.Service, checksummer enterprise.Checksummer, enterprisePlugins []enterprise.FrontendPlugin, opts Options, ) (*Frontend, error)
NewFrontend creates a new HTTP frontend.
type Handler ¶ added in v1.2.0
type Handler = func(ctx context.Context, w http.ResponseWriter, r *http.Request, p httprouter.Params) error
Handler is a custom handler type that includes the context and httprouter params, and returns an error.
type InvalidImageTag ¶ added in v0.9.0
type InvalidImageTag struct{}
InvalidImageTag is an error tag for invalid image names.
type Options ¶
type Options struct {
CacheImageSigner signer.Signer
ExternalURL *url.URL
ExternalPXEURL *url.URL
AuthProvider enterprise.AuthProvider
InstallerInternalRepository name.Repository
InstallerExternalRepository name.Repository
MetricsNamespace string
AllowedOrigins []string
RemoteOptions []remote.Option
RegistryRefreshInterval time.Duration
ProxyInstallerInternalRepository bool
}
Options configures the HTTP frontend.
type Talosctl ¶ added in v0.7.5
type Talosctl struct{}
Talosctl provides methods to generate paths for talosctl binaries.
func (Talosctl) TalosctlPaths ¶ added in v0.7.5
func (Talosctl) TalosctlPaths(tuples []artifacts.TalosctlTuple) []string
TalosctlPaths generates paths for talosctl binaries based on the provided tuples.
type WizardParams ¶ added in v0.4.0
type WizardParams struct {
Target string
Version string
Arch string
Platform string
Board string
SecureBoot string
Bootloader string
Extensions []string
Cmdline string
CmdlineSet bool
EmbeddedConfig string
OverlayOptions string
SelectedTarget string
SelectedVersion string
SelectedArch string
SelectedPlatform string
SelectedBoard string
SelectedSecureBoot string
SelectedBootloader string
SelectedExtensions []string
SelectedCmdline string
SelectedEmbeddedConfig string
SelectedOverlayOptions string
// Dynamically set fields.
PlatformMeta platforms.Platform
BoardMeta platforms.SBC
TalosctlMeta Talosctl
// Localizer
Localizer *i18n.Localizer
}
WizardParams encapsulates the parameters of the wizard.
Some fields might be not set if we haven't reached that step yet.
func WizardParamsFromRequest ¶ added in v0.4.0
func WizardParamsFromRequest(r *http.Request) WizardParams
WizardParamsFromRequest extracts the wizard parameters from the request.
func (WizardParams) NonSchematicURLValues ¶ added in v1.3.0
func (p WizardParams) NonSchematicURLValues() url.Values
NonSchematicURLValues returns the URL values of the wizard parameters that don't have any effect on the schematic.
func (WizardParams) ToSchematic ¶ added in v1.3.0
func (params WizardParams) ToSchematic(ctx context.Context, owner *string) (schematic.Schematic, error)
ToSchematic creates a schematic.Schematic out of the params.
func (WizardParams) URLValues ¶ added in v0.4.0
func (p WizardParams) URLValues() url.Values
URLValues returns the URL values of the wizard parameters.