api

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2018 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Overview

Package api defines all endpoints accessible from the yFuzz API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateJob

func CreateJob(r *http.Request, dependencies EndpointDependencies) (int, interface{})

CreateJob creates new yFuzz jobs. Handler for POST /jobs

Body Parameters: - image: link to a docker image for a yFuzz job (string)

Response Fields: - job: name of the created job (string)

func DeleteJob

func DeleteJob(r *http.Request, dependencies EndpointDependencies) (int, interface{})

DeleteJob removes yFuzz jobs. Handler for DELETE /jobs/:job

URL Parameters: - job: the name of the job (string)

Response Fields: - none

func Endpoint

func Endpoint(handler endpointFunc, dependencies EndpointDependencies) http.Handler

Endpoint wraps an endpoint handler in some logic to catch errors and marshal a response to JSON

func GetJobLogs

func GetJobLogs(r *http.Request, dependencies EndpointDependencies) (int, interface{})

GetJobLogs retrieves the logs for a specific job. Handler for GET /jobs/:job/logs

URL Parameters: - job: the name of the job (string)

Query Parameters: - crashes_only: only show crashes (boolean) - tail: number of tail lines to truncate the log to (int)

Response Fields: - logs: logs from jobs ([]string)

func GetJobStatus

func GetJobStatus(r *http.Request, dependencies EndpointDependencies) (int, interface{})

GetJobStatus retrieves the status of all pods for a given job. Handler for GET /jobs/:job

URL Parameters: - job: the name of the job (string)

Response Fields: - crash_found: number of pods that found a crash (int) - no_crash: number of pods that timed out or hit the input limit with no crash (int) - pending: number of pods waiting to be scheduled (int) - running: number of pods currently running (int) - failed: number of pods that experienced an internal error (int) - unknown: number of pods that cannot be contacted (int)

func GetVersion

func GetVersion(r *http.Request, _ EndpointDependencies) (int, interface{})

GetVersion retrieves the server version. Handler for GET /version

Parameters: - none

Response Fields: - version: version of the yFuzz server (string)

func ListJobs

func ListJobs(r *http.Request, dependencies EndpointDependencies) (int, interface{})

ListJobs returns a list of all existing jobs on the cluster. Handler for GET /jobs

Parameters: - none

Response Fields: - jobs: all yFuzz jobs ([]string)

func ResponseFromError added in v0.0.8

func ResponseFromError(err error) schema.MessageHolder

ResponseFromError is a helper to return an object with an error message.

func ResponseMessage added in v0.0.8

func ResponseMessage(message string, i ...interface{}) schema.MessageHolder

ResponseMessage is a helper to return an object with a simple message.

Types

type EndpointDependencies

type EndpointDependencies struct {
	Kubernetes *kubernetes.API
}

EndpointDependencies holds objects endpoints rely on, such as a Kubernetes or database connection.

Jump to

Keyboard shortcuts

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