juju: github.com/juju/juju/worker/httpserver Index | Files

package httpserver

import "github.com/juju/juju/worker/httpserver"

Index

Package Files

logging.go manifold.go shim.go tls.go worker.go

func GetControllerConfig Uses

func GetControllerConfig(st *state.State) (controller.Config, error)

GetControllerConfig gets the controller config from a *State - it exists so we can test the manifold without a StateSuite.

func Manifold Uses

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency.Manifold that will run an HTTP server worker. The manifold outputs an *apiserverhttp.Mux, for other workers to register handlers against.

func NewTLSConfig Uses

func NewTLSConfig(st *state.State, getCertificate func() *tls.Certificate) (*tls.Config, error)

NewTLSConfig returns the TLS configuration for the HTTP server to use based on controller configuration stored in the state database.

func NewWorkerShim Uses

func NewWorkerShim(config Config) (worker.Worker, error)

NewWorkerShim calls through to NewWorker, and exists only to adapt to the signature of ManifoldConfig.NewWorker.

type Config Uses

type Config struct {
    AgentName            string
    Clock                clock.Clock
    TLSConfig            *tls.Config
    Mux                  *apiserverhttp.Mux
    MuxShutdownWait      time.Duration
    LogDir               string
    PrometheusRegisterer prometheus.Registerer
    Hub                  *pubsub.StructuredHub
    APIPort              int
    APIPortOpenDelay     time.Duration
    ControllerAPIPort    int
}

Config is the configuration required for running an API server worker.

func (Config) Validate Uses

func (config Config) Validate() error

Validate validates the API server configuration.

type ManifoldConfig Uses

type ManifoldConfig struct {
    CertWatcherName string
    HubName         string
    MuxName         string
    StateName       string

    // We don't use these in the worker, but we want to prevent the
    // httpserver from starting until they're running so that all of
    // their handlers are registered.
    RaftTransportName string
    APIServerName     string

    AgentName            string
    Clock                clock.Clock
    MuxShutdownWait      time.Duration
    LogDir               string
    PrometheusRegisterer prometheus.Registerer

    GetControllerConfig func(*state.State) (controller.Config, error)
    NewTLSConfig        func(*state.State, func() *tls.Certificate) (*tls.Config, error)
    NewWorker           func(Config) (worker.Worker, error)
}

ManifoldConfig holds the information necessary to run an HTTP server in a dependency.Engine.

func (ManifoldConfig) Validate Uses

func (config ManifoldConfig) Validate() error

Validate validates the manifold configuration.

type Worker Uses

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

func NewWorker Uses

func NewWorker(config Config) (*Worker, error)

NewWorker returns a new API server worker, with the given configuration.

func (*Worker) Kill Uses

func (w *Worker) Kill()

Kill implements worker.Kill.

func (*Worker) Report Uses

func (w *Worker) Report() map[string]interface{}

Report provides information for the engine report.

func (*Worker) URL Uses

func (w *Worker) URL() string

URL returns the base URL of the HTTP server of the form https://ipaddr:port with no trailing slash.

func (*Worker) Wait Uses

func (w *Worker) Wait() error

Wait implements worker.Wait.

Package httpserver imports 31 packages (graph) and is imported by 3 packages. Updated 2019-10-15. Refresh now. Tools for package owners.