modelmanager

package
v0.0.0-...-2608902 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2016 License: AGPL-3.0 Imports: 14 Imported by: 0

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

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

func NewStateBackend(st *state.State) Backend

type ConfigSource

type ConfigSource interface {
	Config() (*config.Config, error)
}

ConfigSource describes a type that is able to provide config. Abstracted primarily for testing.

type Model

type Model interface {
	Config() (*config.Config, error)
	Life() state.Life
	Owner() names.UserTag
	Status() (status.StatusInfo, error)
	Users() ([]common.ModelUser, error)
}

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

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL