This change adds a new "agent mode" to GARM. The agent enables GARM to set up a persistent websocket connection between the garm server and the runners it spawns. The goal is to be able to easier keep track of state, even without subsequent webhooks from the forge. The Agent will report via websockets when the runner is actually online, when it started a job and when it finished a job. Additionally, the agent allows us to enable optional remote shell between the user and any runner that is spun up using agent mode. The remote shell is multiplexed over the same persistent websocket connection the agent sets up with the server (the agent never listens on a port). Enablement has also been done in the web UI for this functionality. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
197 lines
5.9 KiB
Go
197 lines
5.9 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package client
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"github.com/go-openapi/runtime"
|
|
httptransport "github.com/go-openapi/runtime/client"
|
|
"github.com/go-openapi/strfmt"
|
|
|
|
"github.com/cloudbase/garm/client/controller"
|
|
"github.com/cloudbase/garm/client/controller_info"
|
|
"github.com/cloudbase/garm/client/credentials"
|
|
"github.com/cloudbase/garm/client/endpoints"
|
|
"github.com/cloudbase/garm/client/enterprises"
|
|
"github.com/cloudbase/garm/client/first_run"
|
|
"github.com/cloudbase/garm/client/instances"
|
|
"github.com/cloudbase/garm/client/jobs"
|
|
"github.com/cloudbase/garm/client/login"
|
|
"github.com/cloudbase/garm/client/metrics_token"
|
|
"github.com/cloudbase/garm/client/objects"
|
|
"github.com/cloudbase/garm/client/organizations"
|
|
"github.com/cloudbase/garm/client/pools"
|
|
"github.com/cloudbase/garm/client/providers"
|
|
"github.com/cloudbase/garm/client/repositories"
|
|
"github.com/cloudbase/garm/client/scalesets"
|
|
"github.com/cloudbase/garm/client/templates"
|
|
"github.com/cloudbase/garm/client/tools"
|
|
)
|
|
|
|
// Default garm API HTTP client.
|
|
var Default = NewHTTPClient(nil)
|
|
|
|
const (
|
|
// DefaultHost is the default Host
|
|
// found in Meta (info) section of spec file
|
|
DefaultHost string = "localhost"
|
|
// DefaultBasePath is the default BasePath
|
|
// found in Meta (info) section of spec file
|
|
DefaultBasePath string = "/api/v1"
|
|
)
|
|
|
|
// DefaultSchemes are the default schemes found in Meta (info) section of spec file
|
|
var DefaultSchemes = []string{"http"}
|
|
|
|
// NewHTTPClient creates a new garm API HTTP client.
|
|
func NewHTTPClient(formats strfmt.Registry) *GarmAPI {
|
|
return NewHTTPClientWithConfig(formats, nil)
|
|
}
|
|
|
|
// NewHTTPClientWithConfig creates a new garm API HTTP client,
|
|
// using a customizable transport config.
|
|
func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *GarmAPI {
|
|
// ensure nullable parameters have default
|
|
if cfg == nil {
|
|
cfg = DefaultTransportConfig()
|
|
}
|
|
|
|
// create transport and client
|
|
transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
|
|
return New(transport, formats)
|
|
}
|
|
|
|
// New creates a new garm API client
|
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) *GarmAPI {
|
|
// ensure nullable parameters have default
|
|
if formats == nil {
|
|
formats = strfmt.Default
|
|
}
|
|
|
|
cli := new(GarmAPI)
|
|
cli.Transport = transport
|
|
cli.Controller = controller.New(transport, formats)
|
|
cli.ControllerInfo = controller_info.New(transport, formats)
|
|
cli.Credentials = credentials.New(transport, formats)
|
|
cli.Endpoints = endpoints.New(transport, formats)
|
|
cli.Enterprises = enterprises.New(transport, formats)
|
|
cli.FirstRun = first_run.New(transport, formats)
|
|
cli.Instances = instances.New(transport, formats)
|
|
cli.Jobs = jobs.New(transport, formats)
|
|
cli.Login = login.New(transport, formats)
|
|
cli.MetricsToken = metrics_token.New(transport, formats)
|
|
cli.Objects = objects.New(transport, formats)
|
|
cli.Organizations = organizations.New(transport, formats)
|
|
cli.Pools = pools.New(transport, formats)
|
|
cli.Providers = providers.New(transport, formats)
|
|
cli.Repositories = repositories.New(transport, formats)
|
|
cli.Scalesets = scalesets.New(transport, formats)
|
|
cli.Templates = templates.New(transport, formats)
|
|
cli.Tools = tools.New(transport, formats)
|
|
return cli
|
|
}
|
|
|
|
// DefaultTransportConfig creates a TransportConfig with the
|
|
// default settings taken from the meta section of the spec file.
|
|
func DefaultTransportConfig() *TransportConfig {
|
|
return &TransportConfig{
|
|
Host: DefaultHost,
|
|
BasePath: DefaultBasePath,
|
|
Schemes: DefaultSchemes,
|
|
}
|
|
}
|
|
|
|
// TransportConfig contains the transport related info,
|
|
// found in the meta section of the spec file.
|
|
type TransportConfig struct {
|
|
Host string
|
|
BasePath string
|
|
Schemes []string
|
|
}
|
|
|
|
// WithHost overrides the default host,
|
|
// provided by the meta section of the spec file.
|
|
func (cfg *TransportConfig) WithHost(host string) *TransportConfig {
|
|
cfg.Host = host
|
|
return cfg
|
|
}
|
|
|
|
// WithBasePath overrides the default basePath,
|
|
// provided by the meta section of the spec file.
|
|
func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {
|
|
cfg.BasePath = basePath
|
|
return cfg
|
|
}
|
|
|
|
// WithSchemes overrides the default schemes,
|
|
// provided by the meta section of the spec file.
|
|
func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
|
|
cfg.Schemes = schemes
|
|
return cfg
|
|
}
|
|
|
|
// GarmAPI is a client for garm API
|
|
type GarmAPI struct {
|
|
Controller controller.ClientService
|
|
|
|
ControllerInfo controller_info.ClientService
|
|
|
|
Credentials credentials.ClientService
|
|
|
|
Endpoints endpoints.ClientService
|
|
|
|
Enterprises enterprises.ClientService
|
|
|
|
FirstRun first_run.ClientService
|
|
|
|
Instances instances.ClientService
|
|
|
|
Jobs jobs.ClientService
|
|
|
|
Login login.ClientService
|
|
|
|
MetricsToken metrics_token.ClientService
|
|
|
|
Objects objects.ClientService
|
|
|
|
Organizations organizations.ClientService
|
|
|
|
Pools pools.ClientService
|
|
|
|
Providers providers.ClientService
|
|
|
|
Repositories repositories.ClientService
|
|
|
|
Scalesets scalesets.ClientService
|
|
|
|
Templates templates.ClientService
|
|
|
|
Tools tools.ClientService
|
|
|
|
Transport runtime.ClientTransport
|
|
}
|
|
|
|
// SetTransport changes the transport on the client and all its subresources
|
|
func (c *GarmAPI) SetTransport(transport runtime.ClientTransport) {
|
|
c.Transport = transport
|
|
c.Controller.SetTransport(transport)
|
|
c.ControllerInfo.SetTransport(transport)
|
|
c.Credentials.SetTransport(transport)
|
|
c.Endpoints.SetTransport(transport)
|
|
c.Enterprises.SetTransport(transport)
|
|
c.FirstRun.SetTransport(transport)
|
|
c.Instances.SetTransport(transport)
|
|
c.Jobs.SetTransport(transport)
|
|
c.Login.SetTransport(transport)
|
|
c.MetricsToken.SetTransport(transport)
|
|
c.Objects.SetTransport(transport)
|
|
c.Organizations.SetTransport(transport)
|
|
c.Pools.SetTransport(transport)
|
|
c.Providers.SetTransport(transport)
|
|
c.Repositories.SetTransport(transport)
|
|
c.Scalesets.SetTransport(transport)
|
|
c.Templates.SetTransport(transport)
|
|
c.Tools.SetTransport(transport)
|
|
}
|