core

package
v0.0.0-...-7ae29b8 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MPL-2.0 Imports: 7 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

TypeMap is a mapping of Type to the nil pointer to the interface of that type. This can be used with libraries such as mapper.

View Source
var TypeStringMap = map[Type]string{
	BasisType:         "basis",
	BoxCollectionType: "boxcollection",
	BoxMetadataType:   "boxmetadata",
	BoxType:           "box",
	MachineType:       "machine",
	PluginManagerType: "pluginmanager",
	ProjectType:       "project",
	StateBagType:      "statebag",
	TargetIndexType:   "targetindex",
	TargetType:        "target",
}

Functions

This section is empty.

Types

type Basis

type Basis interface {
	Boxes() (boxes BoxCollection, err error)
	CWD() (path path.Path, err error)
	DataDir() (dir *datadir.Basis, err error)
	DefaultPrivateKey() (path path.Path, err error)
	DefaultProvider() (name string, err error)
	Host() (host Host, err error)
	ResourceId() (string, error)
	TargetIndex() (index TargetIndex, err error)
	Vagrantfile() (Vagrantfile, error)
	UI() (ui terminal.UI, err error)

	io.Closer
}

type Box

type Box interface {
	// Check if a box is allowed
	AutomaticUpdateCheckAllowed() (allowed bool, err error)
	// Deletes the box
	Destroy() (err error)
	// The directory on disk where this box exists
	Directory() (path path.Path, err error)
	// Checks if the box has an update
	HasUpdate(version string) (updateAvailable bool, err error)
	// Checks if the box has an update and returns the metadata (from the metadata url),
	// the newer version, and newer provider.
	UpdateInfo(version string) (updateAvailable bool, meta BoxMetadata, newVersion string, newProvider string, err error)
	// Checks if this box is in use according to the given machine index
	InUse(index TargetIndex) (inUse bool, err error)
	// Returns the machines from the machine index that are using the box
	Machines(index TargetIndex) (machines []Machine, err error)
	// Returns the metadata associated with the box (metadata.json within the box file)
	BoxMetadata() (metadata map[string]interface{}, err error)
	// The metadata information for this box from the metadata url (given by the box repository)
	Metadata() (metadata BoxMetadata, err error)
	// The URL to the version info and other metadata for this box
	MetadataURL() (url string, err error)
	// Box name
	Name() (name string, err error)
	// Box provider
	Provider() (name string, err error)
	// This repackages this box and outputs it to the given path.
	Repackage(path path.Path) (err error)
	// Box version
	Version() (version string, err error)
	// Compares a box to this box. Returns -1, 0, or 1 if this version is smaller, equal, or
	// larger than the other version, respectively.
	Compare(box Box) (int, error)
}

type BoxCollection

type BoxCollection interface {
	Add(path path.Path, name, version, metadataURL string, force bool, providers ...string) (box Box, err error)
	All() (boxes []Box, err error)
	Clean(name string) (err error)
	Find(name string, version string, providers ...string) (box Box, err error)
}

type BoxMetadata

type BoxMetadata interface {
	BoxName() string
	LoadMetadata(url string) error
	Version(version string, opts ...*BoxProvider) (*BoxVersion, error)
	ListVersions(opts ...*BoxProvider) ([]string, error)
	Provider(version string, name string) (*BoxProvider, error)
	ListProviders(version string) ([]string, error)
}

type BoxProvider

type BoxProvider struct {
	Name         string
	Url          string
	Checksum     string
	ChecksumType string

	Version *BoxVersion
}

type BoxVersion

type BoxVersion struct {
	Version     string
	Status      string
	Description string
}

type CapabilityPlatform

type CapabilityPlatform interface {
	Capability(name string, args ...interface{}) (interface{}, error)
	HasCapability(name string) (bool, error)
}

type Command

type Command interface {
	CommandInfo() (*component.CommandInfo, error)
	Execute([]string) (int32, error)

	io.Closer
}

type Communicator

type Communicator interface {
	Seeder

	// Config() interface{}
	// Documentation() (*docs.Documentation, error)
	Download(machine Machine, source, destination string) error
	Execute(machine Machine, command []string, opts ...interface{}) (status int32, err error)
	Init(machine Machine) error
	Match(machine Machine) (isMatch bool, err error)
	PrivilegedExecute(machine Machine, command []string, opts ...interface{}) (status int32, err error)
	Ready(machine Machine) (isReady bool, err error)
	Reset(machine Machine) error
	Test(machine Machine, command []string, opts ...interface{}) (valid bool, err error)
	Upload(machine Machine, source, destination string) error
	WaitForReady(machine Machine, wait int) (isReady bool, err error)
}

type CommunicatorMessage

type CommunicatorMessage struct {
	ExitCode int32
	Stdout   string
	Stderr   string
}

type Config

type Config interface {
	Init(*component.ConfigData) (*component.ConfigData, error)
	Register() (*component.ConfigRegistration, error)
	Struct() (interface{}, error)
	Merge(base, toMerge *component.ConfigData) (merged *component.ConfigData, err error)
	Finalize(*component.ConfigData) (*component.ConfigData, error)
}

type ConnectionInfo

type ConnectionInfo map[string]interface{}

the ssh info in vagrant core ends up dumping out a bunch of options, but they are also ssh specific where this would be used for other stuff too (like winrm). need to think on this some more.

type CorePluginManager

type CorePluginManager interface {
	// Get a fresh instance of a core plugin
	GetPlugin(pluginType Type) (interface{}, error)
}

type DefaultProviderOptions

type DefaultProviderOptions struct {
	CheckUsable  bool
	Exclude      []string
	ForceDefault bool
	MachineName  string
}

func (*DefaultProviderOptions) IsExcluded

func (d *DefaultProviderOptions) IsExcluded(provider string) bool

type Downloader

type Downloader interface {
	Download() error
}

type Folder

type Folder struct {
	Source      path.Path
	Destination path.Path
	Options     map[interface{}]interface{}
}

type Guest

type Guest interface {
	CapabilityPlatform
	Seeder
	Named

	Detect(Target) (bool, error)
	Parent() (string, error)

	io.Closer
}

type Host

type Host interface {
	CapabilityPlatform
	Seeder
	Named

	Detect(state StateBag) (bool, error)
	Parent() (string, error)

	io.Closer
}

type Machine

type Machine interface {
	Target

	AsTarget() (t Target, err error)
	Box() (b Box, err error)
	ConnectionInfo() (info *ConnectionInfo, err error)
	Guest() (g Guest, err error)
	ID() (id string, err error)
	Inspect() (printable string, err error)
	MachineState() (state *MachineState, err error)
	SetID(value string) (err error)
	SetMachineState(state *MachineState) (err error)
	SyncedFolders() (folders []*MachineSyncedFolder, err error)
	UID() (userId string, err error)
}

type MachineState

type MachineState struct {
	ID               string
	ShortDescription string
	LongDescription  string
}

type MachineSyncedFolder

type MachineSyncedFolder struct {
	Plugin SyncedFolder
	Folder *Folder
}

type Named

type Named interface {
	SetPluginName(string) error
	PluginName() (name string, err error)
}

type NamedPlugin

type NamedPlugin struct {
	Plugin  interface{}
	Name    string
	Type    string
	Options interface{}
}

type PluginManager

type PluginManager interface {
	ListPlugins(types ...string) (plugins []*NamedPlugin, err error)
	GetPlugin(name, typeName string) (*NamedPlugin, error)

	io.Closer
}

type Project

type Project interface {
	ActiveTargets() (targets []Target, err error)
	Boxes() (boxes BoxCollection, err error)
	// accessors
	CWD() (path path.Path, err error)
	Config() (v Vagrantfile, err error)
	DataDir() (dir *datadir.Project, err error)
	DefaultPrivateKey() (path path.Path, err error)
	DefaultProvider(opts *DefaultProviderOptions) (name string, err error)
	Home() (path path.Path, err error)
	Host() (h Host, err error)
	LocalData() (path path.Path, err error)
	PrimaryTargetName() (name string, err error)
	ResourceId() (string, error)
	RootPath() (path path.Path, err error)

	// Target loads a target within this project with the given name. The
	// provider parameter is optional and is used to specify which provider
	// should be used to load the machine. This second parameter can be left
	// blank when fetching an existing target, but can be specified during
	// machine up to indicate a user flag that's been provided.
	Target(name string, provider string) (t Target, err error)
	TargetIds() (ids []string, err error)
	TargetIndex() (index TargetIndex, err error)
	TargetNames() (names []string, err error)
	Tmp() (path path.Path, err error)
	UI() (ui terminal.UI, err error)
	Vagrantfile() (Vagrantfile, error)
	VagrantfileName() (name string, err error)
	VagrantfilePath() (p path.Path, err error)

	io.Closer
}

type Provider

type Provider interface {
	CapabilityPlatform

	Usable() (bool, error)
	Installed() (bool, error)
	Action(name string, args ...interface{}) error
	MachineIdChanged() error
	SshInfo() (*SshInfo, error)
	State() (*MachineState, error)
}

type Provisioner

type Provisioner interface {
	Provision(machine Machine, config *component.ConfigData) (err error)
	Configure(machine Machine, config *component.ConfigData, rootConfig *component.ConfigData) (err error)
	Cleanup(machine Machine, config *component.ConfigData) (err error)
}

type Push

type Push interface {
	Push() (err error)
}

type Seeder

type Seeder interface {
	Seed(*Seeds) error
	Seeds() (*Seeds, error)
}

type Seeds

type Seeds struct {
	Named map[string]interface{}
	Typed []interface{}
}

func NewSeeds

func NewSeeds() *Seeds

func (*Seeds) AddNamed

func (s *Seeds) AddNamed(n string, v interface{})

func (*Seeds) AddTyped

func (s *Seeds) AddTyped(v ...interface{})

type SshInfo

type SshInfo struct {
	Host           *string
	Port           *string
	Username       *string
	PrivateKeyPath *string
}

type State

type State uint
const (
	UNKNOWN State = iota
	CREATED
	DESTROYED
	HALTED
	NOT_CREATED
	PENDING
)

func (State) IsActive

func (s State) IsActive() bool

IsActive tells whether the machine is in an "active" state. Active is defined in legacy vagrant as "having an id file in the data dir" which is roughtly equivalent to "has an entry in the underlying provider."

type StateBag

type StateBag interface {
	Get(string) interface{}
	GetOk(string) (interface{}, bool)
	Put(string, interface{})
	Remove(string)
}

type Symbol

type Symbol string

This Symbol type represents a Symbol type in Ruby. It is required for interoperability between legacy Vagrant and Go Vagrant. It's primary function is to allow config maps from Ruby that contain Symbols to be interpreted in Go while retaining type information

type SyncedFolder

type SyncedFolder interface {
	CapabilityPlatform
	Seeder

	Usable(machine Machine) (bool, error)
	Enable(machine Machine, folders []*Folder, opts ...interface{}) error
	Prepare(machine Machine, folders []*Folder, opts ...interface{}) error
	Disable(machine Machine, folders []*Folder, opts ...interface{}) error
	Cleanup(machine Machine, opts ...interface{}) error
}

type Target

type Target interface {
	Communicate() (comm Communicator, err error)
	//	Config() (config interface{}, err error)
	DataDir() (*datadir.Target, error)
	Destroy() error
	GetUUID() (id string, err error)
	Metadata() (map[string]string, error)
	Name() (string, error)
	Project() (Project, error)
	Provider() (p Provider, err error)
	ProviderName() (name string, err error)
	Record() (*anypb.Any, error)
	ResourceId() (string, error)
	Save() error
	SetName(value string) (err error)
	SetUUID(id string) (err error)
	Specialize(kind interface{}) (specialized interface{}, err error)
	State() (State, error)
	UI() (ui terminal.UI, err error)
	UpdatedAt() (t *time.Time, err error)
	Vagrantfile() (v Vagrantfile, err error)

	io.Closer
}

type TargetIndex

type TargetIndex interface {
	All() (targets []Target, err error)
	Delete(uuid string) (err error)
	Get(uuid string) (entry Target, err error)
	Includes(uuid string) (exists bool, err error)
	Set(entry Target) (updatedEntry Target, err error)
}

type Type

type Type uint

Type is an enum of all the types of core components supported.

const (
	InvalidType Type = iota // Invalid
	BasisType
	BoxCollectionType
	BoxMetadataType
	BoxType
	MachineType
	PluginManagerType
	ProjectType
	StateBagType
	TargetIndexType
	TargetType
)

type Vagrantfile

type Vagrantfile interface {
	GetConfig(namespace string) (*component.ConfigData, error)
	GetValue(path ...string) (interface{}, error)
	PrimaryTargetName() (name string, err error)
	Target(name, provider string) (Target, error)
	TargetConfig(name, provider string, validateProvider bool) (Vagrantfile, error)

	// Returns a list of the machines that are defined within this
	// Vagrantfile.
	TargetNames() (names []string, err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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