virtualmachine

package
v0.0.0-...-47977ad Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const ErrVMAlreadyExist = Error("Virtual Machine already exist")

Variables

This section is empty.

Functions

This section is empty.

Types

type ComputerResources

type ComputerResources struct {
	Path string
	Type ComputerResourcesType
}

type ComputerResourcesType

type ComputerResourcesType int
const (
	// Computer Resources Enum
	ComputerResourceInvalid ComputerResourcesType = iota
	ComputerResourceHost
	ComputerResourceCluster
	ComputerResourceResourcePool
)

type DatastoreType

type DatastoreType int
const (
	// Datastore Type Enum
	DatastoreInvalid DatastoreType = iota
	DatastoreCluster
	DatastoreDatastore
)

type Datastores

type Datastores struct {
	Type  DatastoreType
	Names []string
}

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type StatusStorager

type StatusStorager interface {
	NewTask() TaskStatuser
	FindByID(id string) TaskStatuser
}

StatusStorager represents behavior of storage that keeps deploy jobs statuses

type TaskStatuser

type TaskStatuser interface {
	ID() string
	Str(keyvals ...string) TaskStatuser
	StrArr(key string, arr []string) TaskStatuser
	Get() (statuses map[string]interface{})
}

TaskStatuser represents behavior of every single task

type VMDeploy

type VMDeploy struct {
	VMRepository
	// contains filtered or unexported fields
}

VMDeploy is a command that implements a usecase that deploy a Virtual Machine from OVA file.

func NewVMDeploy

func NewVMDeploy(r VMRepository, params VMDeployRequest) VMDeploy

func (*VMDeploy) Execute

func (d *VMDeploy) Execute() (VMDeployResponse, error)

type VMDeployRequest

type VMDeployRequest struct {
	Name       string
	Datacenter string
	OvaURL     string
	Folder     string
	Annotation string

	ComputerResources
	Datastores
}

type VMDeployResponse

type VMDeployResponse struct {
	TaskID string
}

type VMInfo

type VMInfo struct {
	VMRepository
	// contains filtered or unexported fields
}

VMInfo is a command that implements a usecase that requests information about a Virtual Machine.

func NewVMInfo

func NewVMInfo(r VMRepository, params VMInfoRequest) *VMInfo

func (*VMInfo) Execute

func (i *VMInfo) Execute() (VMInfoResponse, error)

Execute returns a Virtual Machine information

type VMInfoRequest

type VMInfoRequest struct {
	UUID string
}

type VMInfoResponse

type VMInfoResponse struct {
	Name             string
	UUID             string
	GuestID          string
	Annotation       string
	PowerState       string
	NumCPU           uint32
	NumEthernetCards uint32
	NumVirtualDisks  uint32
	Template         bool
	IPs              []string
}

type VMList

type VMList struct {
	VMRepository
	// contains filtered or unexported fields
}

VMList is a command that implements a usecase that retrieve Virtual Machines list.

func NewVMList

func NewVMList(r VMRepository, params VMListRequest) *VMList

func (*VMList) Execute

func (i *VMList) Execute() ([]VMListResponse, error)

Execute returns a Virtual Machine information

type VMListRequest

type VMListRequest struct {
	Datacenter   string
	Folder       string
	ResourcePool string
}

type VMListResponse

type VMListResponse struct {
	Name string
	UUID string
}

type VMRepository

type VMRepository interface {
	IsVMExist(context.Context, string, string) (bool, error)
	VMList(VMListRequest) ([]VMListResponse, error)
	VMInfo(uuid string) (VMInfoResponse, error)
	VMDeploy(context.Context, VMDeployRequest) (VMDeployResponse, error)
}

VMRepository describes abstract methods to interact with VMWare servers in Virtual Machine bounded context.

Directories

Path Synopsis
repository is a concrete implementations of virtualmachine/virtualmachine.VMRepository interface
repository is a concrete implementations of virtualmachine/virtualmachine.VMRepository interface

Jump to

Keyboard shortcuts

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