api

package
v1.0.259 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ECONFLICT       = "conflict"
	EFORBIDDEN      = "forbidden"
	EINTERNAL       = "internal"
	EINVALID        = "invalid"
	ENOTFOUND       = "not_found"
	ENOTIMPLEMENTED = "not_implemented"
	EUNAUTHORIZED   = "unauthorized"
)

Application error codes.

These are meant to be generic and they map well to HTTP error codes.

Variables

View Source
var (
	DefaultWindow = "1h"
)

Functions

func About added in v0.38.70

func About(c echo.Context) error

func CheckDetails added in v0.38.70

func CheckDetails(c echo.Context) error

func DetailsHandler added in v0.38.96

func DetailsHandler(c echo.Context) error

func ErrorCode added in v1.0.85

func ErrorCode(err error) string

ErrorCode unwraps an application error and returns its code. Non-application errors always return EINTERNAL.

func ErrorDebugInfo added in v1.0.85

func ErrorDebugInfo(err error) string

ErrorDebugInfo unwraps an application error and returns its debug message.

func ErrorMessage added in v1.0.85

func ErrorMessage(err error) string

ErrorMessage unwraps an application error and returns its message. Non-application errors always return "Internal error".

func ErrorStatusCode added in v1.0.85

func ErrorStatusCode(code string) int

ErrorStatusCode returns the associated HTTP status code for an application error code.

func GetBestPartitioner added in v1.0.199

func GetBestPartitioner(totalChecks int, rangeDuration time.Duration) time.Duration

func HealthSummary added in v0.38.232

func HealthSummary(c echo.Context) error

func PostDataToServer added in v0.38.85

func PostDataToServer(server string, body io.Reader) (err error)

func PushHandler added in v0.38.85

func PushHandler(c echo.Context) error

func RunCanaryHandler added in v0.38.257

func RunCanaryHandler(c echo.Context) error

func RunTopologyHandler added in v0.38.257

func RunTopologyHandler(c echo.Context) error

func Topology added in v0.38.85

func Topology(c echo.Context) error

TopologyQuery godoc @Id TopologyQuery @Summary Topology query @Description Query the topology graph @Tags topology @Produce json @Param id query string false "Topology ID" @Param topologyId query string false "Topology ID" @Param componentId query string false "Component ID" @Param owner query string false "Owner" @Param status query string false "Comma separated list of status" @Param types query string false "Comma separated list of types" @Param flatten query string false "Flatten the topology" @Success 200 {object} pkg.Components @Router /api/topology [get]

func WebhookHandler added in v1.0.85

func WebhookHandler(c echo.Context) error

func WriteError added in v1.0.85

func WriteError(c echo.Context, err error) error

WriteError writes the error to the HTTP response with appropriate status code

Types

type CheckData added in v1.0.85

type CheckData struct {
	Headers map[string]string `json:"headers"`
	JSON    map[string]any    `json:"json,omitempty"`
	Content string            `json:"content,omitempty"`
}

type CheckErrorMessage added in v0.38.257

type CheckErrorMessage struct {
	Description string `json:"description"`
	Error       string `json:"error"`
}

type DetailResponse added in v0.38.70

type DetailResponse struct {
	Duration   int                `json:"duration,omitempty"`
	RunnerName string             `json:"runnerName"`
	Status     []query.Timeseries `json:"status"`
	Latency    types.Latency      `json:"latency"`
	Uptime     types.Uptime       `json:"uptime"`
}

type Error added in v1.0.85

type Error struct {
	// Machine-readable error code.
	Code string

	// Human-readable error message.
	Message string

	// DebugInfo contains low-level internal error details that should only be logged.
	// End-users should never see this.
	DebugInfo string
}

Error represents an application-specific error.

func Errorf added in v1.0.85

func Errorf(code string, format string, args ...any) *Error

Errorf is a helper function to return an Error with a given code and formatted message.

func (*Error) Error added in v1.0.85

func (e *Error) Error() string

Error implements the error interface. Not used by the application otherwise.

func (*Error) WithDebugInfo added in v1.0.85

func (e *Error) WithDebugInfo(msg string, args ...any) *Error

WithDebugInfo wraps an application error with a debug message.

type HTTPError added in v1.0.85

type HTTPError struct {
	Error   string `json:"error"`
	Message string `json:"message,omitempty"`
}

type HTTPSuccess added in v1.0.85

type HTTPSuccess struct {
	Message string `json:"message"`
	Payload any    `json:"payload,omitempty"`
}

type QueueData added in v0.38.85

type QueueData struct {
	Check  pkg.Check       `json:",inline"`
	Status pkg.CheckStatus `json:",inline"`
}

type Response

type Response struct {
	Duration      int                   `json:"duration,omitempty"`
	RunnerName    string                `json:"runnerName"`
	Checks        pkg.Checks            `json:"checks,omitempty"`
	ChecksSummary []models.CheckSummary `json:"checks_summary,omitempty"`
}

Jump to

Keyboard shortcuts

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