v1

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 25 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"
)
View Source
const VersionHeader = "epinio-version"

Variables

View Source
var AdminRoutes map[string]struct{} = map[string]struct{}{}

AdminRoutes is the list of restricted routes, only accessible by admins

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)),
	"AppBatchDelete":  delete("/namespaces/:namespace/applications", errorHandler(application.Controller{}.Delete)),
	"AppDeploy":       post("/namespaces/:namespace/applications/:app/deploy", errorHandler(application.Controller{}.Deploy)),
	"AppImportGit":    post("/namespaces/:namespace/applications/:app/import-git", errorHandler(application.Controller{}.ImportGit)),
	"AppPart":         get("/namespaces/:namespace/applications/:app/part/:part", errorHandler(application.Controller{}.GetPart)),
	"AppRestart":      post("/namespaces/:namespace/applications/:app/restart", errorHandler(application.Controller{}.Restart)),
	"AppRunning":      get("/namespaces/:namespace/applications/:app/running", errorHandler(application.Controller{}.Running)),
	"AppStage":        post("/namespaces/:namespace/applications/:app/stage", errorHandler(application.Controller{}.Stage)),
	"AppUpdate":       patch("/namespaces/:namespace/applications/:app", errorHandler(application.Controller{}.Update)),
	"AppUpload":       post("/namespaces/:namespace/applications/:app/store", errorHandler(application.Controller{}.Upload)),
	"AppValidateCV":   get("/namespaces/:namespace/applications/:app/validate-cv", errorHandler(application.Controller{}.ValidateChartValues)),

	"AppMatch":  get("/namespaces/:namespace/appsmatches/:pattern", errorHandler(application.Controller{}.Match)),
	"AppMatch0": get("/namespaces/:namespace/appsmatches", errorHandler(application.Controller{}.Match)),

	"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)),

	"ConfigurationBindingCreate": post("/namespaces/:namespace/applications/:app/configurationbindings",
		errorHandler(configurationbinding.Controller{}.Create)),
	"ConfigurationBindingDelete": delete("/namespaces/:namespace/applications/:app/configurationbindings/:configuration",
		errorHandler(configurationbinding.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)),

	"ConfigurationApps": get("/namespaces/:namespace/configurationapps", errorHandler(configuration.Controller{}.ConfigurationApps)),

	"AllConfigurations":        get("/configurations", errorHandler(configuration.Controller{}.FullIndex)),
	"Configurations":           get("/namespaces/:namespace/configurations", errorHandler(configuration.Controller{}.Index)),
	"ConfigurationShow":        get("/namespaces/:namespace/configurations/:configuration", errorHandler(configuration.Controller{}.Show)),
	"ConfigurationCreate":      post("/namespaces/:namespace/configurations", errorHandler(configuration.Controller{}.Create)),
	"ConfigurationBatchDelete": delete("/namespaces/:namespace/configurations", errorHandler(configuration.Controller{}.Delete)),
	"ConfigurationDelete":      delete("/namespaces/:namespace/configurations/:configuration", errorHandler(configuration.Controller{}.Delete)),
	"ConfigurationUpdate":      patch("/namespaces/:namespace/configurations/:configuration", errorHandler(configuration.Controller{}.Update)),
	"ConfigurationReplace":     put("/namespaces/:namespace/configurations/:configuration", errorHandler(configuration.Controller{}.Replace)),

	"ConfigurationMatch":  get("/namespaces/:namespace/configurationsmatches/:pattern", errorHandler(configuration.Controller{}.Match)),
	"ConfigurationMatch0": get("/namespaces/:namespace/configurationsmatches", errorHandler(configuration.Controller{}.Match)),

	"ServiceCatalog":     get("/catalogservices", errorHandler(service.Controller{}.Catalog)),
	"ServiceCatalogShow": get("/catalogservices/:catalogservice", errorHandler(service.Controller{}.CatalogShow)),

	"ServiceCatalogMatch":  get("catalogservicesmatches/:pattern", errorHandler(service.Controller{}.CatalogMatch)),
	"ServiceCatalogMatch0": get("catalogservicesmatches", errorHandler(service.Controller{}.CatalogMatch)),

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

	"AllServices":        get("/services", errorHandler(service.Controller{}.FullIndex)),
	"ServiceCreate":      post("/namespaces/:namespace/services", errorHandler(service.Controller{}.Create)),
	"ServiceList":        get("/namespaces/:namespace/services", errorHandler(service.Controller{}.List)),
	"ServiceShow":        get("/namespaces/:namespace/services/:service", errorHandler(service.Controller{}.Show)),
	"ServiceDelete":      delete("/namespaces/:namespace/services/:service", errorHandler(service.Controller{}.Delete)),
	"ServiceBatchDelete": delete("/namespaces/:namespace/services", errorHandler(service.Controller{}.Delete)),

	"ServiceMatch":  get("/namespaces/:namespace/servicesmatches/:pattern", errorHandler(service.Controller{}.Match)),
	"ServiceMatch0": get("/namespaces/:namespace/servicesmatches", errorHandler(service.Controller{}.Match)),

	"ServiceBind": post(
		"/namespaces/:namespace/services/:service/bind",
		errorHandler(service.Controller{}.Bind)),

	"ServiceUnbind": post(
		"/namespaces/:namespace/services/:service/unbind",
		errorHandler(service.Controller{}.Unbind)),

	"ChartList":   get("/appcharts", errorHandler(appchart.Controller{}.Index)),
	"ChartMatch":  get("/appchartsmatch/:pattern", errorHandler(appchart.Controller{}.Match)),
	"ChartMatch0": get("/appchartsmatch", errorHandler(appchart.Controller{}.Match)),
	"ChartShow":   get("/appcharts/:name", errorHandler(appchart.Controller{}.Show)),
}
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 AuthorizationMiddleware added in v0.8.0

func AuthorizationMiddleware(c *gin.Context)

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 NamespaceMiddleware added in v0.9.0

func NamespaceMiddleware(c *gin.Context)

NamespaceMiddleware is a gin middleware used to check if a namespaced route is valid. It checks the validity of the requested namespace, returning a 404 if it doesn't exists

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
Appchart contains the API handlers to manage appcharts.
Appchart contains the API handlers to manage appcharts.
Application contains the API handlers to manage applications.
Application contains the API handlers to manage applications.
Configuration contains the API handlers to manage configurations.
Configuration contains the API handlers to manage configurations.
Configurationbinding contains the API handlers to manage configuration bindings.
Configurationbinding contains the API handlers to manage configuration bindings.
Package deploy provides the functionality to deploy an application.
Package deploy provides the functionality to deploy an application.
Epinio API
Epinio API
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

Jump to

Keyboard shortcuts

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