Documentation ¶
Index ¶
- type ExternalServiceList
- func (e *ExternalServiceList) GetAuthorisationHandlers(cfg *config.Config) api.AuthHandler
- func (e *ExternalServiceList) GetHTTPServer(bindAddr string, router http.Handler) HTTPServer
- func (e *ExternalServiceList) GetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error)
- func (e *ExternalServiceList) GetHealthClient(name, url string) *health.Client
- type HTTPServer
- type HealthChecker
- type Init
- func (e *Init) DoGetAuthorisationHandlers(cfg *config.Config) api.AuthHandler
- func (e *Init) DoGetHTTPServer(bindAddr string, router http.Handler) HTTPServer
- func (e *Init) DoGetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error)
- func (e *Init) DoGetHealthClient(name, url string) *health.Client
- type Initialiser
- type Service
- func (svc *Service) Close(ctx context.Context) error
- func (svc *Service) SetElasticSearchClient(elasticSearchClient elasticsearch.Client)
- func (svc *Service) SetHealthCheck(healthCheck HealthChecker)
- func (svc *Service) SetQueryBuilder(queryBuilder api.QueryBuilder)
- func (svc *Service) SetServer(server HTTPServer)
- func (svc *Service) SetTransformer(transformerClient *transformer.LegacyTransformer)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExternalServiceList ¶
type ExternalServiceList struct { HealthCheck bool Init Initialiser Auth bool DatasetClient bool }
ExternalServiceList holds the initialiser and initialisation state of external services.
func NewServiceList ¶
func NewServiceList(initialiser Initialiser) *ExternalServiceList
NewServiceList creates a new service list with the provided initialiser
func (*ExternalServiceList) GetAuthorisationHandlers ¶
func (e *ExternalServiceList) GetAuthorisationHandlers(cfg *config.Config) api.AuthHandler
GetAuthorisationHandlers creates an AuthHandler client and sets the Auth flag to true
func (*ExternalServiceList) GetHTTPServer ¶
func (e *ExternalServiceList) GetHTTPServer(bindAddr string, router http.Handler) HTTPServer
GetHTTPServer creates an http server
func (*ExternalServiceList) GetHealthCheck ¶
func (e *ExternalServiceList) GetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error)
GetHealthCheck creates a healthcheck with versionInfo and sets the HealthCheck flag to true
func (*ExternalServiceList) GetHealthClient ¶
func (e *ExternalServiceList) GetHealthClient(name, url string) *health.Client
GetHealthClient returns a healthclient for the provided URL
type HTTPServer ¶
HTTPServer defines the required methods from the HTTP server
type HealthChecker ¶
type HealthChecker interface { Handler(w http.ResponseWriter, req *http.Request) Start(ctx context.Context) Stop() AddCheck(name string, checker healthcheck.Checker) (err error) }
HealthChecker defines the required methods from Healthcheck
type Init ¶
type Init struct{}
Init implements the Initialiser interface to initialise dependencies
func (*Init) DoGetAuthorisationHandlers ¶
func (e *Init) DoGetAuthorisationHandlers(cfg *config.Config) api.AuthHandler
func (*Init) DoGetHTTPServer ¶
func (e *Init) DoGetHTTPServer(bindAddr string, router http.Handler) HTTPServer
DoGetHTTPServer creates an HTTP Server with the provided bind address and router
func (*Init) DoGetHealthCheck ¶
func (e *Init) DoGetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error)
DoGetHealthCheck creates a healthcheck with versionInfo
type Initialiser ¶
type Initialiser interface { DoGetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error) DoGetHTTPServer(bindAddr string, router http.Handler) HTTPServer DoGetHealthClient(name, url string) *health.Client DoGetAuthorisationHandlers(cfg *config.Config) api.AuthHandler }
Initialiser defines the methods to initialise external services
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func Run ¶
func Run(ctx context.Context, cfg *config.Config, serviceList *ExternalServiceList, buildTime, gitCommit, version string, svcErrors chan error) (svc *Service, err error)
Run the service
func (*Service) SetElasticSearchClient ¶
func (svc *Service) SetElasticSearchClient(elasticSearchClient elasticsearch.Client)
SetElasticSearchClient sets the new instance of elasticsearch for a service
func (*Service) SetHealthCheck ¶
func (svc *Service) SetHealthCheck(healthCheck HealthChecker)
SetHealthCheck sets the healthchecker for a service
func (*Service) SetQueryBuilder ¶
func (svc *Service) SetQueryBuilder(queryBuilder api.QueryBuilder)
SetQueryBuilder sets the queryBuilder for a service
func (*Service) SetServer ¶
func (svc *Service) SetServer(server HTTPServer)
SetServer sets the http server for a service
func (*Service) SetTransformer ¶
func (svc *Service) SetTransformer(transformerClient *transformer.LegacyTransformer)
SetTransformer sets the transformer for a service