mac

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnkaStatusFail  = "FAIL"
	AnkaStatusError = "ERROR"
	AnkaStatusOK    = "OK"
)

Variables

This section is empty.

Functions

func CMDExecWrapper

func CMDExecWrapper(cmd *exec.Cmd, output *bytes.Buffer) error

Types

type AnkaCLI

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

func NewAnkaCLI

func NewAnkaCLI(executor CommandExecutor) *AnkaCLI

func (*AnkaCLI) ActivateLicense

func (ac *AnkaCLI) ActivateLicense(licenseKey string) error

func (*AnkaCLI) EnsureAnkaBin

func (ac *AnkaCLI) EnsureAnkaBin() error

func (*AnkaCLI) Exec

func (ac *AnkaCLI) Exec(vmID string, command []string) error

func (*AnkaCLI) PullImage

func (ac *AnkaCLI) PullImage(vmTemplateID string) error

func (*AnkaCLI) Show

func (ac *AnkaCLI) Show(vmID string) (VMShowOutput, error)

func (*AnkaCLI) Start

func (ac *AnkaCLI) Start(vmId string) (VMStartOutput, error)

func (*AnkaCLI) Stop

func (ac *AnkaCLI) Stop(vmId string) (VMStopOutput, error)

func (*AnkaCLI) ValidateLicense

func (ac *AnkaCLI) ValidateLicense() error

type AnkaRegistryClient

type AnkaRegistryClient struct{}

func NewAnkaRegistryClient

func NewAnkaRegistryClient() *AnkaRegistryClient

func (*AnkaRegistryClient) GetVMTemplate

func (cc *AnkaRegistryClient) GetVMTemplate(vmTemplateUrl string) (string, error)

type CommandExecutor

type CommandExecutor func(cmd *exec.Cmd, output *bytes.Buffer) error

type DeleteVMBody

type DeleteVMBody struct {
	VMID string `json:"id"`
}

type MacRuntime

type MacRuntime struct {
	metrics.AnkaMetricsProvider

	UnitsVMIDs *sync.Map
	// contains filtered or unexported fields
}

func NewMacRuntime

func NewMacRuntime(registryClient RegistryClient) *MacRuntime

func (*MacRuntime) ContainerStatus

func (m *MacRuntime) ContainerStatus(unitName, unitImage string) (*api.UnitStatus, error)

func (*MacRuntime) CreateContainer

func (m *MacRuntime) CreateContainer(unit api.Unit, spec *api.PodSpec, podName string, registryCredentials map[string]api.RegistryCredentials, useOverlayfs bool) (*api.UnitStatus, error)

func (*MacRuntime) GetLogBuffer

func (m *MacRuntime) GetLogBuffer(options runtime.LogOptions) (*logbuf.LogBuffer, error)

func (*MacRuntime) GetPid

func (m *MacRuntime) GetPid(unitName string) (int, bool)

func (*MacRuntime) RemoveContainer

func (m *MacRuntime) RemoveContainer(unit *api.Unit) error

func (*MacRuntime) RemovePodSandbox

func (m *MacRuntime) RemovePodSandbox(spec *api.PodSpec) error

func (*MacRuntime) RunPodSandbox

func (m *MacRuntime) RunPodSandbox(spec *api.PodSpec) error

func (*MacRuntime) SetPodNetwork

func (m *MacRuntime) SetPodNetwork(netNS, podIP string)

func (*MacRuntime) StartContainer

func (m *MacRuntime) StartContainer(unit api.Unit, spec *api.PodSpec, podName string) (*api.UnitStatus, error)

func (*MacRuntime) StopPodSandbox

func (m *MacRuntime) StopPodSandbox(spec *api.PodSpec) error

func (*MacRuntime) UnitRunning

func (m *MacRuntime) UnitRunning(unitName string) bool

type RegistryClient

type RegistryClient interface {
	GetVMTemplate(vmTemplateID string) (string, error)
}

type StartVMBody

type StartVMBody struct {
	VMID         string            `json:"vmid"`
	Tag          string            `json:"tag,omitempty"`
	Count        int               `json:"count,omitempty"`
	Name         string            `json:"name,omitempty"`
	CPU          int               `json:"vpcu,omitempty"`
	RAM          int               `json:"vram,omitempty"`
	NodeID       string            `json:"node_id,omitempty"`
	NameTemplate string            `json:"name_template,omitempty"`
	Metadata     map[string]string `json:"metadata,omitempty"`
}

type StartVMResp

type StartVMResp struct {
	VMRespBase
	IDs []string `json:"body"`
}

type VMCreateOutput

type VMCreateOutput struct {
	VMRespBase
	Body VMInfoBase `json:"body"`
}

type VMInfo

type VMInfo struct {
	VMInfoBase
	NodeID   string `json:"node_id"`
	CpuCores int    `json:"cpu_cores"`
	IP       string `json:"ip"`
	Status   string `json:"status"`
}

type VMInfoBase

type VMInfoBase struct {
	UUID string `json:"uuid"`
}

type VMPullOutput

type VMPullOutput struct {
	VMRespBase `json:",inline"`
}

type VMRespBase

type VMRespBase struct {
	Message string `json:"message"`
	Status  string `json:"status"`
}

type VMRunOutput

type VMRunOutput struct {
	VMRespBase `json:",inline"`
}

type VMShowBody

type VMShowBody struct {
	VMRespBase
	Name         string `json:"name"`
	CreationDate string `json:"creation_date"`
	CPUCores     int    `json:"cpu_cores"`
	CPUFrequency int    `json:"cpu_frequency"`
	CPUHtt       bool   `json:"cpu_htt"`
	RAM          string `json:"ram"`
	RAMSize      int    `json:"ram_size"`
	FrameBuffers int    `json:"frame_buffers"`
	HardDrive    int    `json:"hard_drive"`
	ImageSize    int    `json:"image_size"`
	Encrypted    bool   `json:"encrypted"`
	Status       string `json:"status"`
	StopDate     string `json:"stop_date"`
}

type VMShowOutput

type VMShowOutput struct {
	VMRespBase `json:",inline"`
	Body       VMShowBody `json:",inline"`
}

type VMStartOutput

type VMStartOutput struct {
	VMRespBase `json:",inline"`
	Body       VMShowBody `json:",inline"`
}

type VMStatusBody

type VMStatusBody struct {
	Progress int    `json:"progress"`
	VMInfo   VMInfo `json:"vminfo"`
}

type VMStatusEmptyResp

type VMStatusEmptyResp struct {
	VMRespBase
	Body []string `json:"body"`
}

type VMStatusResp

type VMStatusResp struct {
	VMRespBase
	Body VMStatusBody `json:"body,omitempty"`
}

type VMStopOutput

type VMStopOutput struct {
	VMRespBase `json:",inline"`
}

Jump to

Keyboard shortcuts

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