constellation/internal/cloud/gcp/wrappers.go

82 lines
1.8 KiB
Go
Raw Normal View History

/*
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)
2022-05-24 04:04:42 -04:00
}
type zoneIterator interface {
Next() (*computepb.Zone, error)
}
type globalForwardingRulesClient struct {
2022-08-31 21:40:29 -04:00
*compute.GlobalForwardingRulesClient
2022-06-09 16:26:36 -04:00
}
func (c *globalForwardingRulesClient) Close() error {
2022-08-31 21:40:29 -04:00
return c.GlobalForwardingRulesClient.Close()
2022-06-09 16:26:36 -04:00
}
func (c *globalForwardingRulesClient) List(ctx context.Context, req *computepb.ListGlobalForwardingRulesRequest,
_ ...gax.CallOption,
) forwardingRuleIterator {
2022-08-31 21:40:29 -04:00
return c.GlobalForwardingRulesClient.List(ctx, req)
2022-06-09 16:26:36 -04: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,
_ ...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...)
}