platform

package
v2.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCannotDelete = errors.New("cannot delete config on this platform")
	ErrNoProvider   = errors.New("config provider was not online")
)

Functions

func Names

func Names() (names []string)

func Register added in v2.16.0

func Register(provider Provider)

Types

type Config

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

Config defines the capabilities of a particular platform, for use by the rest of Ignition.

func Get

func Get(name string) (config Config, ok bool)

func MustGet

func MustGet(name string) Config

func NewConfig added in v2.16.0

func NewConfig(provider Provider) Config

Helper function for wrapping a Provider, for use by specialized providers that don't want to add themselves to the registry.

func (Config) DelConfig added in v2.14.0

func (c Config) DelConfig(f *resource.Fetcher) error

func (Config) Fetch added in v2.16.0

func (c Config) Fetch(f *resource.Fetcher, state *state.State) (types.Config, report.Report, error)

func (Config) Init added in v2.16.0

func (c Config) Init(f *resource.Fetcher) error

Init performs additional fetcher configuration post-config fetch. This ensures that networking is already available if a platform needs to reach out to the metadata service to fetch additional options / data.

func (Config) Name

func (c Config) Name() string

func (Config) NewFetcher added in v2.16.0

func (c Config) NewFetcher(l *log.Logger) (resource.Fetcher, error)

func (Config) Status

func (c Config) Status(stageName string, f resource.Fetcher, statusErr error) error

Status takes a Fetcher and the error from Run (from engine)

type Name

type Name string

Name is used to identify an platform. It must be in the set of registered platforms.

func (*Name) Set

func (s *Name) Set(val string) error

func (Name) String

func (s Name) String() string

type Provider added in v2.16.0

type Provider struct {
	Name       string
	NewFetcher func(logger *log.Logger) (resource.Fetcher, error)
	Fetch      func(f *resource.Fetcher) (types.Config, report.Report, error)
	Init       func(f *resource.Fetcher) error
	Status     func(stageName string, f resource.Fetcher, e error) error
	DelConfig  func(f *resource.Fetcher) error

	// Fetch, and also save output files to be written during files stage.
	// Avoid, unless you're certain you need it.
	FetchWithFiles func(f *resource.Fetcher) ([]types.File, types.Config, report.Report, error)
}

Provider is the struct that platform implementations use to define their capabilities for use by this package.

Jump to

Keyboard shortcuts

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