v1

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package v1 is the implementation of Epinio's API v1 It has the router and controllers (handler funcs) for the API server.

Index

Constants

View Source
const (
	// Root is the url path prefix for all API endpoints.
	Root = "/api/v1"
	// WsRoot is the url path prefix for all websocket API endpoints.
	WsRoot = "/wapi/v1"
)

Variables

View Source
var Routes = routes.NamedRoutes{
	"Info":      get("/info", errorHandler(Info)),
	"AuthToken": get("/authtoken", errorHandler(AuthToken)),

	"AllApps":         get("/applications", errorHandler(application.Controller{}.FullIndex)),
	"Apps":            get("/namespaces/:namespace/applications", errorHandler(application.Controller{}.Index)),
	"AppCreate":       post("/namespaces/:namespace/applications", errorHandler(application.Controller{}.Create)),
	"AppShow":         get("/namespaces/:namespace/applications/:app", errorHandler(application.Controller{}.Show)),
	"StagingComplete": get("/namespaces/:namespace/staging/:stage_id/complete", errorHandler(application.Controller{}.Staged)),
	"AppDelete":       delete("/namespaces/:namespace/applications/:app", errorHandler(application.Controller{}.Delete)),
	"AppUpload":       post("/namespaces/:namespace/applications/:app/store", errorHandler(application.Controller{}.Upload)),
	"AppImportGit":    post("/namespaces/:namespace/applications/:app/import-git", errorHandler(application.Controller{}.ImportGit)),
	"AppStage":        post("/namespaces/:namespace/applications/:app/stage", errorHandler(application.Controller{}.Stage)),
	"AppDeploy":       post("/namespaces/:namespace/applications/:app/deploy", errorHandler(application.Controller{}.Deploy)),
	"AppRestart":      post("/namespaces/:namespace/applications/:app/restart", errorHandler(application.Controller{}.Restart)),
	"AppUpdate":       patch("/namespaces/:namespace/applications/:app", errorHandler(application.Controller{}.Update)),
	"AppRunning":      get("/namespaces/:namespace/applications/:app/running", errorHandler(application.Controller{}.Running)),

	"EnvList": get("/namespaces/:namespace/applications/:app/environment", errorHandler(env.Controller{}.Index)),

	"EnvMatch":  get("/namespaces/:namespace/applications/:app/environmentmatch/:pattern", errorHandler(env.Controller{}.Match)),
	"EnvMatch0": get("/namespaces/:namespace/applications/:app/environmentmatch", errorHandler(env.Controller{}.Match)),

	"EnvSet":   post("/namespaces/:namespace/applications/:app/environment", errorHandler(env.Controller{}.Set)),
	"EnvShow":  get("/namespaces/:namespace/applications/:app/environment/:env", errorHandler(env.Controller{}.Show)),
	"EnvUnset": delete("/namespaces/:namespace/applications/:app/environment/:env", errorHandler(env.Controller{}.Unset)),

	"ServiceBindingCreate": post("/namespaces/:namespace/applications/:app/servicebindings",
		errorHandler(servicebinding.Controller{}.Create)),
	"ServiceBindingDelete": delete("/namespaces/:namespace/applications/:app/servicebindings/:service",
		errorHandler(servicebinding.Controller{}.Delete)),

	"Namespaces":      get("/namespaces", errorHandler(namespace.Controller{}.Index)),
	"NamespaceCreate": post("/namespaces", errorHandler(namespace.Controller{}.Create)),
	"NamespaceDelete": delete("/namespaces/:namespace", errorHandler(namespace.Controller{}.Delete)),
	"NamespaceShow":   get("/namespaces/:namespace", errorHandler(namespace.Controller{}.Show)),

	"NamespacesMatch":  get("/namespacematches/:pattern", errorHandler(namespace.Controller{}.Match)),
	"NamespacesMatch0": get("/namespacematches", errorHandler(namespace.Controller{}.Match)),

	"ServiceApps": get("/namespaces/:namespace/serviceapps", errorHandler(service.Controller{}.ServiceApps)),

	"AllServices":    get("/services", errorHandler(service.Controller{}.FullIndex)),
	"Services":       get("/namespaces/:namespace/services", errorHandler(service.Controller{}.Index)),
	"ServiceShow":    get("/namespaces/:namespace/services/:service", errorHandler(service.Controller{}.Show)),
	"ServiceCreate":  post("/namespaces/:namespace/services", errorHandler(service.Controller{}.Create)),
	"ServiceDelete":  delete("/namespaces/:namespace/services/:service", errorHandler(service.Controller{}.Delete)),
	"ServiceUpdate":  patch("/namespaces/:namespace/services/:service", errorHandler(service.Controller{}.Update)),
	"ServiceReplace": put("/namespaces/:namespace/services/:service", errorHandler(service.Controller{}.Replace)),
}
View Source
var WsRoutes = routes.NamedRoutes{
	"AppExec":        get("/namespaces/:namespace/applications/:app/exec", errorHandler(application.Controller{}.Exec)),
	"AppPortForward": get("/namespaces/:namespace/applications/:app/portforward", errorHandler(application.Controller{}.PortForward)),
	"AppLogs":        get("/namespaces/:namespace/applications/:app/logs", application.Controller{}.Logs),
	"StagingLogs":    get("/namespaces/:namespace/staging/:stage_id/logs", application.Controller{}.Logs),
}

Functions

func AuthToken added in v0.3.6

func AuthToken(c *gin.Context) APIErrors

AuthToken handles the API endpoint /auth-token. It returns a JWT token for further logins

func Info added in v0.1.2

func Info(c *gin.Context) APIErrors

Info handles the API endpoint /info. It returns version information for various epinio components.

func Lemon added in v0.1.4

func Lemon(router *gin.RouterGroup)

Lemon extends the specified router with the methods and urls handling the API endpoints

func Spice added in v0.3.6

func Spice(router *gin.RouterGroup)

Spice extends the specified router with the methods and urls handling the websocket API endpoints

Types

type APIActionFunc added in v0.0.12

type APIActionFunc func(c *gin.Context) errors.APIErrors

APIActionFunc is matched by all actions. Actions can return a list of errors. The "Status" of the first error in the list becomes the response Status Code.

Directories

Path Synopsis
Application contains the API handlers to manage applications.
Application contains the API handlers to manage applications.
Env contains the API handlers to manage the application environment
Env contains the API handlers to manage the application environment
Namespace contains the API handlers to manage namespaces.
Namespace contains the API handlers to manage namespaces.
Package response is used by all actions to write their final result as JSON
Package response is used by all actions to write their final result as JSON
Service contains the API handlers to manage services.
Service contains the API handlers to manage services.
Servicebinding contains the API handlers to manage service bindings.
Servicebinding contains the API handlers to manage service bindings.

Jump to

Keyboard shortcuts

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