api

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2015 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package api provides a RESTful HTTP API, enabling external apps to interact with clair.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHealthRouter

func NewHealthRouter() *httprouter.Router

NewHealthRouter creates a new router that only serve the Health function on /

func NewRouterV1

func NewRouterV1(to time.Duration) *httprouter.Router

NewRouterV1 creates a new router for the API (Version 1)

func RunHealth

func RunHealth(port int, st *utils.Stopper)

RunHealth launches the Health API, which only exposes a method to fetch clair's health without any security or authentification mechanism.

func RunMain

func RunMain(conf *Config, st *utils.Stopper)

RunMain launches the main API, which exposes every possible interactions with clair.

Types

type Config

type Config struct {
	Port                      int
	TimeOut                   time.Duration
	CertFile, KeyFile, CAFile string
}

Config represents the configuration for the Main API.

type VersionRouter

type VersionRouter map[string]*httprouter.Router

VersionRouter is an HTTP router that forwards requests to the appropriate router depending on the API version specified in the requested URI.

func NewVersionRouter

func NewVersionRouter(to time.Duration) *VersionRouter

NewVersionRouter instantiates a VersionRouter and every sub-routers that are necessary to handle supported API versions.

func (VersionRouter) ServeHTTP

func (vs VersionRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP forwards requests to the appropriate router depending on the API version specified in the requested URI and remove the version information from the request URL.Path, without modifying the request uRequestURI.

Directories

Path Synopsis
Package jsonhttp provides helper functions to write JSON responses to http.ResponseWriter and read JSON bodies from http.Request.
Package jsonhttp provides helper functions to write JSON responses to http.ResponseWriter and read JSON bodies from http.Request.
Package logic implements all the available API methods.
Package logic implements all the available API methods.
Package wrappers contains httprouter.Handle wrappers that are used in the API.
Package wrappers contains httprouter.Handle wrappers that are used in the API.

Jump to

Keyboard shortcuts

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