apiserver

package
v0.0.0-...-b9bb202 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

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

func NewMetricsCollector

func NewMetricsCollector() *apiserver.Collector

NewMetricsCollector returns a new apiserver collector

func NewWorker

func NewWorker(ctx context.Context, config Config) (worker.Worker, error)

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

Types

type Config

type Config struct {
	AgentConfig                       agent.Config
	Clock                             clock.Clock
	Hub                               *pubsub.StructuredHub
	Presence                          presence.Recorder
	Mux                               *apiserverhttp.Mux
	LocalMacaroonAuthenticator        macaroon.LocalMacaroonAuthenticator
	StatePool                         *state.StatePool
	LeaseManager                      lease.Manager
	LogSink                           corelogger.ModelLogger
	RegisterIntrospectionHTTPHandlers func(func(path string, _ http.Handler))
	UpgradeComplete                   func() bool
	GetAuditConfig                    func() auditlog.Config
	NewServer                         NewServerFunc
	MetricsCollector                  *apiserver.Collector
	EmbeddedCommand                   apiserver.ExecEmbeddedCommandFunc
	CharmhubHTTPClient                HTTPClient

	// DBGetter supplies WatchableDB implementations by namespace.
	DBGetter                changestream.WatchableDBGetter
	DBDeleter               database.DBDeleter
	DomainServicesGetter    services.DomainServicesGetter
	TracerGetter            trace.TracerGetter
	ObjectStoreGetter       objectstore.ObjectStoreGetter
	ControllerConfigService ControllerConfigService
	ModelService            ModelService
}

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

func (Config) Validate

func (config Config) Validate() error

Validate validates the API server configuration.

type ControllerConfigService

type ControllerConfigService interface {
	// ControllerConfig returns the current controller configuration.
	ControllerConfig(context.Context) (controller.Config, error)
}

ControllerConfigService is the interface that the worker uses to get the controller configuration.

func GetControllerConfigService

func GetControllerConfigService(getter dependency.Getter, name string) (ControllerConfigService, error)

GetControllerConfigService is a helper function that gets a ControllerConfigService from the manifold.

type GetControllerConfigServiceFunc

type GetControllerConfigServiceFunc func(getter dependency.Getter, name string) (ControllerConfigService, error)

GetControllerConfigServiceFunc is a helper function that gets a ControllerConfigService from the manifold.

type GetModelServiceFunc

type GetModelServiceFunc func(getter dependency.Getter, name string) (ModelService, error)

GetModelServiceFunc is a helper function that gets a ModelService from the manifold.

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

type ManifoldConfig

type ManifoldConfig struct {
	AgentName              string
	AuthenticatorName      string
	ClockName              string
	MuxName                string
	StateName              string
	UpgradeGateName        string
	AuditConfigUpdaterName string
	LeaseManagerName       string
	LogSinkName            string
	HTTPClientName         string

	DBAccessorName     string
	ChangeStreamName   string
	DomainServicesName string
	TraceName          string
	ObjectStoreName    string

	PrometheusRegisterer              prometheus.Registerer
	RegisterIntrospectionHTTPHandlers func(func(path string, _ http.Handler))
	Hub                               *pubsub.StructuredHub
	Presence                          presence.Recorder
	GetControllerConfigService        GetControllerConfigServiceFunc
	GetModelService                   GetModelServiceFunc

	NewWorker           func(context.Context, Config) (worker.Worker, error)
	NewMetricsCollector func() *apiserver.Collector
}

ManifoldConfig holds the information necessary to run an apiserver worker in a dependency.Engine.

func (ManifoldConfig) Validate

func (config ManifoldConfig) Validate() error

Validate validates the manifold configuration.

type ModelService

type ModelService interface {
	// ControllerModel returns information for the controller model.
	ControllerModel(context.Context) (model.Model, error)
}

ModelService is the interface that the worker uses to get model information.

func GetModelService

func GetModelService(getter dependency.Getter, name string) (ModelService, error)

GetModelService is a helper function that gets a ModelService from the manifold.

type NewServerFunc

type NewServerFunc func(context.Context, apiserver.ServerConfig) (worker.Worker, error)

NewServerFunc is the type of function that will be used by the worker to create a new API server.

Jump to

Keyboard shortcuts

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