Documentation
¶
Index ¶
- Variables
- func NewFromConfig(config *baseclient.Config) (*client.ClientWithResponses, error)
- type Config
- type Interceptor
- type Planner
- type PlannerMock
- func (mock *PlannerMock) UpdateAgentStatus(ctx context.Context, id uuid.UUID, params api.AgentStatusUpdate) error
- func (mock *PlannerMock) UpdateAgentStatusCalls() []struct{ ... }
- func (mock *PlannerMock) UpdateSourceStatus(ctx context.Context, id uuid.UUID, params api.SourceStatusUpdate) error
- func (mock *PlannerMock) UpdateSourceStatusCalls() []struct{ ... }
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmptyResponse = errors.New("empty response") ErrSourceGone = errors.New("source is gone") )
Functions ¶
func NewFromConfig ¶
func NewFromConfig(config *baseclient.Config) (*client.ClientWithResponses, error)
NewFromConfig returns a new FlightCtl API client from the given config.
Types ¶
type Interceptor ¶
type Interceptor struct {
// contains filtered or unexported fields
}
func NewInterceptor ¶
func NewInterceptor(client Planner) *Interceptor
func (*Interceptor) GetStatus ¶
func (i *Interceptor) GetStatus() common.AgentStatus
func (*Interceptor) UpdateAgentStatus ¶
func (i *Interceptor) UpdateAgentStatus(ctx context.Context, id uuid.UUID, params api.AgentStatusUpdate) error
UpdateAgentStatus updates the agent status.
func (*Interceptor) UpdateSourceStatus ¶
func (i *Interceptor) UpdateSourceStatus(ctx context.Context, id uuid.UUID, params api.SourceStatusUpdate) error
type Planner ¶
type Planner interface {
UpdateSourceStatus(ctx context.Context, id uuid.UUID, params api.SourceStatusUpdate) error
// UpdateAgentStatus updates the agent status.
UpdateAgentStatus(ctx context.Context, id uuid.UUID, params api.AgentStatusUpdate) error
}
Planner is the client interface for migration planning.
func NewPlanner ¶
func NewPlanner(client *client.ClientWithResponses) Planner
type PlannerMock ¶
type PlannerMock struct {
// UpdateAgentStatusFunc mocks the UpdateAgentStatus method.
UpdateAgentStatusFunc func(ctx context.Context, id uuid.UUID, params api.AgentStatusUpdate) error
// UpdateSourceStatusFunc mocks the UpdateSourceStatus method.
UpdateSourceStatusFunc func(ctx context.Context, id uuid.UUID, params api.SourceStatusUpdate) error
// contains filtered or unexported fields
}
PlannerMock is a mock implementation of Planner.
func TestSomethingThatUsesPlanner(t *testing.T) {
// make and configure a mocked Planner
mockedPlanner := &PlannerMock{
UpdateAgentStatusFunc: func(ctx context.Context, id uuid.UUID, params api.AgentStatusUpdate) error {
panic("mock out the UpdateAgentStatus method")
},
UpdateSourceStatusFunc: func(ctx context.Context, id uuid.UUID, params api.SourceStatusUpdate) error {
panic("mock out the UpdateSourceStatus method")
},
}
// use mockedPlanner in code that requires Planner
// and then make assertions.
}
func (*PlannerMock) UpdateAgentStatus ¶
func (mock *PlannerMock) UpdateAgentStatus(ctx context.Context, id uuid.UUID, params api.AgentStatusUpdate) error
UpdateAgentStatus calls UpdateAgentStatusFunc.
func (*PlannerMock) UpdateAgentStatusCalls ¶
func (mock *PlannerMock) UpdateAgentStatusCalls() []struct { Ctx context.Context ID uuid.UUID Params api.AgentStatusUpdate }
UpdateAgentStatusCalls gets all the calls that were made to UpdateAgentStatus. Check the length with:
len(mockedPlanner.UpdateAgentStatusCalls())
func (*PlannerMock) UpdateSourceStatus ¶
func (mock *PlannerMock) UpdateSourceStatus(ctx context.Context, id uuid.UUID, params api.SourceStatusUpdate) error
UpdateSourceStatus calls UpdateSourceStatusFunc.
func (*PlannerMock) UpdateSourceStatusCalls ¶
func (mock *PlannerMock) UpdateSourceStatusCalls() []struct { Ctx context.Context ID uuid.UUID Params api.SourceStatusUpdate }
UpdateSourceStatusCalls gets all the calls that were made to UpdateSourceStatus. Check the length with:
len(mockedPlanner.UpdateSourceStatusCalls())
type Service ¶
type Service = baseclient.Service
Click to show internal directories.
Click to hide internal directories.