forked from cloudfoundry/bosh-bootloader
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gcp_client.go
57 lines (51 loc) · 1.37 KB
/
gcp_client.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
package fakes
import compute "google.golang.org/api/compute/v1"
type GCPClient struct {
ProjectIDCall struct {
CallCount int
Returns struct {
ProjectID string
}
}
GetProjectCall struct {
CallCount int
Returns struct {
Project *compute.Project
Error error
}
}
SetCommonInstanceMetadataCall struct {
CallCount int
Receives struct {
Metadata *compute.Metadata
}
Returns struct {
Operation *compute.Operation
Error error
}
}
ListInstancesCall struct {
CallCount int
Returns struct {
InstanceList *compute.InstanceList
Error error
}
}
}
func (g *GCPClient) ProjectID() string {
g.ProjectIDCall.CallCount++
return g.ProjectIDCall.Returns.ProjectID
}
func (g *GCPClient) GetProject() (*compute.Project, error) {
g.GetProjectCall.CallCount++
return g.GetProjectCall.Returns.Project, g.GetProjectCall.Returns.Error
}
func (g *GCPClient) SetCommonInstanceMetadata(metadata *compute.Metadata) (*compute.Operation, error) {
g.SetCommonInstanceMetadataCall.CallCount++
g.SetCommonInstanceMetadataCall.Receives.Metadata = metadata
return g.SetCommonInstanceMetadataCall.Returns.Operation, g.SetCommonInstanceMetadataCall.Returns.Error
}
func (g *GCPClient) ListInstances() (*compute.InstanceList, error) {
g.ListInstancesCall.CallCount++
return g.ListInstancesCall.Returns.InstanceList, g.ListInstancesCall.Returns.Error
}