github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/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 ) 11 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) 19 } 20 21 type stateShim struct { 22 *state.State 23 } 24 25 func (s stateShim) ModelConfig() (*config.Config, error) { 26 return s.State.ModelConfig() 27 } 28 29 func (s stateShim) Model() (*state.Model, error) { 30 return s.State.Model() 31 } 32 33 func (s stateShim) GetBlockForType(t state.BlockType) (state.Block, bool, error) { 34 return s.State.GetBlockForType(t) 35 } 36 37 func (s stateShim) AddOneMachine(template state.MachineTemplate) (*state.Machine, error) { 38 return s.State.AddOneMachine(template) 39 } 40 41 func (s stateShim) AddMachineInsideNewMachine(template, parentTemplate state.MachineTemplate, containerType instance.ContainerType) (*state.Machine, error) { 42 return s.State.AddMachineInsideNewMachine(template, parentTemplate, containerType) 43 } 44 45 func (s stateShim) AddMachineInsideMachine(template state.MachineTemplate, parentId string, containerType instance.ContainerType) (*state.Machine, error) { 46 return s.State.AddMachineInsideMachine(template, parentId, containerType) 47 }