apihttp

package
v0.0.0-...-6cf1bc9 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2016 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

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

type HandlerConstraints struct {
	// AuthKind defines the kind of authenticated "user" that the
	// handler supports. This correlates directly to entities, as
	// identified by tag kinds (e.g. names.UserTagKind). The empty
	// string indicates support for unauthenticated requests.
	AuthKind 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

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

type NewHandlerArgs struct {
	// Connect is the function that is used to connect to Juju's state
	// for the given HTTP request.
	Connect func(*http.Request) (*state.State, state.Entity, error)
}

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

Jump to

Keyboard shortcuts

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