modelmanager

package
v0.0.0-...-2f78cd6 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModelConfigCreator

type ModelConfigCreator struct {
	// Provider will be used to obtain EnvironProviders for preparing
	// and validating configuration.
	Provider func(string) (environs.EnvironProvider, error)

	// 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(
	cloud environscloudspec.CloudSpec,
	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