Documentation ¶
Index ¶
- Variables
- func ImageCommand(i Image, name string, arg ...string) *exec.Cmd
- func ImageRealPath(i Image, path string) string
- func IsImageAlive(md *machine1.Conn, name string) (bool, error)
- func PrintHelp(desc string, commandGroups []CommandGroup)
- func PrintInvalidCommand(name string)
- func ReadTag(tag string) (target string, err error)
- func RunCommand(args []string, commandGroups []CommandGroup) int
- func Tag(tag string, image Image) error
- func UnTag(tag string) (target string, err error)
- type Column
- type Command
- type CommandGroup
- type Image
- type ImageCtl
- type ImageGetter
- type LayeredImage
- func (i *LayeredImage) Alive() bool
- func (i LayeredImage) BaseLayers() []string
- func (i *LayeredImage) Command(name string, arg ...string) *exec.Cmd
- func (i LayeredImage) LayerFSRoot() string
- func (i LayeredImage) LayerPath(path string) string
- func (i LayeredImage) LayerRoot() string
- func (i *LayeredImage) Name() string
- func (i *LayeredImage) Optimize(statusCb func(string), errorCb func(error))
- func (i *LayeredImage) Path() string
- func (i *LayeredImage) ReadOnly() bool
- func (i *LayeredImage) Ready() bool
- func (i *LayeredImage) RealPath(path string) string
- func (i *LayeredImage) Rebase(newBase Image) error
- func (i *LayeredImage) Remove() error
- func (i *LayeredImage) SetReadOnly(readOnly bool) error
- func (i *LayeredImage) SetReady(ready bool) error
- func (i *LayeredImage) Type() string
- func (i *LayeredImage) Update() error
- type LayeredImageCtl
- type MachineCtl
- type MdImage
- func (i *MdImage) Alive() bool
- func (i *MdImage) Command(name string, arg ...string) *exec.Cmd
- func (i *MdImage) Name() string
- func (i *MdImage) Optimize(statusCb func(string), errorCb func(error))
- func (i *MdImage) Path() string
- func (i *MdImage) ReadOnly() bool
- func (i *MdImage) Ready() bool
- func (i *MdImage) RealPath(path string) string
- func (i *MdImage) Remove() error
- func (i *MdImage) SetReadOnly(readOnly bool) error
- func (i *MdImage) SetReady(ready bool) error
- func (i *MdImage) Type() string
- func (i *MdImage) Update() error
- type StdImage
- func (i *StdImage) Alive() bool
- func (i *StdImage) Command(name string, arg ...string) *exec.Cmd
- func (i *StdImage) Name() string
- func (i *StdImage) Optimize(statusCb func(string), errorCb func(error))
- func (i *StdImage) Path() string
- func (i *StdImage) ReadOnly() bool
- func (i *StdImage) Ready() bool
- func (i *StdImage) RealPath(path string) string
- func (i *StdImage) Remove() error
- func (i *StdImage) SetReadOnly(readOnly bool) error
- func (i *StdImage) SetReady(ready bool) error
- func (i *StdImage) Type() string
- func (i *StdImage) Update() error
Constants ¶
This section is empty.
Variables ¶
View Source
var BoolValues = map[string]bool{ "1": true, "y": true, "yes": true, "true": true, "Y": true, "YES": true, "TRUE": true, "0": false, "n": false, "no": false, "false": false, "N": false, "NO": false, "FALSE": false, }
View Source
var CmdCreate = Command{[]string{"new"}, "create", []string{"NAME"}, []string{"BASE_NAME"}, "Create a new image", cmdCreate}
View Source
var CmdList = Command{[]string{"ls", "list-images", "images"}, "list", nil, nil, "Show available container and VM images", cmdList}
machinectl list-images / docker images
View Source
var CmdRebase = Command{nil, "rebase", []string{"NAME", "NEW_BASE"}, nil, "Change the base image of an image", cmdRebase}
View Source
var CmdRemove = Command{[]string{"rm"}, "remove", []string{"NAME..."}, nil, "Remove an image", cmdRemove}
View Source
var CmdSetReadOnly = Command{[]string{"ro", "read-only"}, "set-read-only", []string{"NAME"}, []string{"BOOL"}, "Mark or unmark image read-only", cmdSetReadOnly}
View Source
var CmdSetReady = Command{nil, "set-ready", []string{"NAME"}, []string{"BOOL"}, "Assemble or disassemble layered image", cmdSetReady}
View Source
var CmdTag = Command{nil, "tag", []string{"TAG", "NAME"}, nil, "Create an alias for the image", cmdTag}
View Source
var Commands = []Command{CmdCreate, CmdTag, CmdSetReadOnly, CmdSetReady, CmdRemove, CmdList, CmdRebase}
View Source
var ErrBaseDoesNotExist = errors.New("base image does not exist") // for CreateImage()
View Source
var ErrBaseWritable = errors.New("base image is writable") // for CreateImage()
View Source
var ErrImageAlive = errors.New("image is alive") // for hard actions
View Source
var ErrImageExists = errors.New("image already exists") // for CreateImage()
View Source
var ErrImpossible = errors.New("impossible") // for SetReady(true)
View Source
var ErrNoSuchImage = errors.New("org.freedesktop.machine1.NoSuchImage") // for GetImage() and Update
View Source
var ErrNotATag = errors.New("not a tag")
Functions ¶
func ImageRealPath ¶
func PrintHelp ¶
func PrintHelp(desc string, commandGroups []CommandGroup)
func PrintInvalidCommand ¶
func PrintInvalidCommand(name string)
func RunCommand ¶
func RunCommand(args []string, commandGroups []CommandGroup) int
Types ¶
type Command ¶
type Command struct { Shortcuts []string Name string ReqArgs []string OptArgs []string Description string Executor func(args []string) int }
func (Command) ArgsDescription ¶
type CommandGroup ¶
type Image ¶
type Image interface { // org.freedesktop.machine1.Image properties (subset) Name() string Path() string Type() string ReadOnly() bool // Custom properties Ready() bool // Is ready to use? (In case of layered images: is it mounted?) Alive() bool // Is our image used as a machined's container? // Soft actions Update() error // Reload all properties // Hard actions Remove() error SetReadOnly(bool) error SetReady(bool) error Optimize(statusCb func(string), errorCb func(error)) // Utilities RealPath(path string) string Command(name string, arg ...string) *exec.Cmd }
type ImageCtl ¶
type ImageCtl struct {
// contains filtered or unexported fields
}
func (*ImageCtl) CreateImage ¶
func (*ImageCtl) ListImages ¶
type ImageGetter ¶
type LayeredImage ¶
type LayeredImage struct {
// contains filtered or unexported fields
}
func (*LayeredImage) Alive ¶
func (i *LayeredImage) Alive() bool
func (LayeredImage) BaseLayers ¶
func (i LayeredImage) BaseLayers() []string
func (LayeredImage) LayerFSRoot ¶
func (i LayeredImage) LayerFSRoot() string
func (LayeredImage) LayerPath ¶
func (i LayeredImage) LayerPath(path string) string
func (LayeredImage) LayerRoot ¶
func (i LayeredImage) LayerRoot() string
func (*LayeredImage) Name ¶
func (i *LayeredImage) Name() string
func (*LayeredImage) Optimize ¶
func (i *LayeredImage) Optimize(statusCb func(string), errorCb func(error))
func (*LayeredImage) Path ¶
func (i *LayeredImage) Path() string
func (*LayeredImage) ReadOnly ¶
func (i *LayeredImage) ReadOnly() bool
func (*LayeredImage) Ready ¶
func (i *LayeredImage) Ready() bool
func (*LayeredImage) RealPath ¶
func (i *LayeredImage) RealPath(path string) string
func (*LayeredImage) Rebase ¶
func (i *LayeredImage) Rebase(newBase Image) error
func (*LayeredImage) Remove ¶
func (i *LayeredImage) Remove() error
func (*LayeredImage) SetReadOnly ¶
func (i *LayeredImage) SetReadOnly(readOnly bool) error
func (*LayeredImage) SetReady ¶
func (i *LayeredImage) SetReady(ready bool) error
func (*LayeredImage) Type ¶
func (i *LayeredImage) Type() string
func (*LayeredImage) Update ¶
func (i *LayeredImage) Update() error
type LayeredImageCtl ¶
type LayeredImageCtl struct {
// contains filtered or unexported fields
}
func NewLayeredImageCtl ¶
func NewLayeredImageCtl(md *machine1.Conn, getAnyImage ImageGetter) (LayeredImageCtl, error)
func (LayeredImageCtl) CreateImage ¶
func (lictl LayeredImageCtl) CreateImage(name string, base Image) (LayeredImage, error)
func (LayeredImageCtl) GetImage ¶
func (lictl LayeredImageCtl) GetImage(name string) (LayeredImage, error)
func (LayeredImageCtl) ListImages ¶
func (lictl LayeredImageCtl) ListImages() ([]LayeredImage, error)
type MachineCtl ¶
type MachineCtl struct {
// contains filtered or unexported fields
}
func NewMachineCtl ¶
func NewMachineCtl() (MachineCtl, error)
func (MachineCtl) CreateImage ¶
func (mctl MachineCtl) CreateImage(name string, base Image) (MdImage, error)
func (MachineCtl) ListImages ¶
func (mctl MachineCtl) ListImages() ([]MdImage, error)
type MdImage ¶
type MdImage struct {
// contains filtered or unexported fields
}
func (*MdImage) SetReadOnly ¶
type StdImage ¶
type StdImage struct {
// contains filtered or unexported fields
}
func (*StdImage) SetReadOnly ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.