Documentation ¶
Overview ¶
Package modelmanager provides the business logic for model management operations in the controller.
Index ¶
Constants ¶
const ( // IsAdmin is used when generating a model config for an admin user. IsAdmin = true // IsNotAdmin is used when generating a model config for a non admin user. IsNotAdmin = false )
Variables ¶
This section is empty.
Functions ¶
func RestrictedProviderFields ¶
RestrictedProviderFields returns the set of config fields that may not be overridden.
Types ¶
type ModelConfigCreator ¶
type ModelConfigCreator struct { // FindTools, if non-nil, will be used to validate the agent-version // value in NewModelConfig if it differs from the base configuration. // // If FindTools is nil, agent-version may not be different to the // base configuration. FindTools func(version.Number) (tools.List, error) }
ModelConfigCreator provides a method of creating a new model config.
The zero value of ModelConfigCreator is usable with the limitations noted on each struct field.
func (ModelConfigCreator) NewModelConfig ¶
func (c ModelConfigCreator) NewModelConfig( isAdmin bool, base *config.Config, attrs map[string]interface{}, ) (*config.Config, error)
NewModelConfig returns a new model config given a base (controller) config and a set of attributes that will be specific to the new model, overriding any non-restricted attributes in the base configuration. The resulting config will be suitable for creating a new model in state.
If "attrs" does not include a UUID, a new, random one will be generated and added to the config.
The config will be validated with the provider before being returned.