vm

package
v0.0.0-...-a68df68 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringPtr

func StringPtr(s string) *string

StringPtr returns the string provided as a pointer.

func UIntPtr

func UIntPtr(u uint) *uint

UIntPtr returns the uint provided as a pointer.

Types

type Core

type Core struct {
	Name   string  `json:"name"`
	CPUs   uint    `json:"cpus"`
	Memory uint    `json:"memory"`
	Ports  PortMap `json:"ports"`
}

Core is all the values that always apply to VMs in any situation.

func (Core) Validate

func (c Core) Validate() error

Validate the Core structure

type Create

type Create struct {
	Core    `json:",inline"`
	Storage []Storage `json:"storage"`
}

Create is for creating new VMs. Storage definitons are created as necessary and turned into image definitions (see Updated type)

func (Create) Validate

func (c Create) Validate() error

Validate the Create structure

type Image

type Image struct {
	Path   string  `json:"path"`
	CDROM  bool    `json:"cdrom"`
	Volume *string `json:"volume"`
}

Image is an image that is already created.

func (Image) Validate

func (i Image) Validate() error

Validate the Image structure

type PortMap

type PortMap map[uint16]string

PortMap is a mapping of guest port -> hostaddr:port. hostaddr must be an IP address.

func (PortMap) Validate

func (p PortMap) Validate() error

Validate the PortMap structure

type Storage

type Storage struct {
	Volume    *string `json:"volume"`
	Image     string  `json:"image"`
	ImageSize *uint   `json:"image_size"`
	CDROM     bool    `json:"cdrom"`
}

Storage is for creating and referencing new storage. Existing storage references, with the exception of adding cdroms should consult with the Image struct instead.

func (Storage) Validate

func (s Storage) Validate() error

Validate the Storage structure

type Transient

type Transient struct {
	Core   `json:",inline"`
	Images []Image `json:"images"`
}

Transient is for in-situ records that are usually being transformed.

func (Transient) Validate

func (t Transient) Validate() error

Validate the Transient structure

Jump to

Keyboard shortcuts

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