forked from cloudfoundry/bosh-bootloader
-
Notifications
You must be signed in to change notification settings - Fork 2
/
terraform_manager.go
101 lines (89 loc) · 2.19 KB
/
terraform_manager.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package fakes
import (
"github.com/cloudfoundry/bosh-bootloader/storage"
)
type TerraformManager struct {
ApplyCall struct {
CallCount int
Receives struct {
BBLState storage.State
}
Returns struct {
BBLState storage.State
Error error
}
}
DestroyCall struct {
CallCount int
Receives struct {
BBLState storage.State
}
Returns struct {
BBLState storage.State
Error error
}
}
ImportCall struct {
CallCount int
Receives struct {
BBLState storage.State
Outputs map[string]string
}
Returns struct {
BBLState storage.State
Error error
}
}
GetOutputsCall struct {
CallCount int
Receives struct {
BBLState storage.State
}
Returns struct {
Outputs map[string]interface{}
Error error
}
}
VersionCall struct {
CallCount int
Returns struct {
Version string
Error error
}
}
ValidateVersionCall struct {
CallCount int
Returns struct {
Error error
}
}
}
func (t *TerraformManager) Apply(bblState storage.State) (storage.State, error) {
t.ApplyCall.CallCount++
t.ApplyCall.Receives.BBLState = bblState
return t.ApplyCall.Returns.BBLState, t.ApplyCall.Returns.Error
}
func (t *TerraformManager) Destroy(bblState storage.State) (storage.State, error) {
t.DestroyCall.CallCount++
t.DestroyCall.Receives.BBLState = bblState
return t.DestroyCall.Returns.BBLState, t.DestroyCall.Returns.Error
}
func (t *TerraformManager) Import(bblState storage.State, outputs map[string]string) (storage.State, error) {
t.ImportCall.CallCount++
t.ImportCall.Receives.BBLState = bblState
t.ImportCall.Receives.Outputs = outputs
return t.ImportCall.Returns.BBLState, t.ImportCall.Returns.Error
}
func (t *TerraformManager) GetOutputs(bblState storage.State) (map[string]interface{}, error) {
t.GetOutputsCall.CallCount++
t.GetOutputsCall.Receives.BBLState = bblState
return t.GetOutputsCall.Returns.Outputs, t.GetOutputsCall.Returns.Error
}
func (t *TerraformManager) Version() (string, error) {
t.VersionCall.CallCount++
return t.VersionCall.Returns.Version, t.VersionCall.Returns.Error
}
func (t *TerraformManager) ValidateVersion() error {
t.ValidateVersionCall.CallCount++
return t.ValidateVersionCall.Returns.Error
}