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: 8 Imported by: 0

Documentation

Overview

Package modelmanager provides the business logic for model management operations in the controller.

Index

Constants

View Source
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

func RestrictedProviderFields(providerType string) ([]string, error)

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.

Jump to

Keyboard shortcuts

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