client

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WaitOp = (*compute.Operation).Wait
	NextIt = (*compute.InstanceIterator).Next
)

Functions

This section is empty.

Types

type ClientInterface

type ClientInterface interface {
	Insert(ctx context.Context, req *computepb.InsertInstanceRequest, opts ...gax.CallOption) (*compute.Operation, error)
	Start(ctx context.Context, req *computepb.StartInstanceRequest, opts ...gax.CallOption) (*compute.Operation, error)
	Stop(ctx context.Context, req *computepb.StopInstanceRequest, opts ...gax.CallOption) (*compute.Operation, error)
	Delete(ctx context.Context, req *computepb.DeleteInstanceRequest, opts ...gax.CallOption) (*compute.Operation, error)
	List(ctx context.Context, req *computepb.ListInstancesRequest, opts ...gax.CallOption) *compute.InstanceIterator
	Get(ctx context.Context, req *computepb.GetInstanceRequest, opts ...gax.CallOption) (*computepb.Instance, error)
}

type GcpCli

type GcpCli struct {
	// contains filtered or unexported fields
}

func NewGcpCli

func NewGcpCli(ctx context.Context, cfg *config.Config) (*GcpCli, error)

func (GcpCli) Client

func (g GcpCli) Client() ClientInterface

func (GcpCli) Config

func (g GcpCli) Config() *config.Config

func (*GcpCli) CreateInstance

func (g *GcpCli) CreateInstance(ctx context.Context, spec *spec.RunnerSpec) (*computepb.Instance, error)

func (*GcpCli) DeleteInstance

func (g *GcpCli) DeleteInstance(ctx context.Context, instance string) error

func (*GcpCli) GetInstance

func (g *GcpCli) GetInstance(ctx context.Context, instanceName string) (*computepb.Instance, error)

func (*GcpCli) ListDescribedInstances

func (g *GcpCli) ListDescribedInstances(ctx context.Context, poolID string) ([]*computepb.Instance, error)

func (*GcpCli) SetClient

func (g *GcpCli) SetClient(client ClientInterface)

func (*GcpCli) SetConfig

func (g *GcpCli) SetConfig(cfg *config.Config)

func (*GcpCli) StartInstance

func (g *GcpCli) StartInstance(ctx context.Context, instance string) error

func (*GcpCli) StopInstance

func (g *GcpCli) StopInstance(ctx context.Context, instance string) error

type MockGcpClient

type MockGcpClient struct {
	mock.Mock
}

MockGcpClient is a mock of the ClientInterface

func (*MockGcpClient) Delete

func (m *MockGcpClient) Delete(ctx context.Context, req *computepb.DeleteInstanceRequest, opts ...gax.CallOption) (*compute.Operation, error)

func (*MockGcpClient) Get

func (m *MockGcpClient) Get(ctx context.Context, req *computepb.GetInstanceRequest, opts ...gax.CallOption) (*computepb.Instance, error)

func (*MockGcpClient) Insert

func (m *MockGcpClient) Insert(ctx context.Context, req *computepb.InsertInstanceRequest, opts ...gax.CallOption) (*compute.Operation, error)

func (*MockGcpClient) List

func (m *MockGcpClient) List(ctx context.Context, req *computepb.ListInstancesRequest, opts ...gax.CallOption) *compute.InstanceIterator

func (*MockGcpClient) Start

func (m *MockGcpClient) Start(ctx context.Context, req *computepb.StartInstanceRequest, opts ...gax.CallOption) (*compute.Operation, error)

func (*MockGcpClient) Stop

func (m *MockGcpClient) Stop(ctx context.Context, req *computepb.StopInstanceRequest, opts ...gax.CallOption) (*compute.Operation, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL