Documentation ¶
Index ¶
- func BuildHostInstance(in *compute.Instance) (*apiv1.HostInstance, error)
- func EncodeOperationName(opType OPType, host string) string
- type Config
- type DockerIMConfig
- type DockerInstanceManager
- func (m *DockerInstanceManager) CreateHost(zone string, _ *apiv1.CreateHostRequest, user accounts.User) (*apiv1.Operation, error)
- func (m *DockerInstanceManager) DeleteHost(zone string, user accounts.User, host string) (*apiv1.Operation, error)
- func (m *DockerInstanceManager) GetHostClient(zone string, host string) (HostClient, error)
- func (m *DockerInstanceManager) ListHosts(zone string, user accounts.User, _ *ListHostsRequest) (*apiv1.ListHostsResponse, error)
- func (m *DockerInstanceManager) ListZones() (*apiv1.ListZonesResponse, error)
- func (m *DockerInstanceManager) WaitOperation(zone string, _ accounts.User, name string) (any, error)
- type GCEInstanceManager
- func (m *GCEInstanceManager) CreateHost(zone string, req *apiv1.CreateHostRequest, user accounts.User) (*apiv1.Operation, error)
- func (m *GCEInstanceManager) DeleteHost(zone string, user accounts.User, name string) (*apiv1.Operation, error)
- func (m *GCEInstanceManager) GetHostAddr(zone string, host string) (string, error)
- func (m *GCEInstanceManager) GetHostClient(zone string, host string) (HostClient, error)
- func (m *GCEInstanceManager) GetHostURL(zone string, host string) (*url.URL, error)
- func (m *GCEInstanceManager) ListHosts(zone string, user accounts.User, req *ListHostsRequest) (*apiv1.ListHostsResponse, error)
- func (m *GCEInstanceManager) ListZones() (*apiv1.ListZonesResponse, error)
- func (m *GCEInstanceManager) WaitOperation(zone string, user accounts.User, name string) (any, error)
- type GCPIMConfig
- type HostClient
- type HostResponse
- type IMType
- type InstanceNameGenerator
- type ListHostsRequest
- type LocalInstanceManager
- func (m *LocalInstanceManager) CreateHost(_ string, _ *apiv1.CreateHostRequest, _ accounts.User) (*apiv1.Operation, error)
- func (m *LocalInstanceManager) DeleteHost(zone string, user accounts.User, name string) (*apiv1.Operation, error)
- func (m *LocalInstanceManager) GetHostAddr(_ string, _ string) (string, error)
- func (m *LocalInstanceManager) GetHostClient(zone string, host string) (HostClient, error)
- func (m *LocalInstanceManager) GetHostURL(zone string, host string) (*url.URL, error)
- func (m *LocalInstanceManager) ListHosts(zone string, user accounts.User, req *ListHostsRequest) (*apiv1.ListHostsResponse, error)
- func (m *LocalInstanceManager) ListZones() (*apiv1.ListZonesResponse, error)
- func (m *LocalInstanceManager) WaitOperation(zone string, user accounts.User, name string) (any, error)
- type Manager
- type NameGenerator
- type NetHostClient
- type OPType
- type UNIXIMConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildHostInstance ¶
func BuildHostInstance(in *compute.Instance) (*apiv1.HostInstance, error)
func EncodeOperationName ¶
Types ¶
type Config ¶
type Config struct { Type IMType // The protocol the host orchestrator expects, either http or https HostOrchestratorProtocol string AllowSelfSignedHostSSLCertificate bool GCP *GCPIMConfig UNIX *UNIXIMConfig Docker *DockerIMConfig }
type DockerIMConfig ¶
type DockerInstanceManager ¶
Docker implementation of the instance manager.
func NewDockerInstanceManager ¶
func NewDockerInstanceManager(cfg Config, cli client.Client) *DockerInstanceManager
func (*DockerInstanceManager) CreateHost ¶
func (m *DockerInstanceManager) CreateHost(zone string, _ *apiv1.CreateHostRequest, user accounts.User) (*apiv1.Operation, error)
func (*DockerInstanceManager) DeleteHost ¶
func (*DockerInstanceManager) GetHostClient ¶
func (m *DockerInstanceManager) GetHostClient(zone string, host string) (HostClient, error)
func (*DockerInstanceManager) ListHosts ¶
func (m *DockerInstanceManager) ListHosts(zone string, user accounts.User, _ *ListHostsRequest) (*apiv1.ListHostsResponse, error)
func (*DockerInstanceManager) ListZones ¶
func (m *DockerInstanceManager) ListZones() (*apiv1.ListZonesResponse, error)
func (*DockerInstanceManager) WaitOperation ¶
type GCEInstanceManager ¶
type GCEInstanceManager struct { Config Config Service *compute.Service InstanceNameGenerator NameGenerator }
GCP implementation of the instance manager.
func NewGCEInstanceManager ¶
func NewGCEInstanceManager(cfg Config, service *compute.Service, nameGenerator NameGenerator) *GCEInstanceManager
func (*GCEInstanceManager) CreateHost ¶
func (m *GCEInstanceManager) CreateHost(zone string, req *apiv1.CreateHostRequest, user accounts.User) (*apiv1.Operation, error)
func (*GCEInstanceManager) DeleteHost ¶
func (*GCEInstanceManager) GetHostAddr ¶
func (m *GCEInstanceManager) GetHostAddr(zone string, host string) (string, error)
func (*GCEInstanceManager) GetHostClient ¶
func (m *GCEInstanceManager) GetHostClient(zone string, host string) (HostClient, error)
func (*GCEInstanceManager) GetHostURL ¶
func (*GCEInstanceManager) ListHosts ¶
func (m *GCEInstanceManager) ListHosts(zone string, user accounts.User, req *ListHostsRequest) (*apiv1.ListHostsResponse, error)
func (*GCEInstanceManager) ListZones ¶
func (m *GCEInstanceManager) ListZones() (*apiv1.ListZonesResponse, error)
func (*GCEInstanceManager) WaitOperation ¶
type GCPIMConfig ¶
type HostClient ¶
type HostClient interface { // Get and Post requests return the HTTP status code or an error. // The response body is parsed into the res output parameter if provided. Get(URLPath, URLQuery string, res *HostResponse) (int, error) Post(URLPath, URLQuery string, bodyJSON any, res *HostResponse) (int, error) GetReverseProxy() *httputil.ReverseProxy }
type HostResponse ¶
type IMType ¶
type IMType string
const DockerIMType IMType = "docker"
const GCEIMType IMType = "GCP"
const UnixIMType IMType = "unix"
type InstanceNameGenerator ¶
type InstanceNameGenerator struct {
UUIDFactory func() string
}
func (*InstanceNameGenerator) NewName ¶
func (g *InstanceNameGenerator) NewName() string
type ListHostsRequest ¶
type ListHostsRequest struct { // The maximum number of results per page that should be returned. If the number of available results is larger // than MaxResults, a `NextPageToken` will be returned which can be used to get the next page of results // in subsequent List requests. MaxResults uint32 // Specifies a page token to use. // Use the `NextPageToken` value returned by a previous List request. PageToken string }
type LocalInstanceManager ¶
type LocalInstanceManager struct {
// contains filtered or unexported fields
}
Implements the Manager interface providing access to the first device in the local host orchestrator. This implementation is useful for both development and testing
func NewLocalInstanceManager ¶
func NewLocalInstanceManager(cfg Config) *LocalInstanceManager
func (*LocalInstanceManager) CreateHost ¶
func (m *LocalInstanceManager) CreateHost(_ string, _ *apiv1.CreateHostRequest, _ accounts.User) (*apiv1.Operation, error)
func (*LocalInstanceManager) DeleteHost ¶
func (*LocalInstanceManager) GetHostAddr ¶
func (m *LocalInstanceManager) GetHostAddr(_ string, _ string) (string, error)
func (*LocalInstanceManager) GetHostClient ¶
func (m *LocalInstanceManager) GetHostClient(zone string, host string) (HostClient, error)
func (*LocalInstanceManager) GetHostURL ¶
func (*LocalInstanceManager) ListHosts ¶
func (m *LocalInstanceManager) ListHosts(zone string, user accounts.User, req *ListHostsRequest) (*apiv1.ListHostsResponse, error)
func (*LocalInstanceManager) ListZones ¶
func (m *LocalInstanceManager) ListZones() (*apiv1.ListZonesResponse, error)
func (*LocalInstanceManager) WaitOperation ¶
type Manager ¶
type Manager interface { // List zones ListZones() (*apiv1.ListZonesResponse, error) // Creates a host instance. CreateHost(zone string, req *apiv1.CreateHostRequest, user accounts.User) (*apiv1.Operation, error) // List hosts ListHosts(zone string, user accounts.User, req *ListHostsRequest) (*apiv1.ListHostsResponse, error) // Deletes the given host instance. DeleteHost(zone string, user accounts.User, name string) (*apiv1.Operation, error) // Waits until operation is DONE or earlier. If DONE return the expected response of the operation. If the // original method returns no data on success, such as `Delete`, response will be empty. If the original method // is standard `Get`/`Create`/`Update`, the response should be the relevant resource. WaitOperation(zone string, user accounts.User, name string) (any, error) // Creates a connector to the given host. GetHostClient(zone string, host string) (HostClient, error) }
type NameGenerator ¶
type NameGenerator interface {
NewName() string
}
type NetHostClient ¶
type NetHostClient struct {
// contains filtered or unexported fields
}
func NewNetHostClient ¶
func NewNetHostClient(url *url.URL, allowSelfSigned bool) *NetHostClient
func (*NetHostClient) Get ¶
func (c *NetHostClient) Get(path, query string, out *HostResponse) (int, error)
func (*NetHostClient) GetReverseProxy ¶
func (c *NetHostClient) GetReverseProxy() *httputil.ReverseProxy
func (*NetHostClient) Post ¶
func (c *NetHostClient) Post(path, query string, bodyJSON any, out *HostResponse) (int, error)
type UNIXIMConfig ¶
type UNIXIMConfig struct {
HostOrchestratorPort int
}
Click to show internal directories.
Click to hide internal directories.