Documentation
¶
Index ¶
- Constants
- Variables
- func AdminFacadeDetails() []facade.Details
- func AllFacades() *facade.Registry
- func DescribeFacades(registry *facade.Registry) []params.FacadeVersions
- func GetWatcherByID(watcherRegistry facade.WatcherRegistry, resources facade.Resources, id string) (worker.Worker, error)
- func IsAnonymousFacade(facadeName string) bool
- func IsControllerFacade(facadeName string) bool
- func IsMethodAllowedDuringMigration(facadeName, methodName string) bool
- func IsMethodAllowedDuringUpgrade(facadeName, methodName string) bool
- func IsModelFacade(facadeName string) bool
- type AccessService
- type ApplicationService
- type BakeryConfigService
- type Collector
- type ControllerConfigService
- type EntitiesWatcher
- type ExecEmbeddedCommandFunc
- type LogSinkConfig
- type MacaroonService
- type ModelInfoService
- type PingRootHandler
- type ProxyService
- type Server
- type ServerConfig
- type SharedHub
- type SrvModelSummaryWatcher
- type UserService
Constants ¶
const ( // MetricLabelEndpoint defines a constant for the APIConnections and // PingFailureCount Labels MetricLabelEndpoint = "endpoint" // MetricLabelModelUUID defines a constant for the PingFailureCount and // LogWriteCount Labels // Note: prometheus doesn't allow hyphens only underscores MetricLabelModelUUID = "model_uuid" // MetricLabelState defines a constant for the state Label MetricLabelState = "state" // MetricLabelHost defines a host constant for the Requests Label MetricLabelHost = "host" // MetricLabelStatus defines a status constant for the Requests Label MetricLabelStatus = "status" // MetricLabelVersion is the metric for the Juju Version of the controller MetricLabelVersion = "version" )
Variables ¶
var MaintenanceNoLoginError = errors.New("login failed - maintenance in progress")
var MetricAPIConnectionsLabelNames = []string{ MetricLabelEndpoint, }
MetricAPIConnectionsLabelNames defines a series of labels for the APIConnections metric.
var MetricLogLabelNames = []string{ MetricLabelModelUUID, MetricLabelState, }
MetricLogLabelNames defines a series of labels for the LogWrite and LogRead metric
var MetricPingFailureLabelNames = []string{ MetricLabelModelUUID, MetricLabelEndpoint, }
MetricPingFailureLabelNames defines a series of labels for the PingFailure metric.
var MetricTotalRequestsLabelNames = []string{ MetricLabelModelUUID, MetricLabelHost, }
MetricTotalRequestsLabelNames defines a series of labels for the TotalRequests metric.
var MetricTotalRequestsWithStatusLabelNames = []string{ MetricLabelModelUUID, MetricLabelHost, MetricLabelStatus, }
MetricTotalRequestsWithStatusLabelNames defines a series of labels for the TotalRequests metric.
Functions ¶
func AdminFacadeDetails ¶
AdminFacadeDetails returns information on the Admin facade provided at login time. The Facade field of the returned slice elements will be nil.
func AllFacades ¶
AllFacades returns a registry containing all known API facades.
This will panic if facade registration fails, but there is a unit test to guard against that.
func DescribeFacades ¶
func DescribeFacades(registry *facade.Registry) []params.FacadeVersions
DescribeFacades returns the list of available Facades and their Versions
func GetWatcherByID ¶
func GetWatcherByID(watcherRegistry facade.WatcherRegistry, resources facade.Resources, id string) (worker.Worker, error)
GetWatcherByID returns the watcher with the given ID. Deprecated: This only exists to support the old watcher API, once resources have been removed, this can be removed too.
func IsAnonymousFacade ¶
IsAnonymousFacade reports whether the given facade name can be accessed using an anonymous connection.
func IsControllerFacade ¶
IsControllerFacade reports whether the given facade name can be accessed using a controller connection.
func IsModelFacade ¶
IsModelFacade reports whether the given facade name can be accessed using a model connection.
Types ¶
type AccessService ¶
type AccessService interface { // ReadUserAccessLevelForTarget returns the subject's (user) access level // for the given user on the given target. // If the access level of a user cannot be found then // accesserrors.AccessNotFound is returned. ReadUserAccessLevelForTarget(ctx context.Context, subject user.Name, target permission.ID) (permission.Access, error) }
AccessService provides information about users and permissions.
type ApplicationService ¶
type ApplicationService interface { // GetApplicationDisplayStatus returns the display status of the specified application. // The display status is equal to the application status if it is set, otherwise it is // derived from the unit display statuses. // If no application is found, an error satisfying [applicationerrors.ApplicationNotFound] // is returned. GetApplicationDisplayStatus(context.Context, coreapplication.ID) (*corestatus.StatusInfo, error) // GetApplicationIDByName returns an application ID by application name. It // returns an error if the application can not be found by the name. // // Returns [applicationerrors.ApplicationNotFound] if the application is not found. GetApplicationIDByName(context.Context, string) (coreapplication.ID, error) }
type BakeryConfigService ¶
type BakeryConfigService interface { // GetOffersThirdPartyKey returns the key pair used with the cross-model // offers bakery. GetOffersThirdPartyKey(ctx context.Context) (*bakery.KeyPair, error) // GetExternalUsersThirdPartyKey returns the third party key pair used with // the external users bakery. GetExternalUsersThirdPartyKey(ctx context.Context) (*bakery.KeyPair, error) }
BakeryConfigService manages macaroon bakery config storage.
type Collector ¶
type Collector struct { BuildInfo prometheus.Gauge TotalConnections prometheus.Counter LoginAttempts prometheus.Gauge APIConnections *prometheus.GaugeVec APIRequestDuration *prometheus.SummaryVec PingFailureCount *prometheus.CounterVec LogWriteCount *prometheus.CounterVec LogReadCount *prometheus.CounterVec TotalRequests *prometheus.CounterVec TotalRequestErrors *prometheus.CounterVec TotalRequestsDuration *prometheus.SummaryVec }
Collector is a prometheus.Collector that collects metrics based on apiserver status.
func NewMetricsCollector ¶
func NewMetricsCollector() *Collector
NewMetricsCollector returns a new Collector.
func (*Collector) Collect ¶
func (c *Collector) Collect(ch chan<- prometheus.Metric)
Collect is part of the prometheus.Collector interface.
func (*Collector) Describe ¶
func (c *Collector) Describe(ch chan<- *prometheus.Desc)
Describe is part of the prometheus.Collector interface.
type ControllerConfigService ¶
type ControllerConfigService interface { // ControllerConfig returns the config values for the controller. ControllerConfig(context.Context) (controller.Config, error) }
ControllerConfigService defines the methods required to get the controller configuration.
type EntitiesWatcher ¶
type EntitiesWatcher interface { corewatcher.StringsWatcher // MapChanges maps the received strings to their according tag strings. // The EntityFinder interface representing state or a mock has to be // upcasted into the needed sub-interface of state for the real mapping. MapChanges(in []string) ([]string, error) }
EntitiesWatcher defines an interface based on the StringsWatcher but also providing a method for the mapping of the received strings to the tags of the according entities.
type ExecEmbeddedCommandFunc ¶
type ExecEmbeddedCommandFunc func(ctx *cmd.Context, store jujuclient.ClientStore, whitelist []string, cmdPlusArgs string) int
ExecEmbeddedCommandFunc defines a function which runs a named Juju command with the whitelisted sub commands.
type LogSinkConfig ¶
type LogSinkConfig struct { // RateLimitBurst defines the number of log messages that will be let // through before we start rate limiting. RateLimitBurst int64 // RateLimitRefill defines the rate at which log messages will be let // through once the initial burst amount has been depleted. RateLimitRefill time.Duration }
LogSinkConfig holds parameters to control the API server's logsink endpoint behaviour.
func DefaultLogSinkConfig ¶
func DefaultLogSinkConfig() LogSinkConfig
DefaultLogSinkConfig returns a LogSinkConfig with default values.
func (LogSinkConfig) Validate ¶
func (cfg LogSinkConfig) Validate() error
Validate validates the logsink endpoint configuration.
type MacaroonService ¶
type MacaroonService interface { dbrootkeystore.ContextBacking BakeryConfigService }
MacaroonService defines the method required to manage macaroons.
type ModelInfoService ¶
type ModelInfoService interface { // GetModelInfo returns the information for the current model. GetModelInfo(ctx context.Context) (model.ModelInfo, error) }
ModelInfoService provides access to information about the current model.
type PingRootHandler ¶
type PingRootHandler interface { WatcherRegistry() facade.WatcherRegistry CloseConn() error }
PingRootHandler is the interface that the root handler must implement to allow the pinger to be registered.
type ProxyService ¶
type ProxyService interface { // GetConnectionProxyInfo returns the proxy information for the controller. GetConnectionProxyInfo(context.Context) (proxy.Proxier, error) }
ProxyService defines the methods required to get proxy details.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds the server side of the API.
func NewServer ¶
func NewServer(ctx context.Context, cfg ServerConfig) (*Server, error)
NewServer serves API requests using the given configuration.
func (*Server) Dead ¶
func (srv *Server) Dead() <-chan struct{}
Dead returns a channel that signals when the server has exited.
func (*Server) GetAuditConfig ¶
GetAuditConfig returns a copy of the current audit logging configuration.
func (*Server) GetCentralHub ¶
func (srv *Server) GetCentralHub() *pubsub.StructuredHub
GetCentralHub returns the central hub for the server.
type ServerConfig ¶
type ServerConfig struct { Clock clock.Clock PingClock clock.Clock Tag names.Tag DataDir string LogDir string Hub *pubsub.StructuredHub Presence presence.Recorder Mux *apiserverhttp.Mux // ControllerUUID is the controller unique identifier. ControllerUUID string // ControllerModelUUID is the ID for the controller model. ControllerModelUUID model.UUID // LocalMacaroonAuthenticator is the request authenticator used for verifying // local user macaroons. LocalMacaroonAuthenticator macaroon.LocalMacaroonAuthenticator // JWTAuthenticator is the request authenticator used for validating jwt // tokens when the controller has been bootstrapped with a trusted token // provider. JWTAuthenticator jwt.Authenticator // StatePool is the StatePool used for looking up State // to pass to facades. StatePool will not be closed by the // server; it is the callers responsibility to close it // after the apiserver has exited. StatePool *state.StatePool // UpgradeComplete is a function that reports whether or not // the if the agent running the API server has completed // running upgrade steps. This is used by the API server to // limit logins during upgrades. UpgradeComplete func() bool // PublicDNSName is reported to the API clients who connect. PublicDNSName string // AllowModelAccess holds whether users will be allowed to // access models that they have access rights to even when // they don't have access to the controller. AllowModelAccess bool // NewObserver is a function which will return an observer. This // is used per-connection to instantiate a new observer to be // notified of key events during API requests. NewObserver observer.ObserverFactory // RegisterIntrospectionHandlers is a function that will // call a function with (path, http.Handler) tuples. This // is to support registering the handlers underneath the // "/introspection" prefix. RegisterIntrospectionHandlers func(func(string, http.Handler)) // LogSinkConfig holds parameters to control the API server's // logsink endpoint behaviour. If this is nil, the values from // DefaultLogSinkConfig() will be used. LogSinkConfig *LogSinkConfig // LogSink is used to store log records received from connected agents. LogSink corelogger.ModelLogger // GetAuditConfig holds a function that returns the current audit // logging config. The function may return updated values, so // should be called every time a new login is handled. GetAuditConfig func() auditlog.Config // LeaseManager gives access to leadership and singular claimers // and checkers for use in API facades. LeaseManager lease.Manager // MetricsCollector defines all the metrics to be collected for the // apiserver MetricsCollector *Collector // ExecEmbeddedCommand is a function which creates an embedded Juju CLI instance. ExecEmbeddedCommand ExecEmbeddedCommandFunc // CharmhubHTTPClient is the HTTP client used for Charmhub API requests. CharmhubHTTPClient facade.HTTPClient // DomainServicesGetter provides access to the services. DomainServicesGetter services.DomainServicesGetter // DBGetter returns WatchableDB implementations based on namespace. DBGetter changestream.WatchableDBGetter // DBDeleter is used to delete databases by namespace. DBDeleter database.DBDeleter // TracerGetter returns a tracer for the given namespace, this is used // for opentelmetry tracing. TracerGetter trace.TracerGetter // ObjectStoreGetter returns an object store for the given namespace. // This is used for retrieving blobs for charms and agents. ObjectStoreGetter objectstore.ObjectStoreGetter }
ServerConfig holds parameters required to set up an API server.
func (ServerConfig) Validate ¶
func (c ServerConfig) Validate() error
Validate validates the API server configuration.
type SharedHub ¶
type SharedHub interface {}
SharedHub represents the methods of the pubsub.StructuredHub that are used. The context uses an interface to allow mocking of the hub.
type SrvModelSummaryWatcher ¶
type SrvModelSummaryWatcher struct {
// contains filtered or unexported fields
}
SrvModelSummaryWatcher defines the API methods on a ModelSummaryWatcher.
func NewModelSummaryWatcher ¶
func NewModelSummaryWatcher(context facade.ModelContext) (*SrvModelSummaryWatcher, error)
NewModelSummaryWatcher returns a new API server endpoint for interacting with a watcher created by the WatchModelSummaries and WatchAllModelSummaries API calls.
func (*SrvModelSummaryWatcher) Next ¶
func (w *SrvModelSummaryWatcher) Next(ctx context.Context) (params.SummaryWatcherNextResults, error)
Next will return the current state of everything on the first call and subsequent calls will return just those model summaries that have changed.
type UserService ¶
type UserService interface { // GetUserByName returns the user with the given name. GetUserByName(context.Context, user.Name) (user.User, error) // SetPasswordWithActivationKey will use the activation key from the user // to then apply the payload password. SetPasswordWithActivationKey(ctx context.Context, name user.Name, nonce, box []byte) (userservice.Sealer, error) }
UserService defines the methods required to get user details.
Source Files
¶
- admin.go
- allfacades.go
- apiserver.go
- apiservermetrics.go
- config.go
- debuglog.go
- debuglog_tailer.go
- embeddedcli.go
- embeddedcli_whitelist.go
- httpcontext.go
- introspection.go
- leadership.go
- logsink.go
- logtransfer.go
- offerauth.go
- registration.go
- restrict_anonymous.go
- restrict_caasmodel.go
- restrict_controller.go
- restrict_migrations.go
- restrict_model.go
- restrict_upgrades.go
- restricted_root.go
- root.go
- service.go
- shared.go
- tools.go
- watcher.go
Directories
¶
Path | Synopsis |
---|---|
credentialcommon
Package credentialcommon is a generated GoMock package.
|
Package credentialcommon is a generated GoMock package. |
crossmodel/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
networkingcommon/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
secrets/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
storagecommon
Package storagecommon provides common storage-related services for API server facades.
|
Package storagecommon provides common storage-related services for API server facades. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
facades
|
|
agent/deployer/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
agent/hostkeyreporter
Package hostkeyreporter implements the API facade used by the hostkeyreporter worker.
|
Package hostkeyreporter implements the API facade used by the hostkeyreporter worker. |
agent/instancemutater/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
agent/machine
Package machine implements the API interface used by the machiner worker.
|
Package machine implements the API interface used by the machiner worker. |
agent/machineactions
Package machineactions implements the API server side of running actions on machines.
|
Package machineactions implements the API server side of running actions on machines. |
agent/migrationminion
Package migrationminion defines the API facade for use by the migration minion worker to monitor the progress of, and interact with, model migrations.
|
Package migrationminion defines the API facade for use by the migration minion worker to monitor the progress of, and interact with, model migrations. |
agent/provisioner
Package provisioner supplies the API facade used by the provisioner worker.
|
Package provisioner supplies the API facade used by the provisioner worker. |
agent/secretsdrain
Package secretsdrain provides the backend implementation for the secretsdrain facade.
|
Package secretsdrain provides the backend implementation for the secretsdrain facade. |
agent/secretsdrain/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
agent/secretsmanager
Package secretsmanager provides the backend implementation for the secretsmanager facade.
|
Package secretsmanager provides the backend implementation for the secretsmanager facade. |
agent/secretsmanager/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
agent/uniter
Package uniter implements the API interface used by the uniter worker.
|
Package uniter implements the API interface used by the uniter worker. |
agent/upgrader
Package upgrader is a generated GoMock package.
|
Package upgrader is a generated GoMock package. |
client/application
Package application contains API calls for functionality related to deploying and managing applications and their related charms.
|
Package application contains API calls for functionality related to deploying and managing applications and their related charms. |
client/bundle
Package bundle defines an API endpoint for functions dealing with bundles.
|
Package bundle defines an API endpoint for functions dealing with bundles. |
client/charms/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
client/client
Package client defines the Client facade, which is responsible for providing status API methods to the Juju client.
|
Package client defines the Client facade, which is responsible for providing status API methods to the Juju client. |
client/cloud
Package cloud defines an API endpoint for functions dealing with the controller's cloud definition, and cloud credentials.
|
Package cloud defines an API endpoint for functions dealing with the controller's cloud definition, and cloud credentials. |
client/cloud/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
client/controller
Package controller defines an API endpoint for functions dealing with controllers as a whole.
|
Package controller defines an API endpoint for functions dealing with controllers as a whole. |
client/controller/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
client/keymanager
Package keymanager is a generated GoMock package.
|
Package keymanager is a generated GoMock package. |
client/modelconfig/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
client/modelmanager
Package modelmanager defines an API endpoint for functions dealing with models: creating, listing and sharing models.
|
Package modelmanager defines an API endpoint for functions dealing with models: creating, listing and sharing models. |
client/modelmanager/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
client/modelupgrader
Package modelupgrader defines an API endpoint for functions dealing with upgrading models.
|
Package modelupgrader defines an API endpoint for functions dealing with upgrading models. |
client/modelupgrader/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
client/resources
Package resources contains API calls for functionality related to listing and indicating which resource an application should use.
|
Package resources contains API calls for functionality related to listing and indicating which resource an application should use. |
client/secretbackends
Package secretbackends provides the server implementation for the secretbackends facade.
|
Package secretbackends provides the server implementation for the secretbackends facade. |
client/secrets
Package secrets provides the backend implementation for the secrets facade.
|
Package secrets provides the backend implementation for the secrets facade. |
client/secrets/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
client/sshclient
Package sshclient implements the API endpoint required for Juju clients that wish to make SSH connections to Juju managed machines.
|
Package sshclient implements the API endpoint required for Juju clients that wish to make SSH connections to Juju managed machines. |
client/storage
Package storage provides an API server facade for managing storage entities.
|
Package storage provides an API server facade for managing storage entities. |
controller/caasmodelconfigmanager/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
controller/crossmodelsecrets/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
controller/migrationmaster
Package migrationmaster defines the API facade for use by the migration master worker when communicating with its own controller.
|
Package migrationmaster defines the API facade for use by the migration master worker when communicating with its own controller. |
controller/migrationmaster/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
controller/migrationtarget
Package migrationtarget defines the API facade for use by the migration master worker when interacting with the target controller during a migration.
|
Package migrationtarget defines the API facade for use by the migration master worker when interacting with the target controller during a migration. |
controller/remoterelations/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
controller/secretbackendmanager
Package secretbackendmanager provides the backend implementation for the secretbackendmanager facade.
|
Package secretbackendmanager provides the backend implementation for the secretbackendmanager facade. |
controller/undertaker
Package undertaker is a generated GoMock package.
|
Package undertaker is a generated GoMock package. |
controller/usersecrets
Package usersecrets provides the backend implementation for the usersecrets facade.
|
Package usersecrets provides the backend implementation for the usersecrets facade. |
controller/usersecrets/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
controller/usersecretsdrain
Package usersecretsdrain provides the backend implementation for the usersecretsdrain facade.
|
Package usersecretsdrain provides the backend implementation for the usersecretsdrain facade. |
controller/usersecretsdrain/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
Package httpattachment provides facilities for attaching a streaming blob of data and associated metadata to an HTTP API request, and for reading that blob on the server side.
|
Package httpattachment provides facilities for attaching a streaming blob of data and associated metadata to an HTTP API request, and for reading that blob on the server side. |
charms/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
metricobserver
Package metricobserver provides an implementation of apiserver/observer.ObserverFactory that maintains Prometheus metrics.
|
Package metricobserver provides an implementation of apiserver/observer.ObserverFactory that maintains Prometheus metrics. |
metricobserver/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
Package stateauthenticator is a generated GoMock package.
|
Package stateauthenticator is a generated GoMock package. |