v1

package
v1.9.0-rc1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 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.FullIndex)),
	"Apps":            get("/namespaces/:namespace/applications", errorHandler(application.Index)),
	"AppCreate":       post("/namespaces/:namespace/applications", errorHandler(application.Create)),
	"AppShow":         get("/namespaces/:namespace/applications/:app", errorHandler(application.Show)),
	"StagingComplete": get("/namespaces/:namespace/staging/:stage_id/complete", errorHandler(application.Staged)),
	"AppDelete":       delete("/namespaces/:namespace/applications/:app", errorHandler(application.Delete)),
	"AppBatchDelete":  delete("/namespaces/:namespace/applications", errorHandler(application.Delete)),
	"AppDeploy":       post("/namespaces/:namespace/applications/:app/deploy", errorHandler(application.Deploy)),
	"AppImportGit":    post("/namespaces/:namespace/applications/:app/import-git", errorHandler(application.ImportGit)),
	"AppPart":         get("/namespaces/:namespace/applications/:app/part/:part", errorHandler(application.GetPart)),
	"AppRestart":      post("/namespaces/:namespace/applications/:app/restart", errorHandler(application.Restart)),
	"AppRunning":      get("/namespaces/:namespace/applications/:app/running", errorHandler(application.Running)),
	"AppStage":        post("/namespaces/:namespace/applications/:app/stage", errorHandler(application.Stage)),
	"AppUpdate":       patch("/namespaces/:namespace/applications/:app", errorHandler(application.Update)),
	"AppUpload":       post("/namespaces/:namespace/applications/:app/store", errorHandler(application.Upload)),
	"AppValidateCV":   get("/namespaces/:namespace/applications/:app/validate-cv", errorHandler(application.ValidateChartValues)),

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

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

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

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

	"ConfigurationBindingCreate": post("/namespaces/:namespace/applications/:app/configurationbindings",
		errorHandler(configurationbinding.Create)),
	"ConfigurationBindingDelete": delete("/namespaces/:namespace/applications/:app/configurationbindings/:configuration",
		errorHandler(configurationbinding.Delete)),

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

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

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

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

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

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

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

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

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

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

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

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

	"ChartList":   get("/appcharts", errorHandler(appchart.Index)),
	"ChartMatch":  get("/appchartsmatch/:pattern", errorHandler(appchart.Match)),
	"ChartMatch0": get("/appchartsmatch", errorHandler(appchart.Match)),
	"ChartShow":   get("/appcharts/:name", errorHandler(appchart.Show)),
}
View Source
var WsRoutes = routes.NamedRoutes{
	"AppExec":        get("/namespaces/:namespace/applications/:app/exec", errorHandler(application.Exec)),
	"AppPortForward": get("/namespaces/:namespace/applications/:app/portforward", errorHandler(application.PortForward)),
	"AppLogs":        get("/namespaces/:namespace/applications/:app/logs", application.Logs),
	"StagingLogs":    get("/namespaces/:namespace/staging/:stage_id/logs", application.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
Package deploy provides the functionality to deploy an application.
Package deploy provides the functionality to deploy an application.
Epinio API
Epinio API
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