Documentation
¶
Overview ¶
Package controller defines an API endpoint for functions dealing with controllers as a whole.
Index ¶
- Variables
- func Register(registry facade.FacadeRegistry)
- type Application
- type ApplicationService
- type Backend
- type BlockCommandService
- type CloudService
- type ControllerAPI
- func (c *ControllerAPI) AllModels(ctx context.Context) (params.UserModelList, error)
- func (c *ControllerAPI) ConfigSet(ctx context.Context, args params.ControllerConfigSet) error
- func (c *ControllerAPI) ControllerVersion(ctx context.Context) (params.ControllerVersionResults, error)
- func (c *ControllerAPI) DashboardConnectionInfo(_ context.Context) (params.DashboardConnectionInfo, error)
- func (c *ControllerAPI) DestroyController(ctx context.Context, args params.DestroyControllerArgs) error
- func (c *ControllerAPI) GetControllerAccess(ctx context.Context, req params.Entities) (params.UserAccessResults, error)
- func (c *ControllerAPI) HostedModelConfigs(ctx context.Context) (params.HostedModelConfigsResults, error)
- func (c *ControllerAPI) IdentityProviderURL(ctx context.Context) (params.StringResult, error)
- func (c *ControllerAPI) InitiateMigration(ctx context.Context, reqArgs params.InitiateMigrationArgs) (params.InitiateMigrationResults, error)
- func (c *ControllerAPI) ListBlockedModels(ctx context.Context) (params.ModelBlockInfoList, error)
- func (c *ControllerAPI) ModifyControllerAccess(ctx context.Context, args params.ModifyControllerAccessRequest) (params.ErrorResults, error)
- func (c *ControllerAPI) MongoVersion(ctx context.Context) (params.StringResult, error)
- func (c *ControllerAPI) RemoveBlocks(ctx context.Context, args params.RemoveBlocksArgs) error
- func (c *ControllerAPI) WatchAllModelSummaries(ctx context.Context) (params.SummaryWatcherID, error)
- func (c *ControllerAPI) WatchAllModels(ctx context.Context) (params.AllWatcherId, error)
- func (c *ControllerAPI) WatchModelSummaries(ctx context.Context) (params.SummaryWatcherID, error)
- type ControllerAccessService
- type ControllerConfigService
- type CredentialService
- type MachineService
- type ModelAgentService
- type ModelConfigService
- type ModelExporter
- type ModelInfoService
- type ModelService
- type ProxyService
- type Relation
- type UpgradeService
Constants ¶
This section is empty.
Variables ¶
var LatestAPI = makeControllerAPI
LatestAPI is used for testing purposes to create the latest controller API.
Functions ¶
func Register ¶
func Register(registry facade.FacadeRegistry)
Register is called to expose a package of facades onto a given registry.
Types ¶
type Application ¶
type ApplicationService ¶
type ApplicationService interface { // GetApplicationLife returns the life value of the application with the given name. GetApplicationLife(ctx context.Context, name string) (life.Value, error) // GetUnitWorkloadStatus returns the workload status of the specified unit. GetUnitWorkloadStatus(context.Context, unit.Name) (*status.StatusInfo, error) }
ApplicationService provides access to the application service.
type BlockCommandService ¶
type BlockCommandService interface { // GetBlockSwitchedOn returns the optional block message if it is switched // on for the given type. GetBlockSwitchedOn(ctx context.Context, t blockcommand.BlockType) (string, error) // GetBlocks returns all the blocks that are currently in place. GetBlocks(ctx context.Context) ([]blockcommand.Block, error) // RemoveAllBlocks removes all the blocks that are currently in place. RemoveAllBlocks(ctx context.Context) error }
BlockCommandService defines methods for interacting with block commands.
type CloudService ¶
type CloudService interface { // Cloud returns the named cloud. Cloud(ctx context.Context, name string) (*cloud.Cloud, error) // WatchCloud returns a watcher that observes changes to the specified cloud. WatchCloud(ctx context.Context, name string) (watcher.NotifyWatcher, error) }
CloudService provides access to clouds.
type ControllerAPI ¶
type ControllerAPI struct { *common.ControllerConfigAPI *commonmodel.ModelStatusAPI cloudspec.CloudSpecer // contains filtered or unexported fields }
ControllerAPI provides the Controller API.
func NewControllerAPI ¶
func NewControllerAPI( ctx context.Context, st *state.State, pool *state.StatePool, authorizer facade.Authorizer, resources facade.Resources, presence facade.Presence, hub facade.Hub, logger corelogger.Logger, controllerConfigService ControllerConfigService, externalControllerService common.ExternalControllerService, cloudService CloudService, credentialService CredentialService, upgradeService UpgradeService, accessService ControllerAccessService, machineServiceGetter func(coremodel.UUID) commonmodel.MachineService, modelService ModelService, modelInfoService ModelInfoService, blockCommandService common.BlockCommandService, applicationServiceGetter func(coremodel.UUID) ApplicationService, modelAgentServiceGetter func(coremodel.UUID) common.ModelAgentService, modelConfigServiceGetter func(coremodel.UUID) cloudspec.ModelConfigService, blockCommandServiceGetter func(coremodel.UUID) BlockCommandService, proxyService ProxyService, modelExporter func(coremodel.UUID, facade.LegacyStateExporter) ModelExporter, store objectstore.ObjectStore, leadership leadership.Reader, ) (*ControllerAPI, error)
NewControllerAPI creates a new api server endpoint for operations on a controller.
func (*ControllerAPI) AllModels ¶
func (c *ControllerAPI) AllModels(ctx context.Context) (params.UserModelList, error)
AllModels allows controller administrators to get the list of all the models in the controller.
func (*ControllerAPI) ConfigSet ¶
func (c *ControllerAPI) ConfigSet(ctx context.Context, args params.ControllerConfigSet) error
ConfigSet changes the value of specified controller configuration settings. Only some settings can be changed after bootstrap. Settings that aren't specified in the params are left unchanged.
func (*ControllerAPI) ControllerVersion ¶
func (c *ControllerAPI) ControllerVersion(ctx context.Context) (params.ControllerVersionResults, error)
ControllerVersion returns the version information associated with this controller binary.
NOTE: the implementation intentionally does not check for SuperuserAccess as the Version is known even to users with login access.
func (*ControllerAPI) DashboardConnectionInfo ¶
func (c *ControllerAPI) DashboardConnectionInfo(_ context.Context) (params.DashboardConnectionInfo, error)
DashboardConnectionInfo returns the connection information for a client to connect to the Juju Dashboard including any proxying information.
func (*ControllerAPI) DestroyController ¶
func (c *ControllerAPI) DestroyController(ctx context.Context, args params.DestroyControllerArgs) error
DestroyController destroys the controller.
If the args specify the destruction of the models, this method will attempt to do so. Otherwise, if the controller has any non-empty, non-Dead hosted models, then an error with the code params.CodeHasHostedModels will be transmitted.
func (*ControllerAPI) GetControllerAccess ¶
func (c *ControllerAPI) GetControllerAccess(ctx context.Context, req params.Entities) (params.UserAccessResults, error)
GetControllerAccess returns the level of access the specified users have on the controller.
func (*ControllerAPI) HostedModelConfigs ¶
func (c *ControllerAPI) HostedModelConfigs(ctx context.Context) (params.HostedModelConfigsResults, error)
HostedModelConfigs returns all the information that the client needs in order to connect directly with the host model's provider and destroy it directly.
func (*ControllerAPI) IdentityProviderURL ¶
func (c *ControllerAPI) IdentityProviderURL(ctx context.Context) (params.StringResult, error)
IdentityProviderURL returns the URL of the configured external identity provider for this controller or an empty string if no external identity provider has been configured when the controller was bootstrapped.
NOTE: the implementation intentionally does not check for SuperuserAccess as the URL is known even to users with login access.
func (*ControllerAPI) InitiateMigration ¶
func (c *ControllerAPI) InitiateMigration(ctx context.Context, reqArgs params.InitiateMigrationArgs) ( params.InitiateMigrationResults, error, )
InitiateMigration attempts to begin the migration of one or more models to other controllers.
func (*ControllerAPI) ListBlockedModels ¶
func (c *ControllerAPI) ListBlockedModels(ctx context.Context) (params.ModelBlockInfoList, error)
ListBlockedModels returns a list of all models on the controller which have a block in place. The resulting slice is sorted by model name, then owner. Callers must be controller administrators to retrieve the list.
func (*ControllerAPI) ModifyControllerAccess ¶
func (c *ControllerAPI) ModifyControllerAccess(ctx context.Context, args params.ModifyControllerAccessRequest) (params.ErrorResults, error)
ModifyControllerAccess changes the model access granted to users.
func (*ControllerAPI) MongoVersion ¶
func (c *ControllerAPI) MongoVersion(ctx context.Context) (params.StringResult, error)
MongoVersion allows the introspection of the mongo version per controller
func (*ControllerAPI) RemoveBlocks ¶
func (c *ControllerAPI) RemoveBlocks(ctx context.Context, args params.RemoveBlocksArgs) error
RemoveBlocks removes all the blocks in the controller.
func (*ControllerAPI) WatchAllModelSummaries ¶
func (c *ControllerAPI) WatchAllModelSummaries(ctx context.Context) (params.SummaryWatcherID, error)
WatchAllModelSummaries starts watching the summary updates from the cache. This method is superuser access only, and watches all models in the controller.
func (*ControllerAPI) WatchAllModels ¶
func (c *ControllerAPI) WatchAllModels(ctx context.Context) (params.AllWatcherId, error)
WatchAllModels starts watching events for all models in the controller. The returned AllWatcherId should be used with Next on the AllModelWatcher endpoint to receive deltas.
func (*ControllerAPI) WatchModelSummaries ¶
func (c *ControllerAPI) WatchModelSummaries(ctx context.Context) (params.SummaryWatcherID, error)
WatchModelSummaries starts watching the summary updates from the cache. Only models that the user has access to are returned.
type ControllerAccessService ¶
type ControllerAccessService interface { // ReadUserAccessLevelForTarget returns the access level for the provided // subject (user) for controller. ReadUserAccessLevelForTarget(ctx context.Context, subject user.Name, target permission.ID) (permission.Access, error) // UpdatePermission updates the access level for a user for the controller. UpdatePermission(ctx context.Context, args access.UpdatePermissionArgs) error // LastModelLogin gets the time the specified user last connected to the // model. LastModelLogin(context.Context, user.Name, coremodel.UUID) (time.Time, error) }
ControllerAccessService provides a subset of the Access domain for use.
type ControllerConfigService ¶
type ControllerConfigService interface { // ControllerConfig returns a controller.Config ControllerConfig(context.Context) (corecontroller.Config, error) // UpdateControllerConfig updates the controller config and has an optional // list of config keys to remove. UpdateControllerConfig(context.Context, corecontroller.Config, []string) error }
ControllerConfigService is the interface that wraps the ControllerConfig method.
type CredentialService ¶
type CredentialService interface { // CloudCredential returns the cloud credential for the given tag. CloudCredential(ctx context.Context, key credential.Key) (cloud.Credential, error) // WatchCredential returns a watcher that observes changes to the specified // credential. WatchCredential(ctx context.Context, key credential.Key) (watcher.NotifyWatcher, error) }
CredentialService provides access to credentials.
type MachineService ¶
type MachineService interface { // EnsureDeadMachine sets the provided machine's life status to Dead. // No error is returned if the provided machine doesn't exist, just nothing // gets updated. EnsureDeadMachine(ctx context.Context, machineName machine.Name) error // GetMachineUUID returns the UUID of a machine identified by its name. GetMachineUUID(ctx context.Context, name machine.Name) (string, error) // InstanceID returns the cloud specific instance id for this machine. InstanceID(ctx context.Context, mUUID string) (instance.Id, error) // InstanceIDAndName returns the cloud specific instance ID and display name for // this machine. InstanceIDAndName(ctx context.Context, machineUUID string) (instance.Id, string, error) // HardwareCharacteristics returns the hardware characteristics of the // specified machine. HardwareCharacteristics(ctx context.Context, machineUUID string) (*instance.HardwareCharacteristics, error) }
MachineService defines the methods that the facade assumes from the Machine service.
type ModelAgentService ¶
type ModelAgentService interface { // GetModelTargetAgentVersion returns the target agent version for the // entire model. The following errors can be returned: // - [github.com/juju/juju/domain/model/errors.NotFound] - When the model does // not exist. GetModelTargetAgentVersion(context.Context) (version.Number, error) }
ModelAgentService provides access to the Juju agent version for the model.
type ModelConfigService ¶
type ModelConfigService interface { // ModelConfig returns the current config for the model. ModelConfig(ctx context.Context) (*config.Config, error) }
ModelConfigService is an interface that provides access to the model configuration.
type ModelExporter ¶
type ModelExporter interface { // ExportModel exports a model to a description.Model. // It requires a known set of leaders to be passed in, so that applications // can have their leader set correctly once imported. // The objectstore is used to retrieve charms and resources for export. ExportModel(context.Context, map[string]string, objectstore.ObjectStore) (description.Model, error) }
ModelExporter exports a model to a description.Model.
type ModelInfoService ¶
type ModelInfoService interface { // GetStatus returns the current status of the model. // The following error types can be expected to be returned: // - [github.com/juju/juju/modelerrors.NotFound]: When the model does not exist. GetStatus(context.Context) (domainmodel.StatusInfo, error) }
ModelInfoService defines domain service methods for managing a model.
type ModelService ¶
type ModelService interface { // Model returns the model associated with the provided uuid. Model(ctx context.Context, uuid coremodel.UUID) (coremodel.Model, error) // ControllerModel returns the model used for housing the Juju controller. ControllerModel(ctx context.Context) (coremodel.Model, error) // GetModelUsers will retrieve basic information about users with permissions on // the given model UUID. GetModelUsers(ctx context.Context, modelUUID coremodel.UUID) ([]coremodel.ModelUserInfo, error) }
ModelService provides access to information about running Juju agents.
type ProxyService ¶
type ProxyService interface { // GetProxyToApplication returns the proxy information for the application // with the given port. GetProxyToApplication(ctx context.Context, appName, remotePort string) (proxy.Proxier, error) }
ProxyService provides access to the proxy service.