Documentation ¶
Overview ¶
Package api provides the handlers for the Vela API.
Usage:
import "github.com/go-vela/server/api"
Index ¶
- func Authenticate(c *gin.Context)
- func AuthenticateToken(c *gin.Context)
- func AuthenticateType(c *gin.Context)
- func BaseMetrics() http.Handler
- func CancelBuild(c *gin.Context)
- func ChownRepo(c *gin.Context)
- func CreateBuild(c *gin.Context)
- func CreateDeployment(c *gin.Context)
- func CreateHook(c *gin.Context)
- func CreateRepo(c *gin.Context)
- func CreateSecret(c *gin.Context)
- func CreateService(c *gin.Context)
- func CreateServiceLog(c *gin.Context)
- func CreateStep(c *gin.Context)
- func CreateStepLog(c *gin.Context)
- func CreateToken(c *gin.Context)
- func CreateUser(c *gin.Context)
- func CreateWorker(c *gin.Context)
- func CustomMetrics(c *gin.Context)
- func DeleteBuild(c *gin.Context)
- func DeleteHook(c *gin.Context)
- func DeleteRepo(c *gin.Context)
- func DeleteSecret(c *gin.Context)
- func DeleteService(c *gin.Context)
- func DeleteServiceLog(c *gin.Context)
- func DeleteStep(c *gin.Context)
- func DeleteStepLog(c *gin.Context)
- func DeleteToken(c *gin.Context)
- func DeleteUser(c *gin.Context)
- func DeleteWorker(c *gin.Context)
- func GetBadge(c *gin.Context)
- func GetBuild(c *gin.Context)
- func GetBuildByID(c *gin.Context)
- func GetBuildLogs(c *gin.Context)
- func GetBuilds(c *gin.Context)
- func GetCurrentUser(c *gin.Context)
- func GetDeployment(c *gin.Context)
- func GetDeployments(c *gin.Context)
- func GetHook(c *gin.Context)
- func GetHooks(c *gin.Context)
- func GetOrgBuilds(c *gin.Context)
- func GetOrgRepos(c *gin.Context)
- func GetRepo(c *gin.Context)
- func GetRepos(c *gin.Context)
- func GetSecret(c *gin.Context)
- func GetSecrets(c *gin.Context)
- func GetService(c *gin.Context)
- func GetServiceLog(c *gin.Context)
- func GetServices(c *gin.Context)
- func GetStep(c *gin.Context)
- func GetStepLog(c *gin.Context)
- func GetSteps(c *gin.Context)
- func GetUser(c *gin.Context)
- func GetUserSourceRepos(c *gin.Context)
- func GetUsers(c *gin.Context)
- func GetWorker(c *gin.Context)
- func GetWorkers(c *gin.Context)
- func Health(c *gin.Context)
- func Login(c *gin.Context)
- func Logout(c *gin.Context)
- func PostServiceStream(c *gin.Context)
- func PostStepStream(c *gin.Context)
- func PostWebhook(c *gin.Context)
- func RedeliverHook(c *gin.Context)
- func RefreshAccessToken(c *gin.Context)
- func RepairRepo(c *gin.Context)
- func RestartBuild(c *gin.Context)
- func SyncRepo(c *gin.Context)
- func SyncRepos(c *gin.Context)
- func UpdateBuild(c *gin.Context)
- func UpdateCurrentUser(c *gin.Context)
- func UpdateHook(c *gin.Context)
- func UpdateRepo(c *gin.Context)
- func UpdateSecret(c *gin.Context)
- func UpdateService(c *gin.Context)
- func UpdateServiceLog(c *gin.Context)
- func UpdateStep(c *gin.Context)
- func UpdateStepLog(c *gin.Context)
- func UpdateUser(c *gin.Context)
- func UpdateWorker(c *gin.Context)
- func Version(c *gin.Context)
- type HeaderLink
- type MetricsQueryParameters
- type Pagination
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authenticate ¶
Authenticate represents the API handler to process a user logging in to Vela from the API or UI.
func AuthenticateToken ¶ added in v0.7.0
AuthenticateToken represents the API handler to process a user logging in using PAT to Vela from the API.
func AuthenticateType ¶ added in v0.7.0
AuthenticateType handles cases where the OAuth callback was overridden by supplying a redirect_uri in the login process. It will send the user to the destination to handle the last leg in the auth flow - exchanging "code" and "state" for a token. This will only handle non-headless flows (ie. web or cli).
func BaseMetrics ¶
BaseMetrics returns a Prometheus handler for serving go metrics.
func CancelBuild ¶ added in v0.7.0
CancelBuild represents the API handler to cancel a running build.
func ChownRepo ¶
ChownRepo represents the API handler to change the owner of a repo in the configured backend.
func CreateBuild ¶
CreateBuild represents the API handler to create a build in the configured backend.
func CreateDeployment ¶ added in v0.4.0
CreateDeployment represents the API handler to create a deployment in the configured backend.
func CreateHook ¶ added in v0.2.0
CreateHook represents the API handler to create a webhook in the configured backend.
func CreateRepo ¶
CreateRepo represents the API handler to create a repo in the configured backend.
func CreateSecret ¶
CreateSecret represents the API handler to create a secret in the configured backend.
func CreateService ¶
CreateService represents the API handler to create a service for a build in the configured backend.
func CreateServiceLog ¶
CreateServiceLog represents the API handler to create the logs for a service in the configured backend.
func CreateStep ¶
CreateStep represents the API handler to create a step for a build in the configured backend.
func CreateStepLog ¶
CreateStepLog represents the API handler to create the logs for a step in the configured backend.
func CreateToken ¶
CreateToken represents the API handler to create a user token in the configured backend.
func CreateUser ¶
CreateUser represents the API handler to create a user in the configured backend.
func CreateWorker ¶ added in v0.7.0
CreateWorker represents the API handler to create a worker in the configured backend.
func CustomMetrics ¶
CustomMetrics returns custom Prometheus metrics from private functions.
func DeleteBuild ¶
DeleteBuild represents the API handler to remove a build for a repo from the configured backend.
func DeleteHook ¶ added in v0.2.0
DeleteHook represents the API handler to remove a webhook from the configured backend.
func DeleteRepo ¶
DeleteRepo represents the API handler to remove a repo from the configured backend.
func DeleteSecret ¶
DeleteSecret deletes a secret from the provided secrets service.
func DeleteService ¶
DeleteService represents the API handler to remove a service for a build from the configured backend.
func DeleteServiceLog ¶
DeleteServiceLog represents the API handler to remove the logs for a service from the configured backend.
func DeleteStep ¶
DeleteStep represents the API handler to remove a step for a build from the configured backend.
func DeleteStepLog ¶
DeleteStepLog represents the API handler to remove the logs for a step from the configured backend.
func DeleteToken ¶
DeleteToken represents the API handler to revoke and recreate a user token in the configured backend.
func DeleteUser ¶
DeleteUser represents the API handler to remove a user from the configured backend.
func DeleteWorker ¶ added in v0.7.0
DeleteWorker represents the API handler to remove a worker from the configured backend.
func GetBuild ¶
GetBuild represents the API handler to capture a build for a repo from the configured backend.
func GetBuildByID ¶ added in v0.17.0
GetBuildByID represents the API handler to capture a build by its id from the configured backend.
func GetBuildLogs ¶
GetBuildLogs represents the API handler to capture a list of logs for a build from the configured backend.
func GetBuilds ¶
GetBuilds represents the API handler to capture a list of builds for a repo from the configured backend.
func GetCurrentUser ¶
GetCurrentUser represents the API handler to capture the currently authenticated user from the configured backend.
func GetDeployment ¶ added in v0.4.0
GetDeployment represents the API handler to capture a deployment from the configured backend.
func GetDeployments ¶ added in v0.4.0
GetDeployments represents the API handler to capture a list of deployments from the configured backend.
func GetHook ¶ added in v0.2.0
GetHook represents the API handler to capture a webhook from the configured backend.
func GetHooks ¶ added in v0.2.0
GetHooks represents the API handler to capture a list of webhooks from the configured backend.
func GetOrgBuilds ¶ added in v0.7.0
GetOrgBuilds represents the API handler to capture a list of builds associated with an org from the configured backend.
func GetOrgRepos ¶ added in v0.9.0
GetOrgRepos represents the API handler to capture a list of repos for an org from the configured backend.
func GetRepos ¶
GetRepos represents the API handler to capture a list of repos for a user from the configured backend.
func GetSecrets ¶
GetSecrets represents the API handler to capture a list of secrets from the configured backend.
func GetService ¶
GetService represents the API handler to capture a service for a build from the configured backend.
func GetServiceLog ¶
GetServiceLog represents the API handler to capture the logs for a service from the configured backend.
func GetServices ¶
GetServices represents the API handler to capture a list of services for a build from the configured backend.
func GetStep ¶
GetStep represents the API handler to capture a step for a build from the configured backend.
func GetStepLog ¶
GetStepLog represents the API handler to capture the logs for a step from the configured backend.
func GetSteps ¶
GetSteps represents the API handler to capture a list of steps for a build from the configured backend.
func GetUserSourceRepos ¶
GetUserSourceRepos represents the API handler to capture the list of repos for a user from the configured backend.
func GetUsers ¶
GetUsers represents the API handler to capture a list of users from the configured backend.
func GetWorker ¶ added in v0.7.0
GetWorker represents the API handler to capture a worker from the configured backend.
func GetWorkers ¶ added in v0.7.0
GetWorkers represents the API handler to capture a list of workers from the configured backend.
func Logout ¶ added in v0.7.0
Logout represents the API handler to process a user logging out of Vela. Primarily, it deletes the current refresh token cookie.
func PostServiceStream ¶ added in v0.10.0
PostServiceStream represents the API handler that streams service logs to the database.
func PostStepStream ¶ added in v0.10.0
PostStepStream represents the API handler that streams service logs to the database.
func PostWebhook ¶
PostWebhook represents the API handler to capture a webhook from a source control provider and publish it to the configure queue.
func RedeliverHook ¶ added in v0.14.0
func RefreshAccessToken ¶ added in v0.7.0
RefreshAccessToken will return a new access token if the provided refresh token via cookie is valid.
func RepairRepo ¶
RepairRepo represents the API handler to remove and then create a webhook for a repo.
func RestartBuild ¶
RestartBuild represents the API handler to restart an existing build in the configured backend.
func SyncRepo ¶ added in v0.12.0
SyncRepo represents the API handler to synchronize a single repository between SCM service and the database should a discrepancy exist. Common after deleting SCM repos.
func SyncRepos ¶ added in v0.12.0
SyncRepos represents the API handler to synchronize organization repositories between SCM Service and the database should a discrepancy exist. Common after deleting SCM repos.
func UpdateBuild ¶
UpdateBuild represents the API handler to update a build for a repo in the configured backend.
func UpdateCurrentUser ¶ added in v0.3.0
UpdateCurrentUser represents the API handler to capture and update the currently authenticated user from the configured backend.
func UpdateHook ¶ added in v0.2.0
UpdateHook represents the API handler to update a webhook in the configured backend.
func UpdateRepo ¶
UpdateRepo represents the API handler to update a repo in the configured backend.
func UpdateSecret ¶
UpdateSecret updates a secret for the provided secrets service.
func UpdateService ¶
UpdateService represents the API handler to update a service for a build in the configured backend.
func UpdateServiceLog ¶
UpdateServiceLog represents the API handler to update the logs for a service in the configured backend.
func UpdateStep ¶
UpdateStep represents the API handler to update a step for a build in the configured backend.
func UpdateStepLog ¶
UpdateStepLog represents the API handler to update the logs for a step in the configured backend.
func UpdateUser ¶
UpdateUser represents the API handler to update a user in the configured backend.
func UpdateWorker ¶ added in v0.7.0
UpdateWorker represents the API handler to create a worker in the configured backend.
Types ¶
type HeaderLink ¶
HeaderLink will hold the information needed to form a link element in the header.
type MetricsQueryParameters ¶ added in v0.15.0
type MetricsQueryParameters struct { // UserCount represents total platform users UserCount bool `form:"user_count"` // RepoCount represents total platform repos RepoCount bool `form:"repo_count"` // BuildCount represents total number of builds BuildCount bool `form:"build_count"` // RunningBuildCount represents total number of builds with status==running RunningBuildCount bool `form:"running_build_count"` // PendingBuildCount represents total number of builds with status==pending PendingBuildCount bool `form:"pending_build_count"` // FailureBuildCount represents total number of builds with status==failure FailureBuildCount bool `form:"failure_build_count"` // KilledBuildCount represents total number of builds with status==killed KilledBuildCount bool `form:"killed_build_count"` // SuccessBuildCount represents total number of builds with status==success SuccessBuildCount bool `form:"success_build_count"` // ErrorBuildCount represents total number of builds with status==error ErrorBuildCount bool `form:"error_build_count"` // StepImageCount represents total number of step images StepImageCount bool `form:"step_image_count"` // StepStatusCount represents total number of step statuses StepStatusCount bool `form:"step_status_count"` // ServiceImageCount represents total number of service images ServiceImageCount bool `form:"service_image_count"` // ServiceStatusCount represents total number of service statuses ServiceStatusCount bool `form:"service_status_count"` // WorkerBuildLimit represents total worker build limit WorkerBuildLimit bool `form:"worker_build_limit"` // ActiveWorkerCount represents total number of active workers ActiveWorkerCount bool `form:"active_worker_count"` // InactiveWorkerCount represents total number of inactive workers InactiveWorkerCount bool `form:"inactive_worker_count"` }
MetricsQueryParameters holds query parameter information pertaining to requested metrics.
type Pagination ¶
Pagination holds basic information pertaining to paginating results.
func (*Pagination) HasNext ¶
func (p *Pagination) HasNext() bool
HasNext will return true if there is a next page.
func (*Pagination) HasPages ¶
func (p *Pagination) HasPages() bool
HasPages returns true if there is need to deal with pagination.
func (*Pagination) HasPrev ¶
func (p *Pagination) HasPrev() bool
HasPrev will return true if there is a previous page.
func (*Pagination) NextPage ¶
func (p *Pagination) NextPage() int
NextPage returns the next page number.
func (*Pagination) PrevPage ¶
func (p *Pagination) PrevPage() int
PrevPage returns the previous page number.
func (*Pagination) SetHeaderLink ¶
func (p *Pagination) SetHeaderLink(c *gin.Context)
SetHeaderLink sets the Link HTTP header element to provide clients with paging information refs: - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link - https://tools.ietf.org/html/rfc5988
func (*Pagination) TotalPages ¶
func (p *Pagination) TotalPages() int
TotalPages will return the total number of pages.