http

package
v0.0.0-...-c42b1bb Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListServices          = "ListServices"
	ListImages            = "ListImages"
	ListImagesWithOptions = "ListImagesWithOptions"
	UpdateManifests       = "UpdateManifests"
	JobStatus             = "JobStatus"
	SyncStatus            = "SyncStatus"
	Export                = "Export"
	GitRepoConfig         = "GitRepoConfig"

	UpdateImages           = "UpdateImages"
	UpdatePolicies         = "UpdatePolicies"
	GetPublicSSHKey        = "GetPublicSSHKey"
	RegeneratePublicSSHKey = "RegeneratePublicSSHKey"
)

Variables

View Source
var (
	RegisterDaemonV6  = "RegisterDaemonV6"
	RegisterDaemonV7  = "RegisterDaemonV7"
	RegisterDaemonV8  = "RegisterDaemonV8"
	RegisterDaemonV9  = "RegisterDaemonV9"
	RegisterDaemonV10 = "RegisterDaemonV10"
	LogEvent          = "LogEvent"
)
View Source
var ErrorDeprecated = &fluxerr.Error{
	Type: fluxerr.Missing,
	Help: `The API endpoint requested appears to have been deprecated.

This indicates your client (fluxctl) needs to be updated: please see

    https://github.com/weaveworks/flux/releases

If you still have this problem after upgrading, please file an issue at

    https://github.com/weaveworks/flux/issues

mentioning what you were attempting to do, and the output of

    fluxctl status
`,
	Err: errors.New("API endpoint deprecated"),
}
View Source
var ErrorUnauthorized = &fluxerr.Error{
	Type: fluxerr.User,
	Help: `The request failed authentication

This most likely means you have a missing or incorrect token. Please
make sure you supply a service token, either by setting the
environment variable FLUX_SERVICE_TOKEN, or using the argument --token
with fluxctl.

`,
	Err: errors.New("request failed authentication"),
}

Functions

func DeprecateVersions

func DeprecateVersions(r *mux.Router, versions ...string)

func ErrorResponse

func ErrorResponse(w http.ResponseWriter, r *http.Request, apiError error)

func ImplementsServer

func ImplementsServer(router *mux.Router) error

ImplementsServer verifies that a given `*mux.Router` has handlers for all routes specified in `NewAPIRouter()`.

We can't easily check whether a router implements the `api.Server` interface, as would be desired, so we rely on the knowledge that `*client.Client` implements `api.Server` while also depending on route name strings defined in this package.

Returns an error if router doesn't fully implement `NewAPIRouter()`, nil otherwise.

func JSONResponse

func JSONResponse(w http.ResponseWriter, r *http.Request, result interface{})

func MakeAPINotFound

func MakeAPINotFound(path string) *fluxerr.Error

func MakeURL

func MakeURL(endpoint string, router *mux.Router, routeName string, urlParams ...string) (*url.URL, error)

func NewAPIRouter

func NewAPIRouter() *mux.Router

func NewUpstreamRouter

func NewUpstreamRouter() *mux.Router

func UpstreamRoutes

func UpstreamRoutes(r *mux.Router)

func WriteError

func WriteError(w http.ResponseWriter, r *http.Request, code int, err error)

Types

type SortAccept

type SortAccept struct {
	// contains filtered or unexported fields
}

func (SortAccept) Len

func (s SortAccept) Len() int

func (SortAccept) Less

func (s SortAccept) Less(i, j int) bool

We want to sort by descending order of suitability: higher quality to lower quality, and preferred to less preferred.

func (SortAccept) Swap

func (s SortAccept) Swap(i, j int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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