This repository has been archived by the owner on Dec 10, 2018. It is now read-only.
/
fake_instance_service.go
141 lines (110 loc) · 3.72 KB
/
fake_instance_service.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
package fakes
import (
"github.com/frodenas/bosh-google-cpi/google/instance_service"
"google.golang.org/api/compute/v1"
)
type FakeInstanceService struct {
AddAccessConfigCalled bool
AddAccessConfigErr error
AddNetworkConfigurationCalled bool
AddNetworkConfigurationErr error
AttachDiskCalled bool
AttachDiskErr error
AttachDiskDeviceName string
AttachDiskDevicePath string
AttachedDisksCalled bool
AttachedDisksErr error
AttachedDisksList instance.AttachedDisks
CleanUpCalled bool
CreateCalled bool
CreateErr error
CreateID string
CreateVMProps *instance.Properties
CreateNetworks instance.Networks
CreateRegistryEndpoint string
DeleteCalled bool
DeleteErr error
DeleteAccessConfigCalled bool
DeleteAccessConfigErr error
DeleteNetworkConfigurationCalled bool
DeleteNetworkConfigurationErr error
DetachDiskCalled bool
DetachDiskErr error
FindCalled bool
FindFound bool
FindInstance *compute.Instance
FindErr error
RebootCalled bool
RebootErr error
SetMetadataCalled bool
SetMetadataErr error
SetMetadataVMMetadata instance.Metadata
SetTagsCalled bool
SetTagsErr error
UpdateNetworkConfigurationCalled bool
UpdateNetworkConfigurationErr error
}
func (i *FakeInstanceService) AddAccessConfig(id string, zone string, networkInterface string, accessConfig *compute.AccessConfig) error {
i.AddAccessConfigCalled = true
return i.AddAccessConfigErr
}
func (i *FakeInstanceService) AddNetworkConfiguration(id string, networks instance.Networks) error {
i.AddNetworkConfigurationCalled = true
return i.AddNetworkConfigurationErr
}
func (i *FakeInstanceService) AttachDisk(id string, diskLink string) (string, string, error) {
i.AttachDiskCalled = true
return i.AttachDiskDeviceName, i.AttachDiskDevicePath, i.AttachDiskErr
}
func (i *FakeInstanceService) AttachedDisks(id string) (instance.AttachedDisks, error) {
i.AttachedDisksCalled = true
return i.AttachedDisksList, i.AttachedDisksErr
}
func (i *FakeInstanceService) CleanUp(id string) {
i.CleanUpCalled = true
return
}
func (i *FakeInstanceService) Create(vmProps *instance.Properties, networks instance.Networks, registryEndpoint string) (string, error) {
i.CreateCalled = true
i.CreateVMProps = vmProps
i.CreateNetworks = networks
i.CreateRegistryEndpoint = registryEndpoint
return i.CreateID, i.CreateErr
}
func (i *FakeInstanceService) Delete(id string) error {
i.DeleteCalled = true
return i.DeleteErr
}
func (i *FakeInstanceService) DeleteAccessConfig(id string, zone string, networkInterface string, accessConfig string) error {
i.DeleteCalled = true
return i.DeleteErr
}
func (i *FakeInstanceService) DeleteNetworkConfiguration(id string) error {
i.DeleteNetworkConfigurationCalled = true
return i.DeleteNetworkConfigurationErr
}
func (i *FakeInstanceService) DetachDisk(id string, diskID string) error {
i.DetachDiskCalled = true
return i.DetachDiskErr
}
func (i *FakeInstanceService) Find(id string, zone string) (*compute.Instance, bool, error) {
i.FindCalled = true
return i.FindInstance, i.FindFound, i.FindErr
}
func (i *FakeInstanceService) Reboot(id string) error {
i.RebootCalled = true
return i.RebootErr
}
func (i *FakeInstanceService) SetMetadata(id string, vmMetadata instance.Metadata) error {
i.SetMetadataCalled = true
i.SetMetadataVMMetadata = vmMetadata
return i.SetMetadataErr
}
func (i *FakeInstanceService) SetTags(id string, zone string, instanceTags *compute.Tags) error {
i.SetTagsCalled = true
return i.SetTagsErr
}
func (i *FakeInstanceService) UpdateNetworkConfiguration(id string, networks instance.Networks) error {
i.UpdateNetworkConfigurationCalled = true
return i.UpdateNetworkConfigurationErr
}