clients

package
v0.0.0-...-f4b31ea Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Package clients defines the PRPC clients.

Index

Constants

View Source
const (
	// Default flag values.
	UfsDev      string = "staging.ufs.api.cr.dev"
	UfsProd     string = "ufs.api.cr.dev"
	GcepDev     string = "gce-provider-dev.appspot.com"
	GcepProd    string = "gce-provider.appspot.com"
	ConfigID    string = "cloudbots-dev"
	SwarmingDev string = "chromium-swarm-dev.appspot.com"
)

Variables

View Source
var MockConfigClientKey contextKey = "used in tests only for setting the mock ConfigClient"

MockConfigClientKey is used for testing.

View Source
var MockGCEPClientKey contextKey = "used in tests only for setting the mock GCEPClient"

MockGCEPClientKey is used for testing.

View Source
var MockSwarmingClientKey contextKey = "used in tests only for setting the mock SwarmingClient"

MockSwarmingClientKey is used for testing.

View Source
var MockUFSClientKey contextKey = "used in tests only for setting the mock UFSClient"

MockUFSClientKey is used for testing.

Functions

func InitializeUpdateLSERequest

func InitializeUpdateLSERequest(hostname, hive string) *ufsAPI.UpdateMachineLSERequest

InitializeUpdateLSERequest return a new initialized UpdateMachineLSERequest.

func NewConfigClient

func NewConfigClient(ctx context.Context) config.Interface

func SetUFSNamespace

func SetUFSNamespace(ctx context.Context, namespace string) context.Context

SetUFSNamespace is a helper function to set UFS namespace in context.

Types

type GCEPClient

type GCEPClient interface {
	Get(ctx context.Context, in *gcepAPI.GetRequest, opts ...grpc.CallOption) (*gcepAPI.Config, error)
	Update(ctx context.Context, in *gcepAPI.UpdateRequest, opts ...grpc.CallOption) (*gcepAPI.Config, error)
}

GCEPClient is GCE Provider API wrapper for BotsRegulator specific usage. It is used for mocking and testing.

func NewGCEPClient

func NewGCEPClient(ctx context.Context, host string) (GCEPClient, error)

type MockGCEPClient

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

MockGCEPClient is a mock of GCEPClient interface.

func NewMockGCEPClient

func NewMockGCEPClient(ctrl *gomock.Controller) *MockGCEPClient

NewMockGCEPClient creates a new mock instance.

func (*MockGCEPClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockGCEPClient) Get

Get mocks base method.

func (*MockGCEPClient) Update

Update mocks base method.

type MockGCEPClientMockRecorder

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

MockGCEPClientMockRecorder is the mock recorder for MockGCEPClient.

func (*MockGCEPClientMockRecorder) Get

func (mr *MockGCEPClientMockRecorder) Get(ctx, in interface{}, opts ...interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockGCEPClientMockRecorder) Update

func (mr *MockGCEPClientMockRecorder) Update(ctx, in interface{}, opts ...interface{}) *gomock.Call

Update indicates an expected call of Update.

type MockSwarmingClient

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

MockSwarmingClient is a mock of SwarmingClient interface.

func NewMockSwarmingClient

func NewMockSwarmingClient(ctrl *gomock.Controller) *MockSwarmingClient

NewMockSwarmingClient creates a new mock instance.

func (*MockSwarmingClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockSwarmingClient) ListBots

ListBots mocks base method.

type MockSwarmingClientMockRecorder

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

MockSwarmingClientMockRecorder is the mock recorder for MockSwarmingClient.

func (*MockSwarmingClientMockRecorder) ListBots

func (mr *MockSwarmingClientMockRecorder) ListBots(ctx, in interface{}, opts ...interface{}) *gomock.Call

ListBots indicates an expected call of ListBots.

type MockUFSClient

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

MockUFSClient is a mock of UFSClient interface.

func NewMockUFSClient

func NewMockUFSClient(ctrl *gomock.Controller) *MockUFSClient

NewMockUFSClient creates a new mock instance.

func (*MockUFSClient) BatchListMachineLSEs

func (m *MockUFSClient) BatchListMachineLSEs(ctx context.Context, filters []string, pageSize int, keysOnly, full bool) ([]protoadapt.MessageV1, error)

BatchListMachineLSEs mocks base method.

func (*MockUFSClient) BatchListMachines

func (m *MockUFSClient) BatchListMachines(ctx context.Context, filters []string, pageSize int, keysOnly, full bool) ([]protoadapt.MessageV1, error)

BatchListMachines mocks base method.

func (*MockUFSClient) BatchListSchedulingUnits

func (m *MockUFSClient) BatchListSchedulingUnits(ctx context.Context, filters []string, pageSize int, keysOnly, full bool) ([]protoadapt.MessageV1, error)

BatchListSchedulingUnits mocks base method.

func (*MockUFSClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockUFSClient) UpdateMachineLSE

func (m *MockUFSClient) UpdateMachineLSE(ctx context.Context, in *ufspb0.UpdateMachineLSERequest, opts ...grpc.CallOption) (*ufspb.MachineLSE, error)

UpdateMachineLSE mocks base method.

type MockUFSClientMockRecorder

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

MockUFSClientMockRecorder is the mock recorder for MockUFSClient.

func (*MockUFSClientMockRecorder) BatchListMachineLSEs

func (mr *MockUFSClientMockRecorder) BatchListMachineLSEs(ctx, filters, pageSize, keysOnly, full interface{}) *gomock.Call

BatchListMachineLSEs indicates an expected call of BatchListMachineLSEs.

func (*MockUFSClientMockRecorder) BatchListMachines

func (mr *MockUFSClientMockRecorder) BatchListMachines(ctx, filters, pageSize, keysOnly, full interface{}) *gomock.Call

BatchListMachines indicates an expected call of BatchListMachines.

func (*MockUFSClientMockRecorder) BatchListSchedulingUnits

func (mr *MockUFSClientMockRecorder) BatchListSchedulingUnits(ctx, filters, pageSize, keysOnly, full interface{}) *gomock.Call

BatchListSchedulingUnits indicates an expected call of BatchListSchedulingUnits.

func (*MockUFSClientMockRecorder) UpdateMachineLSE

func (mr *MockUFSClientMockRecorder) UpdateMachineLSE(ctx, in interface{}, opts ...interface{}) *gomock.Call

UpdateMachineLSE indicates an expected call of UpdateMachineLSE.

type SwarmingClient

type SwarmingClient interface {
	ListBots(ctx context.Context, in *apipb.BotsRequest, opts ...grpc.CallOption) (*apipb.BotInfoListResponse, error)
}

func NewSwarmingClient

func NewSwarmingClient(ctx context.Context, host string) (SwarmingClient, error)

type UFSClient

type UFSClient interface {
	BatchListMachineLSEs(ctx context.Context, filters []string, pageSize int, keysOnly, full bool) ([]protoadapt.MessageV1, error)
	BatchListMachines(ctx context.Context, filters []string, pageSize int, keysOnly, full bool) ([]protoadapt.MessageV1, error)
	BatchListSchedulingUnits(ctx context.Context, filters []string, pageSize int, keysOnly, full bool) ([]protoadapt.MessageV1, error)
	UpdateMachineLSE(ctx context.Context, in *ufsAPI.UpdateMachineLSERequest, opts ...grpc.CallOption) (*ufspb.MachineLSE, error)
}

UFSClient is UFS API wrapper for BotsRegulator specific usage. It is used for mocking and testing.

func NewUFSClient

func NewUFSClient(ctx context.Context, host string) (UFSClient, error)

Jump to

Keyboard shortcuts

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