Documentation
¶
Overview ¶
Package modelmanager defines an API endpoint for functions dealing with models: creating, listing and sharing models. This facade is available at the root of the controller API, and as such, there is no implicit Model associated.
Index ¶
- func Register(registry facade.FacadeRegistry)
- type AccessService
- type ApplicationService
- type BlockCommandService
- type CloudService
- type ConfigSource
- type CredentialService
- type DomainServicesGetter
- type MachineService
- type ModelAgentService
- type ModelConfigService
- type ModelConfigServiceGetter
- type ModelDefaultsService
- type ModelDomainServices
- type ModelExporter
- type ModelInfoService
- type ModelManagerAPI
- func (m *ModelManagerAPI) ChangeModelCredential(ctx context.Context, args params.ChangeModelCredentialsParams) (params.ErrorResults, error)
- func (m *ModelManagerAPI) CreateModel(ctx context.Context, args params.ModelCreateArgs) (params.ModelInfo, error)
- func (m *ModelManagerAPI) DestroyModels(ctx context.Context, args params.DestroyModelsParams) (params.ErrorResults, error)
- func (m *ModelManagerAPI) DumpModels(ctx context.Context, args params.DumpModelRequest) params.StringResults
- func (m *ModelManagerAPI) DumpModelsDB(ctx context.Context, args params.Entities) params.MapResults
- func (m *ModelManagerAPI) ListModelSummaries(ctx context.Context, req params.ModelSummariesRequest) (params.ModelSummaryResults, error)
- func (m *ModelManagerAPI) ListModels(ctx context.Context, userEntity params.Entity) (params.UserModelList, error)
- func (m *ModelManagerAPI) ModelDefaultsForClouds(ctx context.Context, args params.Entities) (params.ModelDefaultsResults, error)
- func (m *ModelManagerAPI) ModelInfo(ctx context.Context, args params.Entities) (params.ModelInfoResults, error)
- func (m *ModelManagerAPI) ModifyModelAccess(ctx context.Context, args params.ModifyModelAccessRequest) (result params.ErrorResults, _ error)
- func (m *ModelManagerAPI) SetModelDefaults(ctx context.Context, args params.SetModelDefaults) (params.ErrorResults, error)
- func (m *ModelManagerAPI) UnsetModelDefaults(ctx context.Context, args params.UnsetModelDefaults) (params.ErrorResults, error)
- type ModelService
- type NetworkService
- type SecretBackendService
- type Services
- type StateBackend
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(registry facade.FacadeRegistry)
Register is called to expose a package of facades onto a given registry.
Types ¶
type AccessService ¶
type AccessService interface { // GetUserByName returns a User for the given name. GetUserByName(context.Context, coreuser.Name) (coreuser.User, error) // ReadUserAccessLevelForTarget returns the Access level for the given // subject (user) on the given target (model). // If the access level of a user cannot be found then // [github.com/juju/juju/domain/access/errors.AccessNotFound] is returned. ReadUserAccessLevelForTarget(ctx context.Context, subject coreuser.Name, target corepermission.ID) (corepermission.Access, error) // UpdatePermission updates the access level for a user of the model. UpdatePermission(ctx context.Context, args access.UpdatePermissionArgs) error // LastModelLogin will return the last login time of the specified // user. // [github.com/juju/juju/domain/access/errors.UserNeverAccessedModel] will // be returned if there is no record of the user logging in to this model. LastModelLogin(context.Context, coreuser.Name, coremodel.UUID) (time.Time, error) }
AccessService defines a interface for interacting the users and permissions of a controller.
type ApplicationService ¶
type ApplicationService interface { // GetSupportedFeatures returns the set of features supported by the service. GetSupportedFeatures(ctx context.Context) (assumes.FeatureSet, error) }
ApplicationService instances save an application to dqlite state.
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 switched on. GetBlocks(ctx context.Context) ([]blockcommand.Block, error) }
BlockCommandService defines methods for interacting with block commands.
type CloudService ¶
type CloudService interface { common.CloudService // ListAll return all clouds. ListAll(ctx context.Context) ([]jujucloud.Cloud, error) }
CloudService provides access to clouds.
type ConfigSource ¶
ConfigSource describes a type that is able to provide config. Abstracted primarily for testing.
type CredentialService ¶
type CredentialService interface { // CloudCredential returns the cloud credential for the given key. CloudCredential(ctx context.Context, id credential.Key) (jujucloud.Credential, error) // InvalidateCredential marks the cloud credential for the given name, cloud, owner as invalid. InvalidateCredential(ctx context.Context, id credential.Key, reason string) error }
CredentialService exposes State methods needed by credential manager.
type DomainServicesGetter ¶
type DomainServicesGetter interface {
DomainServicesForModel(context.Context, coremodel.UUID) (ModelDomainServices, error)
}
DomainServicesGetter is a factory for creating model services.
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(ctx context.Context) (version.Number, error) }
ModelAgentService provides access to the Juju agent version for the model.
type ModelConfigService ¶
type ModelConfigService interface { // ModelConfig returns the currently set config on this model. ModelConfig(context.Context) (*config.Config, error) // SetModelConfig sets the models config. SetModelConfig(context.Context, map[string]any) error }
ModelConfigService describes the set of functions needed for working with a model's config.
type ModelConfigServiceGetter ¶
type ModelConfigServiceGetter func(coremodel.UUID) (ModelConfigService, error)
ModelConfigServiceGetter provides a means to fetch the model config service for a given model uuid.
type ModelDefaultsService ¶
type ModelDefaultsService interface { // ModelDefaultsProvider provides a [ModelDefaultsProviderFunc] scoped to the // supplied model. This can be used in the construction of // [github.com/juju/juju/domain/modelconfig/service.Service]. If no model exists // for the specified UUID then the [ModelDefaultsProviderFunc] will return a // error that satisfies // [github.com/juju/juju/domain/model/errors.NotFound]. ModelDefaultsProvider( uuid coremodel.UUID, ) modeldefaultsservice.ModelDefaultsProviderFunc // CloudDefaults returns the default attribute details for a specified cloud. // It returns an error satisfying [clouderrors.NotFound] if the cloud doesn't exist. CloudDefaults(ctx context.Context, cloudName string) (modeldefaults.ModelDefaultAttributes, error) // UpdateCloudDefaults saves the specified default attribute details for a cloud. // It returns an error satisfying [clouderrors.NotFound] if the cloud doesn't exist. UpdateCloudDefaults(ctx context.Context, cloudName string, updateAttrs map[string]any) error // UpdateCloudRegionDefaults saves the specified default attribute details for a cloud region. // It returns an error satisfying [clouderrors.NotFound] if the cloud doesn't exist. UpdateCloudRegionDefaults(ctx context.Context, cloudName, regionName string, updateAttrs map[string]any) error // RemoveCloudDefaults deletes the specified default attribute details for a cloud. // It returns an error satisfying [clouderrors.NotFound] if the cloud doesn't exist. RemoveCloudDefaults(ctx context.Context, cloudName string, removeAttrs []string) error // RemoveCloudRegionDefaults deletes the specified default attributes for a // cloud region. It returns an error satisfying [clouderrors.NotFound] if // the cloud doesn't exist. RemoveCloudRegionDefaults(ctx context.Context, cloudName, regionName string, removeAttrs []string) error }
ModelDefaultsService defines a interface for interacting with the model defaults.
type ModelDomainServices ¶
type ModelDomainServices interface { // Agent returns the model's agent service. Agent() ModelAgentService // Config returns the model config service. Config() ModelConfigService // ModelInfo returns the model service for the model. // Note: This should be called model, but we have naming conflicts with // the model service. As this is only for model information, we // can rename it to the more obscure version. ModelInfo() ModelInfoService // Network returns the space service. Network() NetworkService BlockCommand() BlockCommandService // Machine returns the machine service. Machine() MachineService }
ModelDomainServices is a factory for creating model info services.
type ModelExporter ¶
type ModelExporter interface { // ExportModelPartial exports the current model into a partial description // model. This can be serialized into yaml and then imported. ExportModelPartial(context.Context, state.ExportConfig, objectstore.ObjectStore) (description.Model, error) }
ModelExporter defines a interface for exporting models.
type ModelInfoService ¶
type ModelInfoService interface { // CreateModel is responsible for adding the details of the model // that is being created. CreateModel(context.Context, uuid.UUID) error // DeleteModel is responsible for deleting a model. DeleteModel(context.Context) error // GetModelInfo returns the readonly model information for the model in // question. GetModelInfo(context.Context) (coremodel.ModelInfo, error) // GetStatus returns the current status of the model. // The following error types can be expected to be returned: // - [github.com/juju/juju/domain/model/errors.NotFound]: When the model // does not exist. GetStatus(context.Context) (model.StatusInfo, error) }
ModelInfoService defines a interface for interacting with the underlying state.
type ModelManagerAPI ¶
type ModelManagerAPI struct { *commonmodel.ModelStatusAPI // contains filtered or unexported fields }
ModelManagerAPI implements the model manager interface and is the concrete implementation of the api end point.
func NewModelManagerAPI ¶
func NewModelManagerAPI( ctx context.Context, st StateBackend, modelExporter func(context.Context, coremodel.UUID, facade.LegacyStateExporter) (ModelExporter, error), ctlrSt commonmodel.ModelManagerBackend, controllerUUID uuid.UUID, services Services, toolsFinder common.ToolsFinder, getBroker newCaasBrokerFunc, blockChecker common.BlockCheckerInterface, authorizer facade.Authorizer, m commonmodel.Model, ) (*ModelManagerAPI, error)
NewModelManagerAPI creates a new api server endpoint for managing models.
func (*ModelManagerAPI) ChangeModelCredential ¶
func (m *ModelManagerAPI) ChangeModelCredential(ctx context.Context, args params.ChangeModelCredentialsParams) (params.ErrorResults, error)
ChangeModelCredential changes cloud credential reference for models. These new cloud credentials must already exist on the controller.
func (*ModelManagerAPI) CreateModel ¶
func (m *ModelManagerAPI) CreateModel(ctx context.Context, args params.ModelCreateArgs) (params.ModelInfo, error)
CreateModel creates a new model using the account and model config specified in the args.
func (*ModelManagerAPI) DestroyModels ¶
func (m *ModelManagerAPI) DestroyModels(ctx context.Context, args params.DestroyModelsParams) (params.ErrorResults, error)
DestroyModels will try to destroy the specified models. If there is a block on destruction, this method will return an error. From ModelManager v7 onwards, DestroyModels gains 'force' and 'max-wait' parameters.
func (*ModelManagerAPI) DumpModels ¶
func (m *ModelManagerAPI) DumpModels(ctx context.Context, args params.DumpModelRequest) params.StringResults
DumpModels will export the models into the database agnostic representation. The user needs to either be a controller admin, or have admin privileges on the model itself.
func (*ModelManagerAPI) DumpModelsDB ¶
func (m *ModelManagerAPI) DumpModelsDB(ctx context.Context, args params.Entities) params.MapResults
DumpModelsDB will gather all documents from all model collections for the specified model. The map result contains a map of collection names to lists of documents represented as maps.
func (*ModelManagerAPI) ListModelSummaries ¶
func (m *ModelManagerAPI) ListModelSummaries(ctx context.Context, req params.ModelSummariesRequest) (params.ModelSummaryResults, error)
ListModelSummaries returns models that the specified user has access to in the current server. Controller admins (superuser) can list models for any user. Other users can only ask about their own models.
func (*ModelManagerAPI) ListModels ¶
func (m *ModelManagerAPI) ListModels(ctx context.Context, userEntity params.Entity) (params.UserModelList, error)
ListModels returns the models that the specified user has access to in the current server. Controller admins (superuser) can list models for any user. Other users can only ask about their own models.
func (*ModelManagerAPI) ModelDefaultsForClouds ¶
func (m *ModelManagerAPI) ModelDefaultsForClouds(ctx context.Context, args params.Entities) (params.ModelDefaultsResults, error)
ModelDefaultsForClouds returns the default config values for the specified clouds.
func (*ModelManagerAPI) ModelInfo ¶
func (m *ModelManagerAPI) ModelInfo(ctx context.Context, args params.Entities) (params.ModelInfoResults, error)
ModelInfo returns information about the specified models.
func (*ModelManagerAPI) ModifyModelAccess ¶
func (m *ModelManagerAPI) ModifyModelAccess(ctx context.Context, args params.ModifyModelAccessRequest) (result params.ErrorResults, _ error)
ModifyModelAccess changes the model access granted to users.
func (*ModelManagerAPI) SetModelDefaults ¶
func (m *ModelManagerAPI) SetModelDefaults(ctx context.Context, args params.SetModelDefaults) (params.ErrorResults, error)
SetModelDefaults writes new values for the specified default model settings.
func (*ModelManagerAPI) UnsetModelDefaults ¶
func (m *ModelManagerAPI) UnsetModelDefaults(ctx context.Context, args params.UnsetModelDefaults) (params.ErrorResults, error)
UnsetModelDefaults removes the specified default model settings.
type ModelService ¶
type ModelService interface { // CreateModel creates a model returning the resultant model's new ID. CreateModel(context.Context, model.GlobalModelCreationArgs) (coremodel.UUID, func(context.Context) error, error) // DefaultModelCloudNameAndCredential returns the default cloud name and // credential that should be used for newly created models that haven't had // either cloud or credential specified. DefaultModelCloudNameAndCredential(context.Context) (string, credential.Key, error) // DeleteModel deletes the give model. DeleteModel(context.Context, coremodel.UUID, ...model.DeleteModelOption) error // ListModelsForUser returns a list of models for the given user. ListModelsForUser(context.Context, coreuser.UUID) ([]coremodel.Model, error) // ListAllModels returns a list of all models. ListAllModels(context.Context) ([]coremodel.Model, error) // GetModelUsers will retrieve basic information about users with // permissions on the given model UUID. // If the model cannot be found it will return // [github.com/juju/juju/domain/model/errors.NotFound]. GetModelUsers(ctx context.Context, modelUUID coremodel.UUID) ([]coremodel.ModelUserInfo, error) // GetModelUser will retrieve basic information about the specified model // user. // If the model cannot be found it will return // [github.com/juju/juju/domain/model/errors.NotFound]. // If the user cannot be found it will return //[github.com/juju/juju/domain/model/errors.UserNotFoundOnModel]. GetModelUser(ctx context.Context, modelUUID coremodel.UUID, name coreuser.Name) (coremodel.ModelUserInfo, error) // ListModelSummariesForUser returns a slice of model summaries for a given // user. If no models are found an empty slice is returned. ListModelSummariesForUser(ctx context.Context, userName coreuser.Name) ([]coremodel.UserModelSummary, error) // ListAllModelSummaries returns a slice of model summaries for all models // known to the controller. ListAllModelSummaries(ctx context.Context) ([]coremodel.ModelSummary, error) }
ModelService defines an interface for interacting with the model service.
type NetworkService ¶
type NetworkService interface { // ReloadSpaces reloads the spaces. ReloadSpaces(ctx context.Context) error }
NetworkService is the interface that is used to interact with the network spaces/subnets.
type SecretBackendService ¶
type SecretBackendService interface { // BackendSummaryInfoForModel returns a summary of the secret backends for a model. BackendSummaryInfoForModel(ctx context.Context, modelUUID coremodel.UUID) ([]*secretbackendservice.SecretBackendInfo, error) }
SecretBackendService is an interface for interacting with secret backend service.
type Services ¶
type Services struct { // DomainServicesGetter is an interface for interacting with a factory for // creating model services. DomainServicesGetter DomainServicesGetter // CloudServices is an interface for interacting with the cloud service. CloudService CloudService // CredentialService is an interface for interacting with the credential // service. CredentialService CredentialService // ModelService is an interface for interacting with the model service. ModelService ModelService // ModelDefaultsService is an interface for interacting with the model // defaults service. ModelDefaultsService ModelDefaultsService // AccessService is an interface for interacting with the access service // covering user and permission. AccessService AccessService // ObjectStore is an interface for interacting with a full object store. ObjectStore objectstore.ObjectStore // SecretBackendService is an interface for interacting with secret backend // service. SecretBackendService SecretBackendService // NetworkService is an interface for interacting with the network service. NetworkService NetworkService // MachineService is an interface for interacting with the machine service. MachineService MachineService // ApplicationService is an interface for interacting with the application // service. ApplicationService ApplicationService }
Services holds the services needed by the model manager api.
type StateBackend ¶
type StateBackend interface { commonmodel.ModelManagerBackend InvalidateModelCredential(string) error }
StateBackend represents the mongo backend.