Documentation ¶
Index ¶
- Variables
- func NewRouter(appCtx *AppContext) *mux.Router
- type AlertsController
- func (c *AlertsController) CreateAlert(r *http.Request, vars map[string]string, body interface{}) *Response
- func (c *AlertsController) DeleteAlert(r *http.Request, vars map[string]string, _ interface{}) *Response
- func (c *AlertsController) GetAlert(r *http.Request, vars map[string]string, _ interface{}) *Response
- func (c *AlertsController) ListAlerts(r *http.Request, vars map[string]string, _ interface{}) *Response
- func (c *AlertsController) UpdateAlert(r *http.Request, vars map[string]string, body interface{}) *Response
- type AppContext
- type ExperimentsController
- func (c ExperimentsController) ListExperimentEngineClients(r *http.Request, vars map[string]string, _ interface{}) *Response
- func (c ExperimentsController) ListExperimentEngineExperiments(r *http.Request, vars map[string]string, _ interface{}) *Response
- func (c ExperimentsController) ListExperimentEngineVariables(r *http.Request, vars map[string]string, _ interface{}) *Response
- func (c ExperimentsController) ListExperimentEngines(_ *http.Request, _ map[string]string, _ interface{}) *Response
- type Handler
- type PodLogController
- type Response
- func Accepted(data interface{}) *Response
- func BadRequest(description, msg string) *Response
- func Created(data interface{}) *Response
- func Error(code int, description string, msg string) *Response
- func InternalServerError(description, msg string) *Response
- func NotFound(description, msg string) *Response
- func Ok(data interface{}) *Response
- type Route
- type RouterVersionsController
- func (c RouterVersionsController) DeleteRouterVersion(r *http.Request, vars map[string]string, _ interface{}) *Response
- func (c RouterVersionsController) DeployRouterVersion(r *http.Request, vars map[string]string, body interface{}) *Response
- func (c RouterVersionsController) GetRouterVersion(r *http.Request, vars map[string]string, _ interface{}) *Response
- func (c RouterVersionsController) ListRouterVersions(r *http.Request, vars map[string]string, _ interface{}) *Response
- type RoutersController
- func (c RoutersController) CreateRouter(r *http.Request, vars map[string]string, body interface{}) *Response
- func (c RoutersController) DeleteRouter(r *http.Request, vars map[string]string, _ interface{}) *Response
- func (c RoutersController) DeployRouter(r *http.Request, vars map[string]string, body interface{}) *Response
- func (c RoutersController) GetRouter(r *http.Request, vars map[string]string, _ interface{}) *Response
- func (c RoutersController) ListRouterEvents(r *http.Request, vars map[string]string, body interface{}) *Response
- func (c RoutersController) ListRouters(r *http.Request, vars map[string]string, _ interface{}) *Response
- func (c RoutersController) UndeployRouter(r *http.Request, vars map[string]string, body interface{}) *Response
- func (c RoutersController) UpdateRouter(r *http.Request, vars map[string]string, body interface{}) *Response
Constants ¶
This section is empty.
Variables ¶
var ErrAlertDisabled = errors.New("alert is disabled in turing-api")
Functions ¶
func NewRouter ¶
func NewRouter(appCtx *AppContext) *mux.Router
NewRouter instantiates a mux.Router for this application.
Types ¶
type AlertsController ¶
type AlertsController struct {
// contains filtered or unexported fields
}
func (*AlertsController) CreateAlert ¶
func (*AlertsController) DeleteAlert ¶
func (*AlertsController) ListAlerts ¶
func (*AlertsController) UpdateAlert ¶
type AppContext ¶
type AppContext struct { Authorizer *middleware.Authorizer OpenAPIValidation *middleware.OpenAPIValidation // DAO DeploymentService service.DeploymentService RoutersService service.RoutersService RouterVersionsService service.RouterVersionsService EventService service.EventService AlertService service.AlertService // Default configuration for routers RouterDefaults *config.RouterDefaults CryptoService service.CryptoService MLPService service.MLPService ExperimentsService service.ExperimentsService PodLogService service.PodLogService }
AppContext stores the entities relating to the application's context
func NewAppContext ¶
func NewAppContext( db *gorm.DB, cfg *config.Config, authEnforcer *enforcer.Enforcer, vaultClient vault.VaultClient, ) (*AppContext, error)
NewAppContext is a creator for the app context
type ExperimentsController ¶
type ExperimentsController struct {
*AppContext
}
ExperimentsController implements the handlers for experiment related APIs
func (ExperimentsController) ListExperimentEngineClients ¶
func (c ExperimentsController) ListExperimentEngineClients( r *http.Request, vars map[string]string, _ interface{}, ) *Response
ListExperimentEngineClients returns a list of clients on the given experiment engine
func (ExperimentsController) ListExperimentEngineExperiments ¶
func (c ExperimentsController) ListExperimentEngineExperiments( r *http.Request, vars map[string]string, _ interface{}, ) *Response
ListExperimentEngineExperiments returns a list of experiments on the given experiment engine, optionally tied to the given client id
func (ExperimentsController) ListExperimentEngineVariables ¶
func (c ExperimentsController) ListExperimentEngineVariables( r *http.Request, vars map[string]string, _ interface{}, ) *Response
ListExperimentEngineVariables returns a list of variables for the given client and/or experiments
func (ExperimentsController) ListExperimentEngines ¶
func (c ExperimentsController) ListExperimentEngines( _ *http.Request, _ map[string]string, _ interface{}, ) *Response
ListExperimentEngines returns a list of available experiment engines
type PodLogController ¶
type PodLogController struct {
// contains filtered or unexported fields
}
func (*PodLogController) ListPodLogs ¶
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response contains the return code and data to return to the caller.
func Accepted ¶
func Accepted(data interface{}) *Response
Accepted returns an Response with status code 202.
func BadRequest ¶
BadRequest returns an Response with the error code 400.
func Created ¶
func Created(data interface{}) *Response
Created returns an Response with status code 201.
func InternalServerError ¶
InternalServerError returns an Response with the error code 500.
func (*Response) MarshalJSON ¶
MarshalJSON is a custom marshaler for the unexported fields
func (*Response) WriteTo ¶
func (r *Response) WriteTo(w http.ResponseWriter)
WriteTo writes an Response to the provided http.ResponseWriter.
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route is a http route for the API.
func (Route) HandlerFunc ¶
func (route Route) HandlerFunc(validator *val.Validate) http.HandlerFunc
HandlerFunc returns the HandlerFunc for this route, which validates the request and executes the route's Handler on the request, returning its response.
type RouterVersionsController ¶
type RouterVersionsController struct {
// contains filtered or unexported fields
}
func (RouterVersionsController) DeleteRouterVersion ¶
func (c RouterVersionsController) DeleteRouterVersion( r *http.Request, vars map[string]string, _ interface{}, ) *Response
DeleteRouterVersion deletes the config for the given version number.
func (RouterVersionsController) DeployRouterVersion ¶
func (c RouterVersionsController) DeployRouterVersion( r *http.Request, vars map[string]string, body interface{}, ) *Response
DeployRouterVersion deploys the given router version into the associated kubernetes cluster
func (RouterVersionsController) GetRouterVersion ¶
func (c RouterVersionsController) GetRouterVersion( r *http.Request, vars map[string]string, _ interface{}, ) *Response
GetRouterVersion gets the router version for the provided router id and version number.
func (RouterVersionsController) ListRouterVersions ¶
func (c RouterVersionsController) ListRouterVersions( r *http.Request, vars map[string]string, _ interface{}, ) *Response
ListRouterVersions lists the router versions of the provided router.
type RoutersController ¶
type RoutersController struct {
// contains filtered or unexported fields
}
func (RoutersController) CreateRouter ¶
func (c RoutersController) CreateRouter( r *http.Request, vars map[string]string, body interface{}, ) *Response
CreateRouter creates a router from the provided configuration. If there already exists a router within the provided project with the same name, this method will throw an error. If not, a new Router and associated RouterVersion will be created and deployed.
func (RoutersController) DeleteRouter ¶
func (c RoutersController) DeleteRouter( r *http.Request, vars map[string]string, _ interface{}, ) *Response
DeleteRouter deletes a router and all its associated versions.
func (RoutersController) DeployRouter ¶
func (c RoutersController) DeployRouter( r *http.Request, vars map[string]string, body interface{}, ) *Response
DeployRouter deploys the current version of the given router into the associated kubernetes cluster. If there is no current version, an error is returned.
func (RoutersController) GetRouter ¶
func (c RoutersController) GetRouter( r *http.Request, vars map[string]string, _ interface{}, ) *Response
GetRouter gets a router matching the provided routerID.
func (RoutersController) ListRouterEvents ¶
func (RoutersController) ListRouters ¶
func (c RoutersController) ListRouters( r *http.Request, vars map[string]string, _ interface{}, ) *Response
ListRouters lists all routers configured in the provided project. If none are found, an error will be thrown.
func (RoutersController) UndeployRouter ¶
func (c RoutersController) UndeployRouter( r *http.Request, vars map[string]string, body interface{}, ) *Response
UndeployRouter deletes the given router specs from the associated kubernetes cluster
func (RoutersController) UpdateRouter ¶
func (c RoutersController) UpdateRouter(r *http.Request, vars map[string]string, body interface{}) *Response
UpdateRouter updates a router from the provided configuration. If no router exists within the provided project with the provided id, this method will throw an error. If the update is valid, a new RouterVersion will be created and deployed.