github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/apiserver/machinemanager/state.go (about) 1 // Copyright 2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package machinemanager 5 6 import ( 7 "github.com/juju/juju/environs/config" 8 "github.com/juju/juju/instance" 9 "github.com/juju/juju/state" 10 names "gopkg.in/juju/names.v2" 11 ) 12 13 type stateInterface interface { 14 ModelConfig() (*config.Config, error) 15 Model() (*state.Model, error) 16 ModelTag() names.ModelTag 17 GetBlockForType(t state.BlockType) (state.Block, bool, error) 18 AddOneMachine(template state.MachineTemplate) (*state.Machine, error) 19 AddMachineInsideNewMachine(template, parentTemplate state.MachineTemplate, containerType instance.ContainerType) (*state.Machine, error) 20 AddMachineInsideMachine(template state.MachineTemplate, parentId string, containerType instance.ContainerType) (*state.Machine, error) 21 } 22 23 type stateShim struct { 24 *state.State 25 } 26 27 func (s stateShim) ModelConfig() (*config.Config, error) { 28 return s.State.ModelConfig() 29 } 30 31 func (s stateShim) Model() (*state.Model, error) { 32 return s.State.Model() 33 } 34 func (s stateShim) ModelTag() names.ModelTag { 35 return s.State.ModelTag() 36 } 37 38 func (s stateShim) GetBlockForType(t state.BlockType) (state.Block, bool, error) { 39 return s.State.GetBlockForType(t) 40 } 41 42 func (s stateShim) AddOneMachine(template state.MachineTemplate) (*state.Machine, error) { 43 return s.State.AddOneMachine(template) 44 } 45 46 func (s stateShim) AddMachineInsideNewMachine(template, parentTemplate state.MachineTemplate, containerType instance.ContainerType) (*state.Machine, error) { 47 return s.State.AddMachineInsideNewMachine(template, parentTemplate, containerType) 48 } 49 50 func (s stateShim) AddMachineInsideMachine(template state.MachineTemplate, parentId string, containerType instance.ContainerType) (*state.Machine, error) { 51 return s.State.AddMachineInsideMachine(template, parentId, containerType) 52 }