Documentation ¶
Index ¶
- type BootstrapConfig
- type Client
- type Deps
- type Manager
- type ManagerConfig
- type MockClient
- func (_m *MockClient) DiscoverServers(ctx context.Context) ([]string, error)
- func (_m *MockClient) EXPECT() *MockClient_Expecter
- func (_m *MockClient) FetchBootstrap(ctx context.Context) (*BootstrapConfig, error)
- func (_m *MockClient) PushServerStatus(ctx context.Context, status *ServerStatus) error
- type MockClient_DiscoverServers_Call
- type MockClient_Expecter
- func (_e *MockClient_Expecter) DiscoverServers(ctx interface{}) *MockClient_DiscoverServers_Call
- func (_e *MockClient_Expecter) FetchBootstrap(ctx interface{}) *MockClient_FetchBootstrap_Call
- func (_e *MockClient_Expecter) PushServerStatus(ctx interface{}, status interface{}) *MockClient_PushServerStatus_Call
- type MockClient_FetchBootstrap_Call
- type MockClient_PushServerStatus_Call
- type MockHCPServer
- type ServerAutopilot
- type ServerRaft
- type ServerStatus
- type ServerTLSInfo
- type StatusCallback
- type TestEndpoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BootstrapConfig ¶
type Client ¶
type Client interface { FetchBootstrap(ctx context.Context) (*BootstrapConfig, error) PushServerStatus(ctx context.Context, status *ServerStatus) error DiscoverServers(ctx context.Context) ([]string, error) }
Client interface exposes HCP operations that can be invoked by Consul
type Deps ¶
Deps contains the interfaces that the rest of Consul core depends on for HCP integration.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(cfg ManagerConfig) *Manager
NewManager returns an initialized Manager with a zero configuration. It won't do anything until UpdateConfig is called with a config that provides credentials to contact HCP.
func (*Manager) Run ¶
Run executes the Manager it's designed to be run in its own goroutine for the life of a server agent. It should be run even if HCP is not configured yet for servers since a config update might configure it later and UpdateConfig called. It will effectively do nothing if there are no HCP credentials set other than wait for some to be added.
func (*Manager) SendUpdate ¶
func (m *Manager) SendUpdate()
func (*Manager) UpdateConfig ¶
func (m *Manager) UpdateConfig(cfg ManagerConfig)
type ManagerConfig ¶
type MockClient ¶
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) DiscoverServers ¶
func (_m *MockClient) DiscoverServers(ctx context.Context) ([]string, error)
DiscoverServers provides a mock function with given fields: ctx
func (*MockClient) EXPECT ¶
func (_m *MockClient) EXPECT() *MockClient_Expecter
func (*MockClient) FetchBootstrap ¶
func (_m *MockClient) FetchBootstrap(ctx context.Context) (*BootstrapConfig, error)
FetchBootstrap provides a mock function with given fields: ctx
func (*MockClient) PushServerStatus ¶
func (_m *MockClient) PushServerStatus(ctx context.Context, status *ServerStatus) error
PushServerStatus provides a mock function with given fields: ctx, status
type MockClient_DiscoverServers_Call ¶
MockClient_DiscoverServers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DiscoverServers'
func (*MockClient_DiscoverServers_Call) Return ¶
func (_c *MockClient_DiscoverServers_Call) Return(_a0 []string, _a1 error) *MockClient_DiscoverServers_Call
func (*MockClient_DiscoverServers_Call) Run ¶
func (_c *MockClient_DiscoverServers_Call) Run(run func(ctx context.Context)) *MockClient_DiscoverServers_Call
type MockClient_Expecter ¶
type MockClient_Expecter struct {
// contains filtered or unexported fields
}
func (*MockClient_Expecter) DiscoverServers ¶
func (_e *MockClient_Expecter) DiscoverServers(ctx interface{}) *MockClient_DiscoverServers_Call
DiscoverServers is a helper method to define mock.On call
- ctx context.Context
func (*MockClient_Expecter) FetchBootstrap ¶
func (_e *MockClient_Expecter) FetchBootstrap(ctx interface{}) *MockClient_FetchBootstrap_Call
FetchBootstrap is a helper method to define mock.On call
- ctx context.Context
func (*MockClient_Expecter) PushServerStatus ¶
func (_e *MockClient_Expecter) PushServerStatus(ctx interface{}, status interface{}) *MockClient_PushServerStatus_Call
PushServerStatus is a helper method to define mock.On call
- ctx context.Context
- status *ServerStatus
type MockClient_FetchBootstrap_Call ¶
MockClient_FetchBootstrap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FetchBootstrap'
func (*MockClient_FetchBootstrap_Call) Return ¶
func (_c *MockClient_FetchBootstrap_Call) Return(_a0 *BootstrapConfig, _a1 error) *MockClient_FetchBootstrap_Call
func (*MockClient_FetchBootstrap_Call) Run ¶
func (_c *MockClient_FetchBootstrap_Call) Run(run func(ctx context.Context)) *MockClient_FetchBootstrap_Call
type MockClient_PushServerStatus_Call ¶
MockClient_PushServerStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PushServerStatus'
func (*MockClient_PushServerStatus_Call) Return ¶
func (_c *MockClient_PushServerStatus_Call) Return(_a0 error) *MockClient_PushServerStatus_Call
func (*MockClient_PushServerStatus_Call) Run ¶
func (_c *MockClient_PushServerStatus_Call) Run(run func(ctx context.Context, status *ServerStatus)) *MockClient_PushServerStatus_Call
type MockHCPServer ¶
type MockHCPServer struct {
// contains filtered or unexported fields
}
func NewMockHCPServer ¶
func NewMockHCPServer() *MockHCPServer
func (*MockHCPServer) AddEndpoint ¶
func (s *MockHCPServer) AddEndpoint(e TestEndpoint)
AddEndpoint allows adding additional endpoints from other packages e.g. bootstrap (which can't be merged into one package due to dependency cycles). It's not safe to call this concurrently with any other call to AddEndpoint or ServeHTTP.
func (*MockHCPServer) ServeHTTP ¶
func (s *MockHCPServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ServerAutopilot ¶
type ServerRaft ¶
type ServerStatus ¶
type ServerStatus struct { ID string Name string Version string LanAddress string GossipPort int RPCPort int Autopilot ServerAutopilot Raft ServerRaft TLS ServerTLSInfo ScadaStatus string }
type ServerTLSInfo ¶
type StatusCallback ¶
type StatusCallback func(context.Context) (ServerStatus, error)