api

package
v0.23.4 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 18 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 BaseMetrics

func BaseMetrics() http.Handler

BaseMetrics returns a Prometheus handler for serving go metrics.

func CustomMetrics

func CustomMetrics(c *gin.Context)

CustomMetrics returns custom Prometheus metrics from private functions.

func GetBadge added in v0.3.0

func GetBadge(c *gin.Context)

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

func Health

func Health(c *gin.Context)

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

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"`
	// QueuedBuildCount represents total number of builds currently in the queue
	QueuedBuildCount bool `form:"queued_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"`

	// IdleWorkerCount represents total number of workers with a status of idle
	// where worker RunningBuildIDs.length = 0
	IdleWorkerCount bool `form:"idle_worker_count"`
	// AvailableWorkerCount represents total number of workers with a status of available,
	// where worker RunningBuildIDs.length > 0 and < worker BuildLimit
	AvailableWorkerCount bool `form:"available_worker_count"`
	// BusyWorkerCount represents total number of workers with a status of busy,
	// where worker BuildLimit == worker RunningBuildIDs.length
	BusyWorkerCount bool `form:"busy_worker_count"`
	// ErrorWorkerCount represents total number of workers with a status of error
	ErrorWorkerCount bool `form:"error_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.
Package auth provides the auth handlers (authenticate, login, ...) for the Vela API.
Package auth provides the auth handlers (authenticate, login, ...) for the Vela API.
Package build provides the build handlers for the Vela API.
Package build provides the build handlers for the Vela API.
Package deployment provides the deployment handlers for the Vela API.
Package deployment provides the deployment handlers for the Vela API.
Package log provides the log handlers for the Vela API.
Package log provides the log handlers for the Vela API.
Package pipeline provides the pipeline handlers for the Vela API.
Package pipeline provides the pipeline handlers for the Vela API.
Package repo provides the repo handlers for the Vela API.
Package repo provides the repo handlers for the Vela API.
Package scm provides the scm handlers for the Vela API.
Package scm provides the scm handlers for the Vela API.
Package secret provides the secret handlers for the Vela API.
Package secret provides the secret handlers for the Vela API.
Package service provides the service handlers for the Vela API.
Package service provides the service handlers for the Vela API.
Package step provides the step handlers for the Vela API.
Package step provides the step handlers for the Vela API.
Package user provides the user handlers for the Vela API.
Package user provides the user handlers for the Vela API.
Package webhook provides the webhook handlers for the Vela API.
Package webhook provides the webhook handlers for the Vela API.
Package worker provides the worker handlers for the Vela API.
Package worker provides the worker handlers for the Vela API.

Jump to

Keyboard shortcuts

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