/
state.go
47 lines (37 loc) · 1.69 KB
/
state.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package machinemanager
import (
"github.com/juju/juju/environs/config"
"github.com/juju/juju/instance"
"github.com/juju/juju/state"
)
type stateInterface interface {
EnvironConfig() (*config.Config, error)
Environment() (*state.Environment, error)
GetBlockForType(t state.BlockType) (state.Block, bool, error)
AddOneMachine(template state.MachineTemplate) (*state.Machine, error)
AddMachineInsideNewMachine(template, parentTemplate state.MachineTemplate, containerType instance.ContainerType) (*state.Machine, error)
AddMachineInsideMachine(template state.MachineTemplate, parentId string, containerType instance.ContainerType) (*state.Machine, error)
}
type stateShim struct {
*state.State
}
func (s stateShim) EnvironConfig() (*config.Config, error) {
return s.State.EnvironConfig()
}
func (s stateShim) Environment() (*state.Environment, error) {
return s.State.Environment()
}
func (s stateShim) GetBlockForType(t state.BlockType) (state.Block, bool, error) {
return s.State.GetBlockForType(t)
}
func (s stateShim) AddOneMachine(template state.MachineTemplate) (*state.Machine, error) {
return s.State.AddOneMachine(template)
}
func (s stateShim) AddMachineInsideNewMachine(template, parentTemplate state.MachineTemplate, containerType instance.ContainerType) (*state.Machine, error) {
return s.State.AddMachineInsideNewMachine(template, parentTemplate, containerType)
}
func (s stateShim) AddMachineInsideMachine(template state.MachineTemplate, parentId string, containerType instance.ContainerType) (*state.Machine, error) {
return s.State.AddMachineInsideMachine(template, parentId, containerType)
}