Documentation ¶
Overview ¶
Package middleware provides the ability for injecting Vela resources into the middleware chain for the API.
Usage:
import "github.com/go-vela/server/router/middleware"
Index ¶
- func Allowlist(allowlist []string) gin.HandlerFunc
- func AllowlistSchedule(allowlistschedule []string) gin.HandlerFunc
- func Compiler(cli compiler.Engine) gin.HandlerFunc
- func Cors(c *gin.Context)
- func Database(d database.Interface) gin.HandlerFunc
- func DefaultBuildLimit(defaultBuildLimit int64) gin.HandlerFunc
- func DefaultRepoEvents(defaultRepoEvents []string) gin.HandlerFunc
- func DefaultTimeout(defaultTimeout int64) gin.HandlerFunc
- func Logger(logger *logrus.Logger, timeFormat string) gin.HandlerFunc
- func MaxBuildLimit(maxBuildLimit int64) gin.HandlerFunc
- func Metadata(m *types.Metadata) gin.HandlerFunc
- func NoCache(c *gin.Context)
- func Options(c *gin.Context)
- func Payload() gin.HandlerFunc
- func Queue(q queue.Service) gin.HandlerFunc
- func QueueAddress(address string) gin.HandlerFunc
- func QueueSigningPrivateKey(key string) gin.HandlerFunc
- func QueueSigningPublicKey(key string) gin.HandlerFunc
- func RequestVersion(c *gin.Context)
- func ResponseVersion(c *gin.Context)
- func ScheduleFrequency(scheduleFrequency time.Duration) gin.HandlerFunc
- func Scm(s scm.Service) gin.HandlerFunc
- func Secret(secret string) gin.HandlerFunc
- func Secrets(secrets map[string]secret.Service) gin.HandlerFunc
- func Secure(c *gin.Context)
- func SecureCookie(secure bool) gin.HandlerFunc
- func TokenManager(m *token.Manager) gin.HandlerFunc
- func WebhookValidation(validate bool) gin.HandlerFunc
- func Worker(duration time.Duration) gin.HandlerFunc
- type ECSFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Allowlist ¶ added in v0.7.0
func Allowlist(allowlist []string) gin.HandlerFunc
Allowlist is a middleware function that attaches the allowlist used to limit which repos can be activated within the system.
func AllowlistSchedule ¶ added in v0.20.0
func AllowlistSchedule(allowlistschedule []string) gin.HandlerFunc
AllowlistSchedule is a middleware function that attaches the allowlistschedule used to limit which repos can utilize the schedule feature within the system.
func Compiler ¶
func Compiler(cli compiler.Engine) gin.HandlerFunc
Compiler is a middleware function that initializes the compiler and attaches to the context of every http.Request.
func Cors ¶
Cors is a middleware function that appends headers for CORS related requests. These are attached to actual requests unlike the OPTIONS preflight requests.
func Database ¶
func Database(d database.Interface) gin.HandlerFunc
Database is a middleware function that initializes the database and attaches to the context of every http.Request.
func DefaultBuildLimit ¶ added in v0.12.0
func DefaultBuildLimit(defaultBuildLimit int64) gin.HandlerFunc
DefaultBuildLimit is a middleware function that attaches the defaultLimit to enable the server to override the default build limit.
func DefaultRepoEvents ¶ added in v0.18.0
func DefaultRepoEvents(defaultRepoEvents []string) gin.HandlerFunc
DefaultRepoEvents is a middleware function that attaches the defaultRepoEvents to enable the server to override the default repo event.
func DefaultTimeout ¶ added in v0.7.0
func DefaultTimeout(defaultTimeout int64) gin.HandlerFunc
DefaultTimeout is a middleware function that attaches the defaultTimeout to enable the server to override the default build timeout.
func Logger ¶
func Logger(logger *logrus.Logger, timeFormat string) gin.HandlerFunc
Logger returns a gin.HandlerFunc (middleware) that logs requests using logrus.
Requests with errors are logged using logrus.Error(). Requests without errors are logged using logrus.Info().
It receives:
- A time package format string (e.g. time.RFC3339).
func MaxBuildLimit ¶ added in v0.12.0
func MaxBuildLimit(maxBuildLimit int64) gin.HandlerFunc
MaxBuildLimit is a middleware function that attaches the defaultLimit to enable the server to override the max build limit.
func Metadata ¶ added in v0.2.0
func Metadata(m *types.Metadata) gin.HandlerFunc
Metadata is a middleware function that attaches the metadata to the context of every http.Request.
func NoCache ¶
NoCache is a middleware function that appends headers to prevent the client from caching the HTTP response.
func Options ¶
Options is a middleware function that appends headers for OPTIONS preflight requests and aborts then exits the middleware chain and ends the request.
func Payload ¶
func Payload() gin.HandlerFunc
Payload is a middleware function that captures the user provided json body and attaches it to the context of every http.Request to be logged.
func Queue ¶
func Queue(q queue.Service) gin.HandlerFunc
Queue is a middleware function that initializes the queue and attaches to the context of every http.Request.
func QueueAddress ¶ added in v0.21.0
func QueueAddress(address string) gin.HandlerFunc
QueueAddress is a middleware function that attaches the queue address used to open the connection to the queue.
func QueueSigningPrivateKey ¶ added in v0.21.0
func QueueSigningPrivateKey(key string) gin.HandlerFunc
QueueSigningPrivateKey is a middleware function that attaches the private key used to sign items that are pushed to the queue.
func QueueSigningPublicKey ¶ added in v0.21.0
func QueueSigningPublicKey(key string) gin.HandlerFunc
QueueSigningPublicKey is a middleware function that attaches the public key used to open signed items that are pushed to the queue.
func RequestVersion ¶
RequestVersion is a middleware function that injects the Vela API version information into the request so it will be logged. This is intended for debugging and troubleshooting.
func ResponseVersion ¶
ResponseVersion is a middleware function that injects the Vela API version information into the response so it will be logged. This is intended for debugging and troubleshooting.
func ScheduleFrequency ¶ added in v0.20.0
func ScheduleFrequency(scheduleFrequency time.Duration) gin.HandlerFunc
ScheduleFrequency is a middleware function that attaches the scheduleminimumfrequency used to limit the frequency which schedules can be run within the system.
func Scm ¶ added in v0.12.0
func Scm(s scm.Service) gin.HandlerFunc
Scm is a middleware function that initializes the scm and attaches to the context of every http.Request.
func Secret ¶
func Secret(secret string) gin.HandlerFunc
Secret is a middleware function that attaches the secret used for server <-> agent communication to the context of every http.Request.
func Secrets ¶
func Secrets(secrets map[string]secret.Service) gin.HandlerFunc
Secrets is a middleware function that initializes the secret engines and attaches to the context of every http.Request.
func SecureCookie ¶ added in v0.7.0
func SecureCookie(secure bool) gin.HandlerFunc
SecureCookie determines whether or not incoming webhooks are validated coming from Github This is primarily intended for local development.
func TokenManager ¶ added in v0.18.0
func TokenManager(m *token.Manager) gin.HandlerFunc
TokenManager is a middleware function that attaches the token manager to the context of every http.Request.
func WebhookValidation ¶ added in v0.7.0
func WebhookValidation(validate bool) gin.HandlerFunc
WebhookValidation determines whether or not incoming webhooks are validated coming from Github This is primarily intended for local development.
Types ¶
type ECSFormatter ¶ added in v0.21.0
type ECSFormatter struct { // DataKey allows users to put all the log entry parameters into a // nested dictionary at a given key. // // DataKey is ignored for well-defined fields, such as "error", // which will instead be stored under the appropriate ECS fields. DataKey string }
ECSFormatter holds ECS parameter information for logging.
Source Files ¶
- allowlist.go
- allowlist_schedule.go
- compiler.go
- database.go
- default_build_limit.go
- default_repo_events.go
- default_timeout.go
- doc.go
- header.go
- logger.go
- max_build_limit.go
- metadata.go
- payload.go
- queue.go
- schedule_frequency.go
- scm.go
- secret.go
- secure_cookie.go
- signing.go
- token_manager.go
- webhook_validation.go
- worker.go
Directories ¶
Path | Synopsis |
---|---|
Package token provides the ability for inserting Vela token resources into or extracting Vela token resources from the middleware chain for the API.
|
Package token provides the ability for inserting Vela token resources into or extracting Vela token resources from the middleware chain for the API. |
Package build provides the ability for inserting Vela build resources into or extracting Vela build resources from the middleware chain for the API.
|
Package build provides the ability for inserting Vela build resources into or extracting Vela build resources from the middleware chain for the API. |
Package claims provides the ability for inserting token claims resources into or extracting token claims resources from the middleware chain for the API.
|
Package claims provides the ability for inserting token claims resources into or extracting token claims resources from the middleware chain for the API. |
Package executors provides the ability for inserting Vela executors resources into or extracting Vela build resources from the middleware chain for the API.
|
Package executors provides the ability for inserting Vela executors resources into or extracting Vela build resources from the middleware chain for the API. |
Package org provides the ability for inserting Vela org resources into or extracting Vela org resources from the middleware chain for the API.
|
Package org provides the ability for inserting Vela org resources into or extracting Vela org resources from the middleware chain for the API. |
Package perm provides the ability for validating the access control to Vela resources in the middleware chain for the API.
|
Package perm provides the ability for validating the access control to Vela resources in the middleware chain for the API. |
Package pipeline provides the ability for inserting Vela pipeline resources into or extracting Vela pipeline resources from the middleware chain for the API.
|
Package pipeline provides the ability for inserting Vela pipeline resources into or extracting Vela pipeline resources from the middleware chain for the API. |
Package repo provides the ability for inserting Vela repo resources into or extracting Vela repo resources from the middleware chain for the API.
|
Package repo provides the ability for inserting Vela repo resources into or extracting Vela repo resources from the middleware chain for the API. |
Package service provides the ability for inserting Vela service resources into or extracting Vela service resources from the middleware chain for the API.
|
Package service provides the ability for inserting Vela service resources into or extracting Vela service resources from the middleware chain for the API. |
Package step provides the ability for inserting Vela step resources into or extracting Vela step resources from the middleware chain for the API.
|
Package step provides the ability for inserting Vela step resources into or extracting Vela step resources from the middleware chain for the API. |
Package user provides the ability for inserting Vela user resources into or extracting Vela user resources from the middleware chain for the API.
|
Package user provides the ability for inserting Vela user resources into or extracting Vela user resources from the middleware chain for the API. |
Package worker provides the ability for inserting Vela worker resources into or extracting Vela worker resources from the middleware chain for the API.
|
Package worker provides the ability for inserting Vela worker resources into or extracting Vela worker resources from the middleware chain for the API. |