juju: github.com/juju/juju/apiserver/common/apihttp Index | Files

package apihttp

import "github.com/juju/juju/apiserver/common/apihttp"

Index

Package Files

endpoint.go handler.go

type Endpoint Uses

type Endpoint struct {
    // Pattern is the pattern to match for the endpoint.
    Pattern string

    // Method is the HTTP method to use (e.g. GET).
    Method string

    // Handler is the HTTP handler to use.
    Handler http.Handler
}

Endpoint describes a single HTTP endpoint.

type HandlerConstraints Uses

type HandlerConstraints struct {
    // AuthKinds defines the kinds of authenticated "user" that the
    // handler supports. This correlates directly to entities, as
    // identified by tag kinds (e.g. names.UserTagKind). An empty list
    // will block all authentication.
    AuthKinds []string

    // StrictValidation is the value that will be used for the handler's
    // httpContext (see apiserver/httpcontext.go).
    StrictValidation bool

    // ControllerModelOnly is the value that will be used for the handler's
    // httpContext (see apiserver/httpcontext.go).
    ControllerModelOnly bool
}

HandlerConstraints describes conditions under which a handler may operate.

type HandlerSpec Uses

type HandlerSpec struct {
    // Constraints are the handler's constraints.
    Constraints HandlerConstraints

    // NewHandler returns a new HTTP handler for the given args.
    // The function is idempotent--if given the same args, it will
    // produce an equivalent handler each time.
    NewHandler func(NewHandlerArgs) http.Handler
}

HandlerSpec defines an HTTP handler for a specific endpoint on Juju's HTTP server. Such endpoints facilitate behavior that is not supported through normal (websocket) RPC. That includes file transfer.

type NewHandlerArgs Uses

type NewHandlerArgs struct {
    // Connect is the function that is used to connect to Juju's state
    // for the given HTTP request. It is the caller's responsibility
    // to call the release function returned. If the error arg is nil
    // the release function will always be a valid function.
    Connect func(*http.Request) (*state.State, func(), state.Entity, error)
}

NewHandlerArgs holds the args to the func in the NewHandler field of HandlerSpec.

Package apihttp imports 2 packages (graph) and is imported by 56 packages. Updated 2017-03-05. Refresh now. Tools for package owners.