api

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Overview

Package api provides the handlers for the Vela API.

Usage:

import "github.com/go-vela/server/api"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(c *gin.Context)

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

func AuthenticateToken(c *gin.Context)

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

func AuthenticateType(c *gin.Context)

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

func BaseMetrics() http.Handler

BaseMetrics returns a Prometheus handler for serving go metrics.

func CancelBuild added in v0.7.0

func CancelBuild(c *gin.Context)

CancelBuild represents the API handler to cancel a running build.

func ChownRepo

func ChownRepo(c *gin.Context)

ChownRepo represents the API handler to change the owner of a repo in the configured backend.

func CreateBuild

func CreateBuild(c *gin.Context)

CreateBuild represents the API handler to create a build in the configured backend.

func CreateDeployment added in v0.4.0

func CreateDeployment(c *gin.Context)

CreateDeployment represents the API handler to create a deployment in the configured backend.

func CreateHook added in v0.2.0

func CreateHook(c *gin.Context)

CreateHook represents the API handler to create a webhook in the configured backend.

func CreateRepo

func CreateRepo(c *gin.Context)

CreateRepo represents the API handler to create a repo in the configured backend.

func CreateSecret

func CreateSecret(c *gin.Context)

CreateSecret represents the API handler to create a secret in the configured backend.

func CreateService

func CreateService(c *gin.Context)

CreateService represents the API handler to create a service for a build in the configured backend.

func CreateServiceLog

func CreateServiceLog(c *gin.Context)

CreateServiceLog represents the API handler to create the logs for a service in the configured backend.

func CreateStep

func CreateStep(c *gin.Context)

CreateStep represents the API handler to create a step for a build in the configured backend.

func CreateStepLog

func CreateStepLog(c *gin.Context)

CreateStepLog represents the API handler to create the logs for a step in the configured backend.

func CreateToken

func CreateToken(c *gin.Context)

CreateToken represents the API handler to create a user token in the configured backend.

func CreateUser

func CreateUser(c *gin.Context)

CreateUser represents the API handler to create a user in the configured backend.

func CreateWorker added in v0.7.0

func CreateWorker(c *gin.Context)

CreateWorker represents the API handler to create a worker in the configured backend.

func CustomMetrics

func CustomMetrics(c *gin.Context)

CustomMetrics returns custom Prometheus metrics from private functions.

func DeleteBuild

func DeleteBuild(c *gin.Context)

DeleteBuild represents the API handler to remove a build for a repo from the configured backend.

func DeleteHook added in v0.2.0

func DeleteHook(c *gin.Context)

DeleteHook represents the API handler to remove a webhook from the configured backend.

func DeleteRepo

func DeleteRepo(c *gin.Context)

DeleteRepo represents the API handler to remove a repo from the configured backend.

func DeleteSecret

func DeleteSecret(c *gin.Context)

DeleteSecret deletes a secret from the provided secrets service.

func DeleteService

func DeleteService(c *gin.Context)

DeleteService represents the API handler to remove a service for a build from the configured backend.

func DeleteServiceLog

func DeleteServiceLog(c *gin.Context)

DeleteServiceLog represents the API handler to remove the logs for a service from the configured backend.

func DeleteStep

func DeleteStep(c *gin.Context)

DeleteStep represents the API handler to remove a step for a build from the configured backend.

func DeleteStepLog

func DeleteStepLog(c *gin.Context)

DeleteStepLog represents the API handler to remove the logs for a step from the configured backend.

func DeleteToken

func DeleteToken(c *gin.Context)

DeleteToken represents the API handler to revoke and recreate a user token in the configured backend.

func DeleteUser

func DeleteUser(c *gin.Context)

DeleteUser represents the API handler to remove a user from the configured backend.

func DeleteWorker added in v0.7.0

func DeleteWorker(c *gin.Context)

DeleteWorker represents the API handler to remove a worker from the configured backend.

func GetBadge added in v0.3.0

func GetBadge(c *gin.Context)

GetBadge represents the API handler to return a build status badge.

func GetBuild

func GetBuild(c *gin.Context)

GetBuild represents the API handler to capture a build for a repo from the configured backend.

func GetBuildLogs

func GetBuildLogs(c *gin.Context)

GetBuildLogs represents the API handler to capture a list of logs for a build from the configured backend.

func GetBuilds

func GetBuilds(c *gin.Context)

GetBuilds represents the API handler to capture a list of builds for a repo from the configured backend.

func GetCurrentUser

func GetCurrentUser(c *gin.Context)

GetCurrentUser represents the API handler to capture the currently authenticated user from the configured backend.

func GetDeployment added in v0.4.0

func GetDeployment(c *gin.Context)

GetDeployment represents the API handler to capture a deployment from the configured backend.

func GetDeployments added in v0.4.0

func GetDeployments(c *gin.Context)

GetDeployments represents the API handler to capture a list of deployments from the configured backend.

func GetHook added in v0.2.0

func GetHook(c *gin.Context)

GetHook represents the API handler to capture a webhook from the configured backend.

func GetHooks added in v0.2.0

func GetHooks(c *gin.Context)

GetHooks represents the API handler to capture a list of webhooks from the configured backend.

func GetOrgBuilds added in v0.7.0

func GetOrgBuilds(c *gin.Context)

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

func GetOrgRepos(c *gin.Context)

GetOrgRepos represents the API handler to capture a list of repos for an org from the configured backend.

func GetRepo

func GetRepo(c *gin.Context)

GetRepo represents the API handler to capture a repo from the configured backend.

func GetRepos

func GetRepos(c *gin.Context)

GetRepos represents the API handler to capture a list of repos for a user from the configured backend.

func GetSecret

func GetSecret(c *gin.Context)

GetSecret gets a secret from the provided secrets service.

func GetSecrets

func GetSecrets(c *gin.Context)

GetSecrets represents the API handler to capture a list of secrets from the configured backend.

func GetService

func GetService(c *gin.Context)

GetService represents the API handler to capture a service for a build from the configured backend.

func GetServiceLog

func GetServiceLog(c *gin.Context)

GetServiceLog represents the API handler to capture the logs for a service from the configured backend.

func GetServices

func GetServices(c *gin.Context)

GetServices represents the API handler to capture a list of services for a build from the configured backend.

func GetStep

func GetStep(c *gin.Context)

GetStep represents the API handler to capture a step for a build from the configured backend.

func GetStepLog

func GetStepLog(c *gin.Context)

GetStepLog represents the API handler to capture the logs for a step from the configured backend.

func GetSteps

func GetSteps(c *gin.Context)

GetSteps represents the API handler to capture a list of steps for a build from the configured backend.

func GetUser

func GetUser(c *gin.Context)

GetUser represents the API handler to capture a user from the configured backend.

func GetUserSourceRepos

func GetUserSourceRepos(c *gin.Context)

GetUserSourceRepos represents the API handler to capture the list of repos for a user from the configured backend.

func GetUsers

func GetUsers(c *gin.Context)

GetUsers represents the API handler to capture a list of users from the configured backend.

func GetWorker added in v0.7.0

func GetWorker(c *gin.Context)

GetWorker represents the API handler to capture a worker from the configured backend.

func GetWorkers added in v0.7.0

func GetWorkers(c *gin.Context)

GetWorkers represents the API handler to capture a list of workers from the configured backend.

func Health

func Health(c *gin.Context)

Health represents the API handler to report the health status for Vela.

func Login

func Login(c *gin.Context)

Login represents the API handler to process a user logging in to Vela.

func Logout added in v0.7.0

func Logout(c *gin.Context)

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

func PostServiceStream(c *gin.Context)

PostServiceStream represents the API handler that streams service logs to the database.

func PostStepStream added in v0.10.0

func PostStepStream(c *gin.Context)

PostStepStream represents the API handler that streams service logs to the database.

func PostWebhook

func PostWebhook(c *gin.Context)

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 RedeliverHook(c *gin.Context)

func RefreshAccessToken added in v0.7.0

func RefreshAccessToken(c *gin.Context)

RefreshAccessToken will return a new access token if the provided refresh token via cookie is valid.

func RepairRepo

func RepairRepo(c *gin.Context)

RepairRepo represents the API handler to remove and then create a webhook for a repo.

func RestartBuild

func RestartBuild(c *gin.Context)

RestartBuild represents the API handler to restart an existing build in the configured backend.

func SyncRepo added in v0.12.0

func SyncRepo(c *gin.Context)

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

func SyncRepos(c *gin.Context)

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

func UpdateBuild(c *gin.Context)

UpdateBuild represents the API handler to update a build for a repo in the configured backend.

func UpdateCurrentUser added in v0.3.0

func UpdateCurrentUser(c *gin.Context)

UpdateCurrentUser represents the API handler to capture and update the currently authenticated user from the configured backend.

func UpdateHook added in v0.2.0

func UpdateHook(c *gin.Context)

UpdateHook represents the API handler to update a webhook in the configured backend.

func UpdateRepo

func UpdateRepo(c *gin.Context)

UpdateRepo represents the API handler to update a repo in the configured backend.

func UpdateSecret

func UpdateSecret(c *gin.Context)

UpdateSecret updates a secret for the provided secrets service.

func UpdateService

func UpdateService(c *gin.Context)

UpdateService represents the API handler to update a service for a build in the configured backend.

func UpdateServiceLog

func UpdateServiceLog(c *gin.Context)

UpdateServiceLog represents the API handler to update the logs for a service in the configured backend.

func UpdateStep

func UpdateStep(c *gin.Context)

UpdateStep represents the API handler to update a step for a build in the configured backend.

func UpdateStepLog

func UpdateStepLog(c *gin.Context)

UpdateStepLog represents the API handler to update the logs for a step in the configured backend.

func UpdateUser

func UpdateUser(c *gin.Context)

UpdateUser represents the API handler to update a user in the configured backend.

func UpdateWorker added in v0.7.0

func UpdateWorker(c *gin.Context)

UpdateWorker represents the API handler to create a worker in the configured backend.

func Version added in v0.3.0

func Version(c *gin.Context)

Version represents the API handler to report the version number for Vela.

Types

type HeaderLink map[string]int

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

type Pagination struct {
	PerPage int
	Page    int
	Total   int64
}

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 (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.

Directories

Path Synopsis
Package admin provides the admin handlers for the Vela API.
Package admin provides the admin handlers for the Vela API.

Jump to

Keyboard shortcuts

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