Documentation ¶
Overview ¶
Package knuu provides the core functionality of knuu.
Index ¶
- func Identifier() string
- func Initialize() error
- func InitializeWithIdentifier(uniqueIdentifier string) error
- type Executor
- type Instance
- func (i *Instance) AddFile(src string, dest string, chown string) error
- func (i *Instance) AddFileBytes(bytes []byte, dest string, chown string) error
- func (i *Instance) AddPortTCP(port int) error
- func (i *Instance) AddPortUDP(port int) error
- func (i *Instance) AddVolume(name string, size string) error
- func (i *Instance) Clone() (*Instance, error)
- func (i *Instance) Commit() error
- func (i *Instance) CreatePool(amount int) (*InstancePool, error)
- func (i *Instance) Destroy() error
- func (i *Instance) ExecuteCommand(command ...string) (string, error)
- func (i *Instance) GetFileBytes(file string) ([]byte, error)
- func (i *Instance) GetIP() (string, error)
- func (i *Instance) IsInState(states ...InstanceState) bool
- func (i *Instance) SetArgs(args ...string) error
- func (i *Instance) SetCPU(request string) error
- func (i *Instance) SetCommand(command []string) error
- func (i *Instance) SetEnvironmentVariable(key string, value string) error
- func (i *Instance) SetImage(image string) error
- func (i *Instance) SetMemory(request string, limit string) error
- func (i *Instance) Start() error
- func (i *Instance) WaitInstanceIsRunning() error
- type InstancePool
- type InstanceState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Identifier ¶ added in v0.4.0
func Identifier() string
Identifier returns the identifier of the current knuu instance
func Initialize ¶
func Initialize() error
Initialize initializes knuu Deprecated: Use InitializeWithIdentifier instead
func InitializeWithIdentifier ¶ added in v0.4.0
InitializeWithIdentifier initializes knuu with a unique identifier
Types ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
func NewExecutor ¶
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance represents a instance
func NewInstance ¶
NewInstance creates a new instance of the Instance struct
func (*Instance) AddFile ¶
AddFile adds a file to the instance This function can only be called in the state 'Preparing'
func (*Instance) AddFileBytes ¶
AddFileBytes adds a file with the given content to the instance This function can only be called in the state 'Preparing'
func (*Instance) AddPortTCP ¶
AddPortTCP adds a TCP port to the instance This function can be called in the states 'Preparing' and 'Committed'
func (*Instance) AddPortUDP ¶
AddPortUDP adds a UDP port to the instance This function can be called in the states 'Preparing' and 'Committed'
func (*Instance) AddVolume ¶
AddVolume adds a volume to the instance This function can only be called in the states 'Preparing' and 'Committed'
func (*Instance) Commit ¶
Commit commits the instance This function can only be called in the state 'Preparing'
func (*Instance) CreatePool ¶
func (i *Instance) CreatePool(amount int) (*InstancePool, error)
CreatePool creates a pool of instances This function can only be called in the state 'Committed'
func (*Instance) Destroy ¶
Destroy destroys the instance This function can only be called in the state 'Started' or 'Destroyed'
func (*Instance) ExecuteCommand ¶
ExecuteCommand executes the given command in the instance This function can only be called in the states 'Preparing' and 'Started'
func (*Instance) GetFileBytes ¶
GetFileBytes returns the content of the given file This function can only be called in the states 'Preparing' and 'Committed'
func (*Instance) GetIP ¶
GetIP returns the IP of the instance This function can only be called in the states 'Preparing' and 'Started'
func (*Instance) IsInState ¶
func (i *Instance) IsInState(states ...InstanceState) bool
IsInState checks if the instance is in one of the provided states
func (*Instance) SetArgs ¶
SetArgs sets the arguments passed to the instance This function can only be called in the states 'Preparing' or 'Committed'
func (*Instance) SetCPU ¶ added in v0.4.0
SetCPU sets the CPU of the instance This function can only be called in the states 'Preparing' and 'Committed'
func (*Instance) SetCommand ¶
SetCommand sets the command to run in the instance This function can only be called when the instance is in state 'Preparing' or 'Committed'
func (*Instance) SetEnvironmentVariable ¶
SetEnvironmentVariable sets the given environment variable in the instance This function can only be called in the states 'Preparing' and 'Committed'
func (*Instance) SetImage ¶
SetImage sets the image of the instance. It is only allowed in the 'None' and 'Started' states.
func (*Instance) SetMemory ¶ added in v0.4.0
SetMemory sets the memory of the instance This function can only be called in the states 'Preparing' and 'Committed'
func (*Instance) Start ¶
Start starts the instance This function can only be called in the state 'Committed'
func (*Instance) WaitInstanceIsRunning ¶
WaitInstanceIsRunning waits until the instance is running This function can only be called in the state 'Started'
type InstancePool ¶
type InstancePool struct {
// contains filtered or unexported fields
}
InstancePool is a struct that represents a pool of instances
func (*InstancePool) Destroy ¶
func (i *InstancePool) Destroy() error
Destroy destroys all instances in the instance pool
func (*InstancePool) Instances ¶
func (i *InstancePool) Instances() []*Instance
Instances returns the instances in the instance pool
func (*InstancePool) Start ¶
func (i *InstancePool) Start() error
Start starts all instances in the instance pool
func (*InstancePool) WaitInstancePoolIsRunning ¶
func (i *InstancePool) WaitInstancePoolIsRunning() error
WaitInstancePoolIsRunning waits until all instances in the instance pool are running
type InstanceState ¶ added in v0.3.0
type InstanceState int
InstanceState represents the state of the instance
const ( None InstanceState = iota Preparing Committed Started Destroyed )
Possible states of the instance
func (InstanceState) String ¶ added in v0.3.0
func (s InstanceState) String() string
String returns the string representation of the state