Documentation
¶
Index ¶
- func DestroyController(ctx context.Context, st ModelManagerBackend, ...) error
- func DestroyModel(ctx context.Context, st ModelManagerBackend, ...) error
- func EncodeAccess(descriptionAccess permission.Access) (params.UserAccessPermission, error)
- func HasModelAdmin(ctx context.Context, authorizer facade.Authorizer, ...) (bool, error)
- func ModelApplicationInfo(applications []Application) ([]params.ModelApplicationInfo, error)
- func ModelFilesystemInfo(in []state.Filesystem) []params.ModelFilesystemInfo
- func ModelMachineInfo(ctx context.Context, st ModelManagerBackend, machineService MachineService) (machineInfo []params.ModelMachineInfo, _ error)
- func ModelUserInfo(ctx context.Context, service modelService, modelTag names.ModelTag, ...) ([]params.ModelUserInfo, error)
- func ModelVolumeInfo(in []state.Volume) []params.ModelVolumeInfo
- type Application
- type BlockCommandService
- type ControllerNode
- type Machine
- type MachineService
- type Model
- type ModelConfigService
- type ModelConfigWatcher
- type ModelInfoService
- type ModelMachinesWatcher
- type ModelManagerBackend
- type ModelStatusAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DestroyController ¶
func DestroyController( ctx context.Context, st ModelManagerBackend, blockCommandService BlockCommandService, modelInfoService ModelInfoService, blockCommandServiceGetter func(model.UUID) BlockCommandService, destroyHostedModels bool, destroyStorage *bool, force *bool, maxWait *time.Duration, modelTimeout *time.Duration, ) error
DestroyController sets the controller model to Dying and, if requested, schedules cleanups so that all of the hosted models are destroyed, or otherwise returns an error indicating that there are hosted models remaining.
func DestroyModel ¶
func DestroyModel( ctx context.Context, st ModelManagerBackend, blockCommandService BlockCommandService, modelInfoService ModelInfoService, destroyStorage *bool, force *bool, maxWait *time.Duration, timeout *time.Duration, ) error
DestroyModel sets the model to Dying, such that the model's resources will be destroyed and the model removed from the controller.
func EncodeAccess ¶
func EncodeAccess(descriptionAccess permission.Access) (params.UserAccessPermission, error)
EncodeAccess converts permission.Access to params.AccessPermission.
func HasModelAdmin ¶
func HasModelAdmin( ctx context.Context, authorizer facade.Authorizer, controllerTag names.ControllerTag, modelTag names.ModelTag, ) (bool, error)
HasModelAdmin reports whether a user has admin access to the input model. A user has model access if they are a controller superuser, or if they have been explicitly granted admin access to the model.
func ModelApplicationInfo ¶
func ModelApplicationInfo(applications []Application) ([]params.ModelApplicationInfo, error)
ModelApplicationInfo returns information about applications.
func ModelFilesystemInfo ¶
func ModelFilesystemInfo(in []state.Filesystem) []params.ModelFilesystemInfo
ModelFilesystemInfo returns information about filesystems in the model.
func ModelMachineInfo ¶
func ModelMachineInfo(ctx context.Context, st ModelManagerBackend, machineService MachineService) (machineInfo []params.ModelMachineInfo, _ error)
ModelMachineInfo returns information about machine hardware for alive top level machines (not containers).
func ModelUserInfo ¶
func ModelUserInfo(ctx context.Context, service modelService, modelTag names.ModelTag, apiUser user.Name, isAdmin bool) ([]params.ModelUserInfo, error)
ModelUserInfo gets model user info from the modelService and converts it into params.ModelUserInfo.
func ModelVolumeInfo ¶
func ModelVolumeInfo(in []state.Volume) []params.ModelVolumeInfo
ModelVolumeInfo returns information about volumes in the model.
Types ¶
type Application ¶
Application defines methods provided by a state.Application instance.
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) }
BlockCommandService defines methods for interacting with block commands.
type ControllerNode ¶
type Machine ¶
type Machine interface { Id() string Status() (status.StatusInfo, error) ContainerType() instance.ContainerType Life() state.Life ForceDestroy(time.Duration) error Destroy(objectstore.ObjectStore) error IsManager() bool }
type MachineService ¶
type MachineService interface { // GetMachineUUID returns the UUID of a machine identified by its name. GetMachineUUID(ctx context.Context, name machine.Name) (string, 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 Model ¶
type Model interface { Type() state.ModelType Life() state.Life ModelTag() names.ModelTag Owner() names.UserTag CloudName() string CloudCredentialTag() (names.CloudCredentialTag, bool) CloudRegion() string Destroy(state.DestroyModelParams) error MigrationMode() state.MigrationMode Name() string UUID() string // TODO(aflynn): ControllerUUID is only here because the EnvironConfigGetter // needs a Model with this model. Once this is gone ControllerUUID can be // removed from this interface. ControllerUUID() string SetCloudCredential(tag names.CloudCredentialTag) (bool, error) }
Model defines methods provided by a state.Model instance. All the interface methods are defined directly on state.Model and are reproduced here for use in tests.
type ModelConfigService ¶
type ModelConfigService interface { // ModelConfig returns the current config for the model. ModelConfig(ctx context.Context) (*config.Config, error) // Watch returns a watcher that returns keys for any changes to model // config. Watch() (watcher.StringsWatcher, error) }
ModelConfigService is an interface that provides access to the model configuration.
type ModelConfigWatcher ¶
type ModelConfigWatcher struct {
// contains filtered or unexported fields
}
ModelConfigWatcher implements two common methods for use by various facades - WatchForModelConfigChanges and ModelConfig.
func NewModelConfigWatcher ¶
func NewModelConfigWatcher(modelConfigService ModelConfigService, watcherRegistry facade.WatcherRegistry) *ModelConfigWatcher
NewModelConfigWatcher returns a new ModelConfigWatcher. Active watchers will be stored in the provided facade.WatcherRegistry.
func (*ModelConfigWatcher) ModelConfig ¶
func (m *ModelConfigWatcher) ModelConfig(ctx context.Context) (params.ModelConfigResult, error)
ModelConfig returns the current model's configuration.
func (*ModelConfigWatcher) WatchForModelConfigChanges ¶
func (m *ModelConfigWatcher) WatchForModelConfigChanges(ctx context.Context) (params.NotifyWatchResult, error)
WatchForModelConfigChanges returns a NotifyWatcher that observes changes to the model configuration. Note that although the NotifyWatchResult contains an Error field, it's not used because we are only returning a single watcher, so we use the regular error return.
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 ModelMachinesWatcher ¶
type ModelMachinesWatcher struct {
// contains filtered or unexported fields
}
ModelMachinesWatcher implements a common WatchModelMachines method for use by various facades.
func NewModelMachinesWatcher ¶
func NewModelMachinesWatcher(st state.ModelMachinesWatcher, resources facade.Resources, authorizer facade.Authorizer) *ModelMachinesWatcher
NewModelMachinesWatcher returns a new ModelMachinesWatcher. The GetAuthFunc will be used on each invocation of WatchUnits to determine current permissions.
func (*ModelMachinesWatcher) WatchModelMachineStartTimes ¶
func (e *ModelMachinesWatcher) WatchModelMachineStartTimes(ctx context.Context) (params.StringsWatchResult, error)
WatchModelMachineStartTimes watches the non-container machines in the model for changes to the Life or AgentStartTime fields and reports them as a batch.
func (*ModelMachinesWatcher) WatchModelMachines ¶
func (e *ModelMachinesWatcher) WatchModelMachines(ctx context.Context) (params.StringsWatchResult, error)
WatchModelMachines returns a StringsWatcher that notifies of changes to the life cycles of the top level machines in the current model.
type ModelManagerBackend ¶
type ModelManagerBackend interface { APIHostPortsForAgents(controller.Config) ([]network.SpaceHostPorts, error) ToolsStorage(objectstore.ObjectStore) (binarystorage.StorageCloser, error) ModelUUID() string NewModel(state.ModelArgs) (Model, ModelManagerBackend, error) Model() (Model, error) AllModelUUIDs() ([]string, error) GetModel(string) (Model, func() bool, error) GetBackend(string) (ModelManagerBackend, func() bool, error) ControllerModelTag() names.ModelTag IsController() bool ControllerNodes() ([]ControllerNode, error) Unit(name string) (*state.Unit, error) Name() string ModelTag() names.ModelTag AllMachines() (machines []Machine, err error) AllApplications() (applications []Application, err error) AllFilesystems() ([]state.Filesystem, error) AllVolumes() ([]state.Volume, error) ControllerTag() names.ControllerTag Export(leaders map[string]string, store objectstore.ObjectStore) (description.Model, error) ExportPartial(state.ExportConfig, objectstore.ObjectStore) (description.Model, error) ConstraintsBySpaceName(string) ([]*state.Constraints, error) LatestMigration() (state.ModelMigration, error) DumpAll() (map[string]interface{}, error) Close() error HAPrimaryMachine() (names.MachineTag, error) }
ModelManagerBackend defines methods provided by a state instance used by the model manager apiserver implementation. All the interface methods are defined directly on state.State and are reproduced here for use in tests.
func NewModelManagerBackend ¶
func NewModelManagerBackend(m *state.Model, pool *state.StatePool) ModelManagerBackend
NewModelManagerBackend returns a modelManagerStateShim wrapping the passed state, which implements ModelManagerBackend.
func NewUserAwareModelManagerBackend ¶
func NewUserAwareModelManagerBackend(m *state.Model, pool *state.StatePool, u names.UserTag) ModelManagerBackend
NewUserAwareModelManagerBackend returns a user-aware modelManagerStateShim wrapping the passed state, which implements ModelManagerBackend. The returned backend may emit redirect errors when attempting a model lookup for a migrated model that this user had been granted access to.
type ModelStatusAPI ¶
type ModelStatusAPI struct {
// contains filtered or unexported fields
}
ModelStatusAPI implements the ModelStatus() API.
func NewModelStatusAPI ¶
func NewModelStatusAPI(backend ModelManagerBackend, getMachineService func(coremodel.UUID) MachineService, authorizer facade.Authorizer, apiUser names.UserTag) *ModelStatusAPI
NewModelStatusAPI creates an implementation providing the ModelStatus() API.
func (*ModelStatusAPI) ModelStatus ¶
func (c *ModelStatusAPI) ModelStatus(ctx context.Context, req params.Entities) (params.ModelStatusResults, error)
ModelStatus returns a summary of the model.