nodeclient

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 22 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SAVE_LOG_BYTES           = 4096
	MULTIPART_PKG_FIELD_NAME = "package"
	ItzoPort                 = 6421
	ServerName               = "MilpaNode"
)

Functions

func AttachEndpoint

func AttachEndpoint() string

func ExecEndpoint

func ExecEndpoint() string

func PortForwardEndpoint

func PortForwardEndpoint() string

func StreamLogsEndpoint

func StreamLogsEndpoint(unitName string, withMetadata bool) string

Types

type ItzoClient

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

func NewItzoClient

func NewItzoClient(instanceIp string, tlsConfig *tls.Config) *ItzoClient

func NewItzoWithClient

func NewItzoWithClient(serverURL string, client *http.Client) *ItzoClient

Used in testing, not sure if this is kosher

func (*ItzoClient) Deploy

func (c *ItzoClient) Deploy(pod, name string, data io.Reader) error

func (*ItzoClient) GetFile

func (c *ItzoClient) GetFile(path string, lines, bytes int) ([]byte, error)

func (*ItzoClient) GetLogs

func (c *ItzoClient) GetLogs(unit string, lines, bytes int) ([]byte, error)

func (*ItzoClient) GetStatus

func (c *ItzoClient) GetStatus() (*api.PodStatusReply, error)

func (*ItzoClient) Healthcheck

func (c *ItzoClient) Healthcheck() error

func (*ItzoClient) ResizeVolume

func (c *ItzoClient) ResizeVolume() error

func (*ItzoClient) UpdateUnits

func (c *ItzoClient) UpdateUnits(pp api.PodParameters) error

type ItzoClientFactory

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

func NewItzoFactory

func NewItzoFactory(rootCert *x509.Certificate, cert tls.Certificate, defaultToPublicIP bool) *ItzoClientFactory

func (*ItzoClientFactory) DeleteClient

func (fac *ItzoClientFactory) DeleteClient(addy []api.NetworkAddress)

func (*ItzoClientFactory) GetClient

func (fac *ItzoClientFactory) GetClient(addy []api.NetworkAddress) NodeClient

func (*ItzoClientFactory) GetWSStream

func (fac *ItzoClientFactory) GetWSStream(addy []api.NetworkAddress, path string) (*wsstream.WSStream, error)

type ItzoClientFactoryer

type ItzoClientFactoryer interface {
	// We pass in the whole NetworkAddress here since we might want to
	// connect to either the public or private IP of the node/pod,
	// depending on whether we are inside the cloud network
	GetClient([]api.NetworkAddress) NodeClient
	GetWSStream([]api.NetworkAddress, string) (*wsstream.WSStream, error)
	DeleteClient([]api.NetworkAddress)
}

type MockItzoClientFactory

type MockItzoClientFactory struct {
	Health        func() error
	Logs          func(unit string, lines, bytes int) ([]byte, error)
	File          func(unit string, lines, bytes int) ([]byte, error)
	Resize        func() error
	Status        func() (*api.PodStatusReply, error)
	Update        func(pp api.PodParameters) error
	DeployPackage func(pod, name string, data io.Reader) error
}

func NewMockItzoClientFactory

func NewMockItzoClientFactory() *MockItzoClientFactory

func (*MockItzoClientFactory) DeleteClient

func (a *MockItzoClientFactory) DeleteClient(addy []api.NetworkAddress)

screw it, make the factory implement the interface as well...

func (*MockItzoClientFactory) Deploy

func (a *MockItzoClientFactory) Deploy(pod, name string, data io.Reader) error

func (*MockItzoClientFactory) GetClient

func (a *MockItzoClientFactory) GetClient(addy []api.NetworkAddress) NodeClient

screw it, make the factory implement the interface as well...

func (*MockItzoClientFactory) GetFile

func (a *MockItzoClientFactory) GetFile(unit string, lines, bytes int) ([]byte, error)

func (*MockItzoClientFactory) GetLogs

func (a *MockItzoClientFactory) GetLogs(unit string, lines, bytes int) ([]byte, error)

func (*MockItzoClientFactory) GetStatus

func (a *MockItzoClientFactory) GetStatus() (*api.PodStatusReply, error)

func (*MockItzoClientFactory) GetWSStream

func (a *MockItzoClientFactory) GetWSStream(addy []api.NetworkAddress, path string) (*wsstream.WSStream, error)

func (*MockItzoClientFactory) Healthcheck

func (a *MockItzoClientFactory) Healthcheck() error

func (*MockItzoClientFactory) ResizeVolume

func (a *MockItzoClientFactory) ResizeVolume() error

func (*MockItzoClientFactory) UpdateUnits

func (a *MockItzoClientFactory) UpdateUnits(pp api.PodParameters) error

type NodeClient

type NodeClient interface {
	Healthcheck() error
	GetLogs(unit string, lines, bytes int) ([]byte, error)
	GetFile(filepath string, lines, bytes int) ([]byte, error)
	ResizeVolume() error
	GetStatus() (*api.PodStatusReply, error)
	UpdateUnits(api.PodParameters) error
	Deploy(pod, name string, data io.Reader) error
}

Jump to

Keyboard shortcuts

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