2022-07-05 08:39:17 -04:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-07-29 09:00:15 -04:00
|
|
|
compute "cloud.google.com/go/compute/apiv1"
|
2022-07-05 08:39:17 -04:00
|
|
|
"github.com/googleapis/gax-go/v2"
|
|
|
|
computepb "google.golang.org/genproto/googleapis/cloud/compute/v1"
|
|
|
|
)
|
|
|
|
|
2022-08-05 06:15:06 -04:00
|
|
|
type projectAPI interface {
|
|
|
|
Close() error
|
|
|
|
Get(ctx context.Context, req *computepb.GetProjectRequest,
|
|
|
|
opts ...gax.CallOption) (*computepb.Project, error)
|
|
|
|
}
|
|
|
|
|
2022-07-05 08:39:17 -04:00
|
|
|
type instanceAPI interface {
|
|
|
|
Close() error
|
|
|
|
Get(ctx context.Context, req *computepb.GetInstanceRequest,
|
|
|
|
opts ...gax.CallOption) (*computepb.Instance, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type instanceTemplateAPI interface {
|
|
|
|
Close() error
|
|
|
|
Get(ctx context.Context, req *computepb.GetInstanceTemplateRequest,
|
|
|
|
opts ...gax.CallOption) (*computepb.InstanceTemplate, error)
|
|
|
|
Delete(ctx context.Context, req *computepb.DeleteInstanceTemplateRequest,
|
|
|
|
opts ...gax.CallOption) (Operation, error)
|
|
|
|
Insert(ctx context.Context, req *computepb.InsertInstanceTemplateRequest,
|
|
|
|
opts ...gax.CallOption) (Operation, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type instanceGroupManagersAPI interface {
|
|
|
|
Close() error
|
|
|
|
Get(ctx context.Context, req *computepb.GetInstanceGroupManagerRequest,
|
|
|
|
opts ...gax.CallOption) (*computepb.InstanceGroupManager, error)
|
2022-07-29 09:00:15 -04:00
|
|
|
AggregatedList(ctx context.Context, req *computepb.AggregatedListInstanceGroupManagersRequest,
|
|
|
|
opts ...gax.CallOption) InstanceGroupManagerScopedListIterator
|
2022-07-05 08:39:17 -04:00
|
|
|
SetInstanceTemplate(ctx context.Context, req *computepb.SetInstanceTemplateInstanceGroupManagerRequest,
|
|
|
|
opts ...gax.CallOption) (Operation, error)
|
|
|
|
CreateInstances(ctx context.Context, req *computepb.CreateInstancesInstanceGroupManagerRequest,
|
|
|
|
opts ...gax.CallOption) (Operation, error)
|
|
|
|
DeleteInstances(ctx context.Context, req *computepb.DeleteInstancesInstanceGroupManagerRequest,
|
|
|
|
opts ...gax.CallOption) (Operation, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type diskAPI interface {
|
|
|
|
Close() error
|
|
|
|
Get(ctx context.Context, req *computepb.GetDiskRequest,
|
|
|
|
opts ...gax.CallOption) (*computepb.Disk, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type Operation interface {
|
|
|
|
Proto() *computepb.Operation
|
|
|
|
Done() bool
|
|
|
|
Wait(ctx context.Context, opts ...gax.CallOption) error
|
|
|
|
}
|
|
|
|
|
2022-07-29 09:00:15 -04:00
|
|
|
type InstanceGroupManagerScopedListIterator interface {
|
|
|
|
Next() (compute.InstanceGroupManagersScopedListPair, error)
|
|
|
|
}
|
|
|
|
|
2022-07-05 08:39:17 -04:00
|
|
|
type prng interface {
|
|
|
|
// Intn returns, as an int, a non-negative pseudo-random number in the half-open interval [0,n). It panics if n <= 0.
|
|
|
|
Intn(n int) int
|
|
|
|
}
|