Documentation ¶
Overview ¶
Package modelmanager defines an API end point 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 assocated.
Index ¶
- func ChangeModelAccess(accessor Backend, modelTag names.ModelTag, ...) error
- func FromModelAccessParam(paramAccess params.ModelAccessPermission) (permission.ModelAccess, error)
- type Backend
- type ConfigSource
- type Model
- type ModelManager
- type ModelManagerAPI
- func (mm *ModelManagerAPI) ConfigSkeleton(args params.ModelSkeletonConfigArgs) (params.ModelConfigResult, error)
- func (mm *ModelManagerAPI) CreateModel(args params.ModelCreateArgs) (params.Model, error)
- func (mm *ModelManagerAPI) ListModels(user params.Entity) (params.UserModelList, error)
- func (m *ModelManagerAPI) ModelInfo(args params.Entities) (params.ModelInfoResults, error)
- func (m *ModelManagerAPI) ModifyModelAccess(args params.ModifyModelAccessRequest) (result params.ErrorResults, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangeModelAccess ¶
func ChangeModelAccess(accessor Backend, modelTag names.ModelTag, apiUser, targetUserTag names.UserTag, action params.ModelAction, access permission.ModelAccess, userIsAdmin bool) error
ChangeModelAccess performs the requested access grant or revoke action for the specified user on the specified model.
func FromModelAccessParam ¶
func FromModelAccessParam(paramAccess params.ModelAccessPermission) (permission.ModelAccess, error)
FromModelAccessParam returns the logical model access type from the API wireformat type.
Types ¶
type Backend ¶
type Backend interface { common.APIHostPortsGetter common.ModelConfigGetter common.ToolsStorageGetter ModelUUID() string ModelsForUser(names.UserTag) ([]*state.UserModel, error) IsControllerAdministrator(user names.UserTag) (bool, error) NewModel(state.ModelArgs) (*state.Model, *state.State, error) ControllerModel() (*state.Model, error) ForModel(tag names.ModelTag) (Backend, error) Model() (Model, error) AddModelUser(state.ModelUserSpec) (*state.ModelUser, error) RemoveModelUser(names.UserTag) error ModelUser(names.UserTag) (*state.ModelUser, error) Close() error }
func NewStateBackend ¶
type ConfigSource ¶
ConfigSource describes a type that is able to provide config. Abstracted primarily for testing.
type ModelManager ¶
type ModelManager interface { ConfigSkeleton(args params.ModelSkeletonConfigArgs) (params.ModelConfigResult, error) CreateModel(args params.ModelCreateArgs) (params.Model, error) ListModels(user params.Entity) (params.UserModelList, error) }
ModelManager defines the methods on the modelmanager API endpoint.
type ModelManagerAPI ¶
type ModelManagerAPI struct {
// 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(st Backend, authorizer common.Authorizer) (*ModelManagerAPI, error)
NewModelManagerAPI creates a new api server endpoint for managing models.
func (*ModelManagerAPI) ConfigSkeleton ¶
func (mm *ModelManagerAPI) ConfigSkeleton(args params.ModelSkeletonConfigArgs) (params.ModelConfigResult, error)
ConfigSkeleton returns config values to be used as a starting point for the API caller to construct a valid model specific config. The provider and region params are there for future use, and current behaviour expects both of these to be empty.
func (*ModelManagerAPI) CreateModel ¶
func (mm *ModelManagerAPI) CreateModel(args params.ModelCreateArgs) (params.Model, error)
CreateModel creates a new model using the account and model config specified in the args.
func (*ModelManagerAPI) ListModels ¶
func (mm *ModelManagerAPI) ListModels(user params.Entity) (params.UserModelList, error)
ListModels returns the models that the specified user has access to in the current server. Only that controller owner can list models for any user (at this stage). Other users can only ask about their own models.
func (*ModelManagerAPI) ModelInfo ¶
func (m *ModelManagerAPI) ModelInfo(args params.Entities) (params.ModelInfoResults, error)
ModelInfo returns information about the specified models.
func (*ModelManagerAPI) ModifyModelAccess ¶
func (m *ModelManagerAPI) ModifyModelAccess(args params.ModifyModelAccessRequest) (result params.ErrorResults, err error)
ModifyModelAccess changes the model access granted to users.