Documentation
¶
Index ¶
- type ExternalServiceList
- func (e *ExternalServiceList) GetAppClients(ctx context.Context, cfg *config.Config) *clients.ClientList
- func (e *ExternalServiceList) GetAuthorisationMiddleware(ctx context.Context, authorisationConfig *authorisation.Config) (authorisation.Middleware, error)
- 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) GetMigrator(ctx context.Context, cfg *config.Config, jobService application.JobService, ...) (migrator.Migrator, error)
- func (e *ExternalServiceList) GetMongoDB(ctx context.Context, cfg config.MongoConfig) (store.MongoDB, error)
- func (e *ExternalServiceList) GetSlackClient(ctx context.Context, cfg *config.Config) (slack.Clienter, error)
- func (e *ExternalServiceList) GetTopicCache(ctx context.Context, cfg *config.Config, clientList *clients.ClientList) (*cache.TopicCache, chan error, error)
- type HTTPServer
- type HealthChecker
- type Init
- func (e *Init) DoGetAppClients(ctx context.Context, cfg *config.Config) *clients.ClientList
- func (e *Init) DoGetAuthorisationMiddleware(ctx context.Context, authorisationConfig *authorisation.Config) (authorisation.Middleware, error)
- 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) DoGetMigrator(ctx context.Context, cfg *config.Config, jobService application.JobService, ...) (migrator.Migrator, error)
- func (e *Init) DoGetMongoDB(ctx context.Context, cfg config.MongoConfig) (store.MongoDB, error)
- func (e *Init) DoGetSlackClient(ctx context.Context, cfg *config.Config) (slack.Clienter, error)
- func (e *Init) DoGetTopicCache(ctx context.Context, cfg *config.Config, clientList *clients.ClientList) (*cache.TopicCache, chan error, error)
- type Initialiser
- type MigrationServiceStore
- type Service
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
MongoDB bool
Migrator bool
SlackClient bool
TopicCache 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) GetAppClients ¶ added in v0.5.0
func (e *ExternalServiceList) GetAppClients(ctx context.Context, cfg *config.Config) *clients.ClientList
GetAppClients gets the app clients for the service
func (*ExternalServiceList) GetAuthorisationMiddleware ¶ added in v0.9.0
func (e *ExternalServiceList) GetAuthorisationMiddleware(ctx context.Context, authorisationConfig *authorisation.Config) (authorisation.Middleware, error)
GetAuthorisationMiddleware gets the authorisation middleware for the service
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) GetMigrator ¶ added in v0.4.0
func (e *ExternalServiceList) GetMigrator(ctx context.Context, cfg *config.Config, jobService application.JobService, clientList *clients.ClientList, slackClient slack.Clienter, topicCache *cache.TopicCache) (migrator.Migrator, error)
GetMigrator returns the background migrator
func (*ExternalServiceList) GetMongoDB ¶ added in v0.4.0
func (e *ExternalServiceList) GetMongoDB(ctx context.Context, cfg config.MongoConfig) (store.MongoDB, error)
GetMongoDB returns a mongodb health client and dataset mongo object
func (*ExternalServiceList) GetSlackClient ¶ added in v0.26.0
func (e *ExternalServiceList) GetSlackClient(ctx context.Context, cfg *config.Config) (slack.Clienter, error)
GetSlackClient returns a Slack client for sending notifications
func (*ExternalServiceList) GetTopicCache ¶ added in v0.27.0
func (e *ExternalServiceList) GetTopicCache(ctx context.Context, cfg *config.Config, clientList *clients.ClientList) (*cache.TopicCache, chan error, error)
GetTopicCache returns the topic cache and an error channel for monitoring cache update failures
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) DoGetAppClients ¶ added in v0.5.0
DoGetAppClients returns a set of app clients for the migration service
func (*Init) DoGetAuthorisationMiddleware ¶ added in v0.9.0
func (e *Init) DoGetAuthorisationMiddleware(ctx context.Context, authorisationConfig *authorisation.Config) (authorisation.Middleware, error)
DoGetAuthorisationMiddleware creates authorisation middleware for the given config
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
func (*Init) DoGetMigrator ¶ added in v0.4.0
func (e *Init) DoGetMigrator(ctx context.Context, cfg *config.Config, jobService application.JobService, clientList *clients.ClientList, slackClient slack.Clienter, topicCache *cache.TopicCache) (migrator.Migrator, error)
DoGetMigrator returns a Migrator
func (*Init) DoGetMongoDB ¶ added in v0.4.0
DoGetMongoDB returns a MongoDB
func (*Init) DoGetSlackClient ¶ added in v0.26.0
DoGetSlackClient returns a Slack client based on configuration
func (*Init) DoGetTopicCache ¶ added in v0.27.0
func (e *Init) DoGetTopicCache(ctx context.Context, cfg *config.Config, clientList *clients.ClientList) (*cache.TopicCache, chan error, error)
DoGetTopicCache creates and initializes the topic cache. This function will fail if the initial cache population fails, as the topic cache is critical for the migration service. Returns the topic cache and error channel for monitoring updates.
type Initialiser ¶
type Initialiser interface {
DoGetHTTPServer(bindAddr string, router http.Handler) HTTPServer
DoGetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error)
DoGetMigrator(ctx context.Context, cfg *config.Config, jobService application.JobService, clientList *clients.ClientList, slackClient slack.Clienter, topicCache *cache.TopicCache) (migrator.Migrator, error)
DoGetMongoDB(ctx context.Context, cfg config.MongoConfig) (store.MongoDB, error)
DoGetSlackClient(ctx context.Context, cfg *config.Config) (slack.Clienter, error)
DoGetAppClients(ctx context.Context, cfg *config.Config) *clients.ClientList
DoGetTopicCache(ctx context.Context, cfg *config.Config, clientList *clients.ClientList) (*cache.TopicCache, chan error, error)
DoGetAuthorisationMiddleware(ctx context.Context, authorisationConfig *authorisation.Config) (authorisation.Middleware, error)
}
Initialiser defines the methods to initialise external services
type MigrationServiceStore ¶ added in v0.4.0
MigrationServiceStore wraps the MongoDB client to implement the Storer interface
type Service ¶
type Service struct {
API *api.MigrationAPI
Config *config.Config
HealthCheck HealthChecker
JobService application.JobService
Router *mux.Router
Server HTTPServer
ServiceList *ExternalServiceList
// contains filtered or unexported fields
}
Service contains all the configs, server and clients to run the API
func New ¶ added in v0.4.0
func New(cfg *config.Config, serviceList *ExternalServiceList) *Service
New creates a new service