v1

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 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 DexPEMPath = "/etc/ssl/certs/dex-tls.pem"
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{
	"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)),
	"AppExport":       post("/namespaces/:namespace/applications/:app/export", errorHandler(application.ExportToRegistry)),

	"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)),
	"ServiceUpdate":      patch("/namespaces/:namespace/services/:service", errorHandler(service.Update)),
	"ServiceReplace":     put("/namespaces/:namespace/services/:service", errorHandler(service.Replace)),

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

	"Gitconfigs":           get("/gitconfigs", errorHandler(gitconfig.Index)),
	"GitconfigCreate":      post("/gitconfigs", errorHandler(gitconfig.Create)),
	"GitconfigDelete":      delete("/gitconfigs/:gitconfig", errorHandler(gitconfig.Delete)),
	"GitconfigBatchDelete": delete("/gitconfigs", errorHandler(gitconfig.Delete)),
	"GitconfigsMatch":      get("/gitconfigsmatch/:pattern", errorHandler(gitconfig.Match)),
	"GitconfigsMatch0":     get("/gitconfigsmatch", errorHandler(gitconfig.Match)),
	"GitconfigShow":        get("/gitconfigs/:gitconfig", errorHandler(gitconfig.Show)),

	"Exportregistries": get("/exportregistries", errorHandler(exportregistry.Index)),

	"ExportregistriesMatch":  get("/exportregistrymatches/:pattern", errorHandler(exportregistry.Match)),
	"ExportregistriesMatch0": get("/exportregistrymatches", errorHandler(exportregistry.Match)),

	"GitProxy": post("/gitproxy", errorHandler(gitproxy.ProxyHandler)),
}
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),
	"ServicePortForward": get("/namespaces/:namespace/services/:service/portforward", errorHandler(service.PortForward)),
	"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 ErrorHandler added in v1.11.0

func ErrorHandler(action APIActionFunc) gin.HandlerFunc

ErrorHandler exposes the internal errorhandler for use by the server without having to edit the router definitions.

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 InitAuth added in v1.11.0

func InitAuth() error

InitAuth will init the Actions, and it will add to the actions the relevant endpoints. This was needed because the Routes cannot be referred in the auth package for a cycle dependency.

func InitAuthAndRoles added in v1.11.0

func InitAuthAndRoles(rolesGetter auth.RolesGetter) error

InitAuthAndRoles will init the Auth (loading the Actions and Endpoints) and the Roles

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 Me added in v1.11.0

func Me(c *gin.Context) APIErrors

Me handles the API endpoint /me. It returns some information about the current user

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