v0.0.0-...-e6e6db5 Latest Latest

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

Go to latest
Published: Jul 23, 2024 License: AGPL-3.0 Imports: 2 Imported by: 10




This section is empty.


This section is empty.


This section is empty.


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 {
	// 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

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. 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.

Jump to

Keyboard shortcuts

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