-
Notifications
You must be signed in to change notification settings - Fork 46
/
wrappers.go
81 lines (62 loc) · 1.82 KB
/
wrappers.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
/*
Copyright (c) Edgeless Systems GmbH
SPDX-License-Identifier: AGPL-3.0-only
*/
package gcp
import (
"context"
compute "cloud.google.com/go/compute/apiv1"
"cloud.google.com/go/compute/apiv1/computepb"
"github.com/googleapis/gax-go/v2"
)
type forwardingRuleIterator interface {
Next() (*computepb.ForwardingRule, error)
}
type instanceIterator interface {
Next() (*computepb.Instance, error)
}
type zoneIterator interface {
Next() (*computepb.Zone, error)
}
type globalForwardingRulesClient struct {
*compute.GlobalForwardingRulesClient
}
func (c *globalForwardingRulesClient) Close() error {
return c.GlobalForwardingRulesClient.Close()
}
func (c *globalForwardingRulesClient) List(ctx context.Context, req *computepb.ListGlobalForwardingRulesRequest,
_ ...gax.CallOption,
) forwardingRuleIterator {
return c.GlobalForwardingRulesClient.List(ctx, req)
}
type regionalForwardingRulesClient struct {
*compute.ForwardingRulesClient
}
func (c *regionalForwardingRulesClient) Close() error {
return c.ForwardingRulesClient.Close()
}
func (c *regionalForwardingRulesClient) List(ctx context.Context, req *computepb.ListForwardingRulesRequest,
_ ...gax.CallOption,
) forwardingRuleIterator {
return c.ForwardingRulesClient.List(ctx, req)
}
type instanceClient struct {
*compute.InstancesClient
}
func (c *instanceClient) Close() error {
return c.InstancesClient.Close()
}
func (c *instanceClient) List(ctx context.Context, req *computepb.ListInstancesRequest,
_ ...gax.CallOption,
) instanceIterator {
return c.InstancesClient.List(ctx, req)
}
type zoneClient struct {
*compute.ZonesClient
}
func (c *zoneClient) Close() error {
return c.ZonesClient.Close()
}
func (c *zoneClient) List(ctx context.Context, req *computepb.ListZonesRequest, opts ...gax.CallOption) zoneIterator {
return c.ZonesClient.List(ctx, req, opts...)
}