config

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: 14 Imported by: 0

Documentation

Index

Constants

View Source
const HCLFilename = "Vagrantfile.hcl"

HCLFilename is the default HCL based Vagrantfile name

View Source
const RubyFilename = "Vagrantfile"

RubyFilename is the default Ruby based Vagrantfile name

Variables

View Source
var Mappers []*argmapper.Func

Functions

func DecodeConfiguration

func DecodeConfiguration(
	data *vagrant_plugin_sdk.Args_ConfigData,
	i interface{},
	args ...argmapper.Arg,
) (err error)

func EncodeConfiguration

func EncodeConfiguration(
	c interface{},
	args ...argmapper.Arg,
) (*vagrant_plugin_sdk.Args_Hash, error)

Encode a piece of the configuration

func EncodeVagrantfile

func EncodeVagrantfile(
	v *Vagrantfile,
	args ...argmapper.Arg,
) (*vagrant_plugin_sdk.Args_ConfigData, error)

Encode the Vagrantfile for storage

func ExistingPath

func ExistingPath(
	dir path.Path,
	filenames []string,
) (p path.Path, err error)

Detect existing path within directory

func FindPath

func FindPath(
	start path.Path,
	filenames []string,
) (p path.Path, err error)

FindPath looks for our configuration file starting at "start" and traversing parent directories until it is found. If it is found, the path is returned. If it is not found, nil is returned. Error will be non-nil only if an error occurred.

If start is nil, start will be the current working directory. If filenames are nil, it will default to the value(s) from GetVagrantfileName().

func GetVagrantfileName

func GetVagrantfileName() []string

Returns the valid file names for the Vagrantfile. If the VAGRANT_VAGRANTFILE environment variable is set, the slice will only contain that value.

func RestoreConfiguration

func RestoreConfiguration(
	s []byte,
	i interface{},
) (err error)

Restore a piece of the confiugration

Types

type CloudInit

type CloudInit struct {
	ContentType *string `hcl:"content_type" json:",omitempty"`
	Inline      *string `hcl:"inline,optional" json:",omitempty"`
	Path        *string `hcl:"path,optional" json:",omitempty"`

	Body   hcl.Body `hcl:",body" json:"-"`
	Remain hcl.Body `hcl:",remain" json:"-"`
}

type Communicator

type Communicator struct {
	Name string `hcl:"name,label"`

	Body   hcl.Body `hcl:",body" json:"-"`
	Remain hcl.Body `hcl:",remain" json:"-"`
}

type Disk

type Disk struct {
	Name string `hcl:"name,label" json:"name"`

	DiskExt        *string           `hcl:"disk_ext,optional" json:",omitempty"`
	File           *string           `hcl:"file,optional" json:",omitempty"`
	Primary        *bool             `hcl:"primary,optional" json:",omitempty"`
	ProviderConfig map[string]string `hcl:"provider_config,optional" json:",omitempty"`
	Size           *string           `hcl:"size"`

	Body   hcl.Body `hcl:",body" json:"-"`
	Remain hcl.Body `hcl:",remain" json:"-"`
}

type Network

type Network struct {
	Kind *string `hcl:"kind,label" json:"kind"`

	Body   hcl.Body `hcl:",body" json:"-"`
	Remain hcl.Body `hcl:",remain" json:"-"`
}

type Plugin

type Plugin struct {
	Name string `hcl:"name,label" json:"name"`

	EntryPoint *string  `hcl:"entry_point,optional" json:",omitempty"`
	Sources    []string `hcl:"sources,optional" json:",omitempty"`
	Version    *string  `hcl:"version,optional" json:",omitempty"`

	Body   hcl.Body `hcl:",body" json:"-"`
	Remain hcl.Body `hcl:",remain" json:"-"`
}

type Provider

type Provider struct {
	Name string `hcl:"name,label" json:"name"`

	Body   hcl.Body `hcl:",body" json:"-"`
	Remain hcl.Body `hcl:",remain" json:"-"`
}

type Provisioner

type Provisioner struct {
	Kind string `hcl:"kind,label" json:"kind"`

	Body   hcl.Body `hcl:",body" json:"-"`
	Remain hcl.Body `hcl:",remain" json:"-"`
}

type Range

type Range struct {
	Start int32 `hcl:"start" json:"start"`
	End   int32 `hcl:"end" json:"end"`
}

Note: used for types.Range

type SSH

type SSH struct {
	ConnectTimeout *int32 `hcl:"connect_timeout,optional" json:",omitempty"`
}

type SyncedFolder

type SyncedFolder struct {
	Source      string `hcl:"source,label" json:"source"`
	Destination string `hcl:"destination,label" json:"destination"`

	Disabled     *bool    `hcl:"disabled,optional" json:",omitempty"`
	Group        *string  `hcl:"group,optional" json:",omitempty"`
	ID           *string  `hcl:"id,optional" json:",omitempty"`
	MountOptions []string `hcl:"mount_options,optional" json:",omitempty"`
	Owner        *string  `hcl:"owner,optional" json:",omitempty"`
	Type         *string  `hcl:"type,optional" json:",omitempty"`

	Body   hcl.Body `hcl:",body" json:"-"`
	Remain hcl.Body `hcl:",remain" json:"-"`
}

type Target

type Target struct {
	Name string `hcl:"name,label" json:"name"`

	Providers []*Provider `hcl:"provider,optional" json:",omitempty"`

	Provider *Provider `json:",omitempty"`
}

type VM

type VM struct {
	Name string `hcl:"name,label" json:"name"`

	AllowFstabModification     *bool             `hcl:"allow_fstab_modification,optional" json:",omitempty"`
	AllowHostsModification     *bool             `hcl:"allow_hosts_modification,optional" json:",omitempty"`
	AutoStart                  *bool             `hcl:"autostart,optional" json:",omitempty"`
	BaseMAC                    *string           `hcl:"base_mac,optional" json:",omitempty"`
	BootTimeout                *int32            `hcl:"boot_timeout,optional" json:",omitempty"`
	Box                        *string           `hcl:"box,optional" json:",omitempty"`
	BoxCheckUpdate             *bool             `hcl:"box_check_update,optional" json:",omitempty"`
	BoxDownloadChecksum        *string           `hcl:"box_download_checksum,optional" json:",omitempty"`
	BoxDownloadChecksumType    *string           `hcl:"box_download_checksum_type,optional" json:",omitempty"`
	BoxDownloadClientCert      *string           `hcl:"box_download_client_cert,optional" json:",omitempty"`
	BoxDownloadCACert          *string           `hcl:"box_download_ca_cert,optional" json:",omitempty"`
	BoxDownloadCAPath          *string           `hcl:"box_download_ca_path,optional" json:",omitempty"`
	BoxDownloadOptions         map[string]string `hcl:"box_download_options,optional" json:",omitempty"`
	BoxDownloadInsecure        *bool             `hcl:"box_download_insecure,optional" json:",omitempty"`
	BoxDownloadLocationTrusted *bool             `hcl:"box_download_location_trusted,optional" json:",omitempty"`
	BoxURL                     *string           `hcl:"box_url,optional" json:",omitempty"`
	BoxVersion                 *string           `hcl:"box_version,optional" json:",omitempty"`
	//	CloudInit                  *CloudInit        `hcl:"cloud_init,block" json:",omitempty"`
	Communicator *string `hcl:"communicator,optional" json:",omitempty"`
	// Disk                       *Disk             `hcl:"disk,optional" json:",omitempty"`
	GracefulHaltTimeout  *int32  `hcl:"graceful_halt_timeout,optional" json:",omitempty"`
	Guest                *string `hcl:"guest,optional" json:",omitempty"`
	Hostname             *string `hcl:"hostname,optional" json:",omitempty"`
	IgnoreBoxVagrantfile *bool   `hcl:"ignore_box_vagrantfile,optional" json:",omitempty"`
	// Networks                   []*Network        `hcl:"network,block" json:",omitempty"`
	PostUpMessage *string `hcl:"post_up_message,optional" json:",omitempty"`
	Primary       *bool   `hcl:"primary,optional" json:",omitempty"`
}

func (*VM) Target

func (v *VM) Target() *Target

type Vagrant

type Vagrant struct {
	Sensitive []string `hcl:"sensitive,optional" json:",omitempty"`
	Host      *string  `hcl:"host,optional" json:",omitempty"`
	Plugins   []Plugin `hcl:"plugins,block" json:",omitempty"`

	Body   hcl.Body `hcl:",body" json:"-"`
	Remain hcl.Body `hcl:",remain" json:"-"`
}

type Vagrantfile

type Vagrantfile struct {
	Communicators []*Communicator `hcl:"communicator,block" json:",omitempty"`
	DefinedVms    []*VM           `hcl:"define_vm,block" json:",omitempty"`
	SSH           *SSH            `hcl:"ssh,block" json:",omitempty"`
	Vagrant       *Vagrant        `hcl:"vagrant,block" json:",omitempty"`
	VM            *VM             `hcl:"vm,block" json:",omitempty"`

	DefinedVmKeys []string `json:",omitempty"`
	ListVMs       []*VM    `json:",omitempty"`

	Body   hcl.Body `hcl:",body" json:"-"`
	Remain hcl.Body `hcl:",remain" json:"-"`
}

func DecodeVagrantfile

func DecodeVagrantfile(
	data *vagrant_plugin_sdk.Args_ConfigData,
	args ...argmapper.Arg,
) (v *Vagrantfile, err error)

Decode a proto encoded Vagrantfile

func LoadHCLVagrantfile

func LoadHCLVagrantfile(
	p path.Path,
) (*Vagrantfile, error)

Load Vagrant configuration using an HCL based Vagrantfile

func LoadRubyVagrantfile

func LoadRubyVagrantfile(
	p path.Path,
	rubyRuntime parser,
) (*Vagrantfile, error)

Load Vagrant configuration using a Ruby based Vagrantfile

func LoadVagrantfile

func LoadVagrantfile(
	content []byte,
	loc string,
	kind VagrantfileFormat,
) (*Vagrantfile, error)

Load a Vagrantfile

func RestoreVagrantfile

func RestoreVagrantfile(
	s []byte,
	args ...argmapper.Arg,
) (v *Vagrantfile, err error)

Restore an encoded Vagrantfile

type VagrantfileFormat

type VagrantfileFormat uint8
const (
	JSON VagrantfileFormat = iota
	HCL
	RUBY
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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