Documentation ¶
Overview ¶
Package consul is a generated GoMock package.
Package consul is a generated GoMock package.
Index ¶
- Variables
- func DestinationToUpstreamRef(consulDest *v1.ConsulServiceDestination) *core.ResourceRef
- func IsConsulUpstream(upstreamName string) bool
- func NewConsulUpstreamClient(consul ConsulWatcher) v1.UpstreamClient
- type ConsulClient
- type ConsulWatcher
- type MockConsulClient
- func (m *MockConsulClient) CanConnect() bool
- func (m *MockConsulClient) Connect(service, tag string, q *api.QueryOptions) ([]*api.CatalogService, *api.QueryMeta, error)
- func (m *MockConsulClient) DataCenters() ([]string, error)
- func (m *MockConsulClient) EXPECT() *MockConsulClientMockRecorder
- func (m *MockConsulClient) Service(service, tag string, q *api.QueryOptions) ([]*api.CatalogService, *api.QueryMeta, error)
- func (m *MockConsulClient) Services(q *api.QueryOptions) (map[string][]string, *api.QueryMeta, error)
- type MockConsulClientMockRecorder
- func (mr *MockConsulClientMockRecorder) CanConnect() *gomock.Call
- func (mr *MockConsulClientMockRecorder) Connect(service, tag, q interface{}) *gomock.Call
- func (mr *MockConsulClientMockRecorder) DataCenters() *gomock.Call
- func (mr *MockConsulClientMockRecorder) Service(service, tag, q interface{}) *gomock.Call
- func (mr *MockConsulClientMockRecorder) Services(q interface{}) *gomock.Call
- type MockConsulWatcher
- func (m *MockConsulWatcher) CanConnect() bool
- func (m *MockConsulWatcher) Connect(service, tag string, q *api.QueryOptions) ([]*api.CatalogService, *api.QueryMeta, error)
- func (m *MockConsulWatcher) DataCenters() ([]string, error)
- func (m *MockConsulWatcher) EXPECT() *MockConsulWatcherMockRecorder
- func (m *MockConsulWatcher) Service(service, tag string, q *api.QueryOptions) ([]*api.CatalogService, *api.QueryMeta, error)
- func (m *MockConsulWatcher) Services(q *api.QueryOptions) (map[string][]string, *api.QueryMeta, error)
- func (m *MockConsulWatcher) WatchServices(ctx context.Context, dataCenters []string) (<-chan []*ServiceMeta, <-chan error)
- type MockConsulWatcherMockRecorder
- func (mr *MockConsulWatcherMockRecorder) CanConnect() *gomock.Call
- func (mr *MockConsulWatcherMockRecorder) Connect(service, tag, q interface{}) *gomock.Call
- func (mr *MockConsulWatcherMockRecorder) DataCenters() *gomock.Call
- func (mr *MockConsulWatcherMockRecorder) Service(service, tag, q interface{}) *gomock.Call
- func (mr *MockConsulWatcherMockRecorder) Services(q interface{}) *gomock.Call
- func (mr *MockConsulWatcherMockRecorder) WatchServices(ctx, dataCenters interface{}) *gomock.Call
- type ServiceMeta
Constants ¶
This section is empty.
Variables ¶
var ForbiddenDataCenterErr = func(dataCenter string) error { return errors.Errorf("not allowed to query data center [%s]. " + "Use the settings to configure the data centers Gloo is allowed to query") }
Functions ¶
func DestinationToUpstreamRef ¶
func DestinationToUpstreamRef(consulDest *v1.ConsulServiceDestination) *core.ResourceRef
func IsConsulUpstream ¶
func NewConsulUpstreamClient ¶
func NewConsulUpstreamClient(consul ConsulWatcher) v1.UpstreamClient
This client can list and watch Consul services. A Gloo upstream will be generated for each unique Consul service name. The Consul EDS will discover and characterize all endpoints for each one of these upstreams across the available data centers.
NOTE: any method except List and Watch will panic!
Types ¶
type ConsulClient ¶
type ConsulClient interface { // Returns false if no connection to the Consul agent can be established CanConnect() bool // DataCenters is used to query for all the known data centers. // Results will be filtered based on the data center whitelist provided in the Gloo settings. DataCenters() ([]string, error) // Services is used to query for all known services Services(q *consulapi.QueryOptions) (map[string][]string, *consulapi.QueryMeta, error) // Service is used to query catalog entries for a given service Service(service, tag string, q *consulapi.QueryOptions) ([]*consulapi.CatalogService, *consulapi.QueryMeta, error) // Connect is used to query catalog entries for a given Connect-enabled service Connect(service, tag string, q *consulapi.QueryOptions) ([]*consulapi.CatalogService, *consulapi.QueryMeta, error) }
TODO(marco): consider adding ctx to signatures instead on relying on caller to set it Wrap the Consul API in an interface to allow mocking
func NewConsulClient ¶
func NewConsulClient(settings *v1.Settings) (ConsulClient, error)
type ConsulWatcher ¶
type ConsulWatcher interface { ConsulClient WatchServices(ctx context.Context, dataCenters []string) (<-chan []*ServiceMeta, <-chan error) }
func NewConsulWatcher ¶
func NewConsulWatcher(settings *v1.Settings) (ConsulWatcher, error)
func NewConsulWatcherFromClient ¶
func NewConsulWatcherFromClient(client ConsulClient) ConsulWatcher
type MockConsulClient ¶
type MockConsulClient struct {
// contains filtered or unexported fields
}
MockConsulClient is a mock of ConsulClient interface
func NewMockConsulClient ¶
func NewMockConsulClient(ctrl *gomock.Controller) *MockConsulClient
NewMockConsulClient creates a new mock instance
func (*MockConsulClient) CanConnect ¶
func (m *MockConsulClient) CanConnect() bool
CanConnect mocks base method
func (*MockConsulClient) Connect ¶
func (m *MockConsulClient) Connect(service, tag string, q *api.QueryOptions) ([]*api.CatalogService, *api.QueryMeta, error)
Connect mocks base method
func (*MockConsulClient) DataCenters ¶
func (m *MockConsulClient) DataCenters() ([]string, error)
DataCenters mocks base method
func (*MockConsulClient) EXPECT ¶
func (m *MockConsulClient) EXPECT() *MockConsulClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockConsulClient) Service ¶
func (m *MockConsulClient) Service(service, tag string, q *api.QueryOptions) ([]*api.CatalogService, *api.QueryMeta, error)
Service mocks base method
func (*MockConsulClient) Services ¶
func (m *MockConsulClient) Services(q *api.QueryOptions) (map[string][]string, *api.QueryMeta, error)
Services mocks base method
type MockConsulClientMockRecorder ¶
type MockConsulClientMockRecorder struct {
// contains filtered or unexported fields
}
MockConsulClientMockRecorder is the mock recorder for MockConsulClient
func (*MockConsulClientMockRecorder) CanConnect ¶
func (mr *MockConsulClientMockRecorder) CanConnect() *gomock.Call
CanConnect indicates an expected call of CanConnect
func (*MockConsulClientMockRecorder) Connect ¶
func (mr *MockConsulClientMockRecorder) Connect(service, tag, q interface{}) *gomock.Call
Connect indicates an expected call of Connect
func (*MockConsulClientMockRecorder) DataCenters ¶
func (mr *MockConsulClientMockRecorder) DataCenters() *gomock.Call
DataCenters indicates an expected call of DataCenters
func (*MockConsulClientMockRecorder) Service ¶
func (mr *MockConsulClientMockRecorder) Service(service, tag, q interface{}) *gomock.Call
Service indicates an expected call of Service
func (*MockConsulClientMockRecorder) Services ¶
func (mr *MockConsulClientMockRecorder) Services(q interface{}) *gomock.Call
Services indicates an expected call of Services
type MockConsulWatcher ¶
type MockConsulWatcher struct {
// contains filtered or unexported fields
}
MockConsulWatcher is a mock of ConsulWatcher interface
func NewMockConsulWatcher ¶
func NewMockConsulWatcher(ctrl *gomock.Controller) *MockConsulWatcher
NewMockConsulWatcher creates a new mock instance
func (*MockConsulWatcher) CanConnect ¶
func (m *MockConsulWatcher) CanConnect() bool
CanConnect mocks base method
func (*MockConsulWatcher) Connect ¶
func (m *MockConsulWatcher) Connect(service, tag string, q *api.QueryOptions) ([]*api.CatalogService, *api.QueryMeta, error)
Connect mocks base method
func (*MockConsulWatcher) DataCenters ¶
func (m *MockConsulWatcher) DataCenters() ([]string, error)
DataCenters mocks base method
func (*MockConsulWatcher) EXPECT ¶
func (m *MockConsulWatcher) EXPECT() *MockConsulWatcherMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockConsulWatcher) Service ¶
func (m *MockConsulWatcher) Service(service, tag string, q *api.QueryOptions) ([]*api.CatalogService, *api.QueryMeta, error)
Service mocks base method
func (*MockConsulWatcher) Services ¶
func (m *MockConsulWatcher) Services(q *api.QueryOptions) (map[string][]string, *api.QueryMeta, error)
Services mocks base method
func (*MockConsulWatcher) WatchServices ¶
func (m *MockConsulWatcher) WatchServices(ctx context.Context, dataCenters []string) (<-chan []*ServiceMeta, <-chan error)
WatchServices mocks base method
type MockConsulWatcherMockRecorder ¶
type MockConsulWatcherMockRecorder struct {
// contains filtered or unexported fields
}
MockConsulWatcherMockRecorder is the mock recorder for MockConsulWatcher
func (*MockConsulWatcherMockRecorder) CanConnect ¶
func (mr *MockConsulWatcherMockRecorder) CanConnect() *gomock.Call
CanConnect indicates an expected call of CanConnect
func (*MockConsulWatcherMockRecorder) Connect ¶
func (mr *MockConsulWatcherMockRecorder) Connect(service, tag, q interface{}) *gomock.Call
Connect indicates an expected call of Connect
func (*MockConsulWatcherMockRecorder) DataCenters ¶
func (mr *MockConsulWatcherMockRecorder) DataCenters() *gomock.Call
DataCenters indicates an expected call of DataCenters
func (*MockConsulWatcherMockRecorder) Service ¶
func (mr *MockConsulWatcherMockRecorder) Service(service, tag, q interface{}) *gomock.Call
Service indicates an expected call of Service
func (*MockConsulWatcherMockRecorder) Services ¶
func (mr *MockConsulWatcherMockRecorder) Services(q interface{}) *gomock.Call
Services indicates an expected call of Services
func (*MockConsulWatcherMockRecorder) WatchServices ¶
func (mr *MockConsulWatcherMockRecorder) WatchServices(ctx, dataCenters interface{}) *gomock.Call
WatchServices indicates an expected call of WatchServices