forked from cloudfoundry/bosh-bootloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
infrastructure_manager.go
64 lines (54 loc) · 1.62 KB
/
infrastructure_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
package fakes
import "github.com/pivotal-cf-experimental/bosh-bootloader/aws/cloudformation"
type InfrastructureManager struct {
CreateCall struct {
CallCount int
Receives struct {
KeyPairName string
StackName string
CloudFormationClient cloudformation.Client
NumberOfAvailabilityZones int
}
Returns struct {
Stack cloudformation.Stack
Error error
}
}
ExistsCall struct {
Receives struct {
StackName string
Client cloudformation.Client
}
Returns struct {
Exists bool
Error error
}
}
DeleteCall struct {
Receives struct {
Client cloudformation.Client
StackName string
}
Returns struct {
Error error
}
}
}
func (m *InfrastructureManager) Create(keyPairName string, numberOfAZs int, stackName string, client cloudformation.Client) (cloudformation.Stack, error) {
m.CreateCall.CallCount++
m.CreateCall.Receives.StackName = stackName
m.CreateCall.Receives.KeyPairName = keyPairName
m.CreateCall.Receives.CloudFormationClient = client
m.CreateCall.Receives.NumberOfAvailabilityZones = numberOfAZs
return m.CreateCall.Returns.Stack, m.CreateCall.Returns.Error
}
func (m *InfrastructureManager) Exists(stackName string, client cloudformation.Client) (bool, error) {
m.ExistsCall.Receives.StackName = stackName
m.ExistsCall.Receives.Client = client
return m.ExistsCall.Returns.Exists, m.ExistsCall.Returns.Error
}
func (m *InfrastructureManager) Delete(client cloudformation.Client, stackName string) error {
m.DeleteCall.Receives.Client = client
m.DeleteCall.Receives.StackName = stackName
return m.DeleteCall.Returns.Error
}