2022-09-05 09:06:08 +02:00
|
|
|
/*
|
|
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2022-03-22 16:03:15 +01:00
|
|
|
package gcp
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
compute "cloud.google.com/go/compute/apiv1"
|
2022-12-08 11:26:51 +01:00
|
|
|
"cloud.google.com/go/compute/apiv1/computepb"
|
2022-03-22 16:03:15 +01:00
|
|
|
"github.com/googleapis/gax-go/v2"
|
|
|
|
)
|
|
|
|
|
2022-11-09 14:43:48 +01:00
|
|
|
type forwardingRuleIterator interface {
|
|
|
|
Next() (*computepb.ForwardingRule, error)
|
2022-03-22 16:03:15 +01:00
|
|
|
}
|
|
|
|
|
2022-11-09 14:43:48 +01:00
|
|
|
type instanceIterator interface {
|
|
|
|
Next() (*computepb.Instance, error)
|
2022-05-24 10:04:42 +02:00
|
|
|
}
|
|
|
|
|
2023-06-20 12:02:31 +02:00
|
|
|
type zoneIterator interface {
|
|
|
|
Next() (*computepb.Zone, error)
|
|
|
|
}
|
|
|
|
|
2022-12-28 13:30:39 +01:00
|
|
|
type globalForwardingRulesClient struct {
|
2022-09-01 03:40:29 +02:00
|
|
|
*compute.GlobalForwardingRulesClient
|
2022-06-09 22:26:36 +02:00
|
|
|
}
|
|
|
|
|
2022-12-28 13:30:39 +01:00
|
|
|
func (c *globalForwardingRulesClient) Close() error {
|
2022-09-01 03:40:29 +02:00
|
|
|
return c.GlobalForwardingRulesClient.Close()
|
2022-06-09 22:26:36 +02:00
|
|
|
}
|
|
|
|
|
2022-12-28 13:30:39 +01:00
|
|
|
func (c *globalForwardingRulesClient) List(ctx context.Context, req *computepb.ListGlobalForwardingRulesRequest,
|
2023-03-20 11:03:36 +01:00
|
|
|
_ ...gax.CallOption,
|
2022-11-09 14:43:48 +01:00
|
|
|
) forwardingRuleIterator {
|
2022-09-01 03:40:29 +02:00
|
|
|
return c.GlobalForwardingRulesClient.List(ctx, req)
|
2022-06-09 22:26:36 +02:00
|
|
|
}
|
|
|
|
|
2022-12-28 13:30:39 +01:00
|
|
|
type regionalForwardingRulesClient struct {
|
|
|
|
*compute.ForwardingRulesClient
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *regionalForwardingRulesClient) Close() error {
|
|
|
|
return c.ForwardingRulesClient.Close()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *regionalForwardingRulesClient) List(ctx context.Context, req *computepb.ListForwardingRulesRequest,
|
2023-03-20 11:03:36 +01:00
|
|
|
_ ...gax.CallOption,
|
2022-12-28 13:30:39 +01:00
|
|
|
) forwardingRuleIterator {
|
|
|
|
return c.ForwardingRulesClient.List(ctx, req)
|
|
|
|
}
|
|
|
|
|
2022-11-09 14:43:48 +01:00
|
|
|
type instanceClient struct {
|
|
|
|
*compute.InstancesClient
|
2022-03-22 16:03:15 +01:00
|
|
|
}
|
|
|
|
|
2022-11-09 14:43:48 +01:00
|
|
|
func (c *instanceClient) Close() error {
|
|
|
|
return c.InstancesClient.Close()
|
2022-03-22 16:03:15 +01:00
|
|
|
}
|
|
|
|
|
2022-11-09 14:43:48 +01:00
|
|
|
func (c *instanceClient) List(ctx context.Context, req *computepb.ListInstancesRequest,
|
2023-03-20 11:03:36 +01:00
|
|
|
_ ...gax.CallOption,
|
2022-11-09 14:43:48 +01:00
|
|
|
) instanceIterator {
|
|
|
|
return c.InstancesClient.List(ctx, req)
|
2022-03-22 16:03:15 +01:00
|
|
|
}
|
2023-06-20 12:02:31 +02:00
|
|
|
|
|
|
|
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...)
|
|
|
|
}
|