1
// Copyright 2015 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
7
"github.com/juju/juju/environs/config"
8
"github.com/juju/juju/instance"
9
"github.com/juju/juju/state"
12
type stateInterface interface {
13
ModelConfig() (*config.Config, error)
14
Model() (*state.Model, error)
15
GetBlockForType(t state.BlockType) (state.Block, bool, error)
16
AddOneMachine(template state.MachineTemplate) (*state.Machine, error)
17
AddMachineInsideNewMachine(template, parentTemplate state.MachineTemplate, containerType instance.ContainerType) (*state.Machine, error)
18
AddMachineInsideMachine(template state.MachineTemplate, parentId string, containerType instance.ContainerType) (*state.Machine, error)
21
type stateShim struct {
25
func (s stateShim) ModelConfig() (*config.Config, error) {
26
return s.State.ModelConfig()
29
func (s stateShim) Model() (*state.Model, error) {
30
return s.State.Model()
33
func (s stateShim) GetBlockForType(t state.BlockType) (state.Block, bool, error) {
34
return s.State.GetBlockForType(t)
37
func (s stateShim) AddOneMachine(template state.MachineTemplate) (*state.Machine, error) {
38
return s.State.AddOneMachine(template)
41
func (s stateShim) AddMachineInsideNewMachine(template, parentTemplate state.MachineTemplate, containerType instance.ContainerType) (*state.Machine, error) {
42
return s.State.AddMachineInsideNewMachine(template, parentTemplate, containerType)
45
func (s stateShim) AddMachineInsideMachine(template state.MachineTemplate, parentId string, containerType instance.ContainerType) (*state.Machine, error) {
46
return s.State.AddMachineInsideMachine(template, parentId, containerType)