client

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package client is the gateway for the job executor to interface with the Phobos API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Close() error
	SetJobStatus(ctx context.Context, jobID string, status string) (*pb.Job, error)
	WriteLogs(ctx context.Context, jobID string, startOffset int32, buffer []byte) error
	GetJob(ctx context.Context, jobID string) (*pb.Job, error)
	GetPipelineTemplate(ctx context.Context, pipelineID string) ([]byte, error)
	SetPipelineActionStatus(ctx context.Context, pipelineID string, actionPath string, state statemachine.NodeStatus) error
	GetPipeline(ctx context.Context, pipelineID string) (*pb.Pipeline, error)
	GetPipelineActionOutputs(ctx context.Context, pipelineID string, actionPaths []string) ([]*pb.PipelineActionOutputs, error)
	SetPipelineActionOutputs(ctx context.Context, pipelineID string, actionPath string, outputs map[string]cty.Value) error
	GetPipelineVariables(ctx context.Context, pipelineID string) (*pb.GetPipelineVariablesResponse, error)
	CreatePipelineJWT(ctx context.Context, pipelineID string, audience string, expiration time.Time) (string, error)
	SubscribeToJobCancellationEvent(ctx context.Context, jobID string) (pb.Jobs_SubscribeToJobCancellationEventClient, error)
	GetRepositoryArchive(ctx context.Context, vcsProviderID, repositoryPath string, ref *string) (pb.VCSProviders_GetRepositoryArchiveClient, error)
	CreateVCSTokenForPipeline(ctx context.Context, pipelineID, vcsProviderID string) (*pb.CreateVCSTokenForPipelineResponse, error)
}

Client is the client that the job executor will use to interface with the phobos api

func NewGRPCClient

func NewGRPCClient(ctx context.Context, options *GRPCClientOptions) (Client, error)

NewGRPCClient returns a new grpc client

type GRPCClientOptions

type GRPCClientOptions struct {
	HTTPEndpoint string
	Token        string
}

GRPCClientOptions are the options for the grpc client

type MockClient

type MockClient struct {
	mock.Mock
}

MockClient is an autogenerated mock type for the Client type

func NewMockClient

func NewMockClient(t mockConstructorTestingTNewMockClient) *MockClient

NewMockClient creates a new instance of MockClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockClient) Close

func (_m *MockClient) Close() error

Close provides a mock function with given fields:

func (*MockClient) CreatePipelineJWT

func (_m *MockClient) CreatePipelineJWT(ctx context.Context, pipelineID string, audience string, expiration time.Time) (string, error)

CreatePipelineJWT provides a mock function with given fields: ctx, pipelineID, audience, expiration

func (*MockClient) CreateVCSTokenForPipeline added in v0.8.0

func (_m *MockClient) CreateVCSTokenForPipeline(ctx context.Context, pipelineID string, vcsProviderID string) (*gen.CreateVCSTokenForPipelineResponse, error)

CreateVCSTokenForPipeline provides a mock function with given fields: ctx, pipelineID, vcsProviderID

func (*MockClient) GetJob

func (_m *MockClient) GetJob(ctx context.Context, jobID string) (*gen.Job, error)

GetJob provides a mock function with given fields: ctx, jobID

func (*MockClient) GetPipeline

func (_m *MockClient) GetPipeline(ctx context.Context, pipelineID string) (*gen.Pipeline, error)

GetPipeline provides a mock function with given fields: ctx, pipelineID

func (*MockClient) GetPipelineActionOutputs

func (_m *MockClient) GetPipelineActionOutputs(ctx context.Context, pipelineID string, actionPaths []string) ([]*gen.PipelineActionOutputs, error)

GetPipelineActionOutputs provides a mock function with given fields: ctx, pipelineID, actionPaths

func (*MockClient) GetPipelineTemplate

func (_m *MockClient) GetPipelineTemplate(ctx context.Context, pipelineID string) ([]byte, error)

GetPipelineTemplate provides a mock function with given fields: ctx, pipelineID

func (*MockClient) GetPipelineVariables

func (_m *MockClient) GetPipelineVariables(ctx context.Context, pipelineID string) (*gen.GetPipelineVariablesResponse, error)

GetPipelineVariables provides a mock function with given fields: ctx, pipelineID

func (*MockClient) GetRepositoryArchive

func (_m *MockClient) GetRepositoryArchive(ctx context.Context, vcsProviderID string, repositoryPath string, ref *string) (gen.VCSProviders_GetRepositoryArchiveClient, error)

GetRepositoryArchive provides a mock function with given fields: ctx, vcsProviderID, repositoryPath, ref

func (*MockClient) SetJobStatus

func (_m *MockClient) SetJobStatus(ctx context.Context, jobID string, status string) (*gen.Job, error)

SetJobStatus provides a mock function with given fields: ctx, jobID, status

func (*MockClient) SetPipelineActionOutputs

func (_m *MockClient) SetPipelineActionOutputs(ctx context.Context, pipelineID string, actionPath string, outputs map[string]cty.Value) error

SetPipelineActionOutputs provides a mock function with given fields: ctx, pipelineID, actionPath, outputs

func (*MockClient) SetPipelineActionStatus

func (_m *MockClient) SetPipelineActionStatus(ctx context.Context, pipelineID string, actionPath string, state statemachine.NodeStatus) error

SetPipelineActionStatus provides a mock function with given fields: ctx, pipelineID, actionPath, state

func (*MockClient) SubscribeToJobCancellationEvent

func (_m *MockClient) SubscribeToJobCancellationEvent(ctx context.Context, jobID string) (gen.Jobs_SubscribeToJobCancellationEventClient, error)

SubscribeToJobCancellationEvent provides a mock function with given fields: ctx, jobID

func (*MockClient) WriteLogs

func (_m *MockClient) WriteLogs(ctx context.Context, jobID string, startOffset int32, buffer []byte) error

WriteLogs provides a mock function with given fields: ctx, jobID, startOffset, buffer

Jump to

Keyboard shortcuts

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