flux: github.com/weaveworks/flux/pkg/http Index | Files | Directories

package http

import "github.com/weaveworks/flux/pkg/http"


Package Files

accept.go errors.go routes.go transport.go validate.go


const (
    // Formerly Upstream methods, now (in v11) included in server API
    Ping    = "Ping"
    Version = "Version"
    Notify  = "Notify"

    ListServices            = "ListServices"
    ListServicesWithOptions = "ListServicesWithOptions"
    ListImages              = "ListImages"
    ListImagesWithOptions   = "ListImagesWithOptions"
    UpdateManifests         = "UpdateManifests"
    JobStatus               = "JobStatus"
    SyncStatus              = "SyncStatus"
    Export                  = "Export"
    GitRepoConfig           = "GitRepoConfig"

    UpdateImages           = "UpdateImages"
    UpdatePolicies         = "UpdatePolicies"
    GetPublicSSHKey        = "GetPublicSSHKey"
    RegeneratePublicSSHKey = "RegeneratePublicSSHKey"
const (
    RegisterDaemonV6  = "RegisterDaemonV6"
    RegisterDaemonV7  = "RegisterDaemonV7"
    RegisterDaemonV8  = "RegisterDaemonV8"
    RegisterDaemonV9  = "RegisterDaemonV9"
    RegisterDaemonV10 = "RegisterDaemonV10"
    RegisterDaemonV11 = "RegisterDaemonV11"

The RegisterDaemonX routes should move to weaveworks/flux-adapter once we remove `--connect`, since they are pertinent only to making an RPC relay connection.

const (
    LogEvent = "LogEvent"

This is part of the API -- but it's the outward-facing (or service provider) API, rather than the flux API.


var ErrorDeprecated = &fluxerr.Error{
    Type: fluxerr.Missing,
    Help: "" /* 337 byte string literal not displayed */,

    Err: errors.New("API endpoint deprecated"),
var ErrorUnauthorized = &fluxerr.Error{
    Type: fluxerr.User,
    Help: "" /* 252 byte string literal not displayed */,

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

func DeprecateVersions Uses

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

func ErrorResponse Uses

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

func ImplementsServer Uses

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 Uses

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

func MakeAPINotFound Uses

func MakeAPINotFound(path string) *fluxerr.Error

func MakeURL Uses

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

func NewAPIRouter Uses

func NewAPIRouter() *mux.Router

func NewUpstreamRouter Uses

func NewUpstreamRouter() *mux.Router

func UpstreamRoutes Uses

func UpstreamRoutes(r *mux.Router)

These (routes, and constructor following) should move to weaveworks/flux-adapter when `--connect` is removed from fluxd.

func WriteError Uses

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

type SortAccept Uses

type SortAccept struct {
    // contains filtered or unexported fields

func (SortAccept) Len Uses

func (s SortAccept) Len() int

func (SortAccept) Less Uses

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 Uses

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



Package http imports 11 packages (graph). Updated 2019-09-29. Refresh now. Tools for package owners.