Documentation
¶
Index ¶
- type ExternalServiceList
- func (e *ExternalServiceList) GetAuthorisationMiddleware(ctx context.Context, authorisationConfig *authorisation.Config) (authorisation.Middleware, error)
- func (e *ExternalServiceList) GetFilesService(ctx context.Context, cfg *config.Config) (api.FilesService, error)
- func (e *ExternalServiceList) GetGenerators() (data.Generator, data.Generator, data.Generator)
- 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
- func (e *ExternalServiceList) GetKafkaProducer(ctx context.Context, cfg *config.Config) (producer kafka.IProducer, err error)
- func (e *ExternalServiceList) GetMongoDB(ctx context.Context, cfg *config.Config) (api.MongoServer, error)
- func (e *ExternalServiceList) GetResponder(ctx context.Context, cfg *config.Config) (*responder.Responder, error)
- func (e *ExternalServiceList) GetS3Client(ctx context.Context, cfg *config.Config) (api.S3Interface, error)
- type HTTPServer
- type HealthChecker
- type Init
- func (e *Init) DoGetAuthorisationMiddleware(ctx context.Context, authorisationConfig *authorisation.Config) (authorisation.Middleware, error)
- func (e *Init) DoGetFilesService(ctx context.Context, cfg *config.Config) (api.FilesService, error)
- func (e *Init) DoGetGenerators() (data.Generator, data.Generator, data.Generator)
- 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
- func (e *Init) DoGetKafkaProducer(ctx context.Context, cfg *config.Config) (kafka.IProducer, error)
- func (e *Init) DoGetMongoDB(ctx context.Context, cfg *config.Config) (api.MongoServer, error)
- func (e *Init) DoGetResponder(_ context.Context, _ *config.Config) (*responder.Responder, error)
- func (e *Init) DoGetS3Client(ctx context.Context, cfg *config.Config) (api.S3Interface, error)
- type Initialiser
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExternalServiceList ¶
type ExternalServiceList struct {
MongoDB bool
HealthCheck bool
KafkaProducer bool
S3Client bool
FilesService bool
Init Initialiser
}
func NewServiceList ¶
func NewServiceList(initialiser Initialiser) *ExternalServiceList
func (*ExternalServiceList) GetAuthorisationMiddleware ¶
func (e *ExternalServiceList) GetAuthorisationMiddleware(ctx context.Context, authorisationConfig *authorisation.Config) (authorisation.Middleware, error)
GetAuthorisationMiddleware creates a new instance of authorisation.Middlware
func (*ExternalServiceList) GetFilesService ¶
func (e *ExternalServiceList) GetFilesService(ctx context.Context, cfg *config.Config) (api.FilesService, error)
GetFilesService creates files service and sets the FilesService flag to true
func (*ExternalServiceList) GetGenerators ¶
GetGenerators returns all the attribute generators necessary - i.e. uuid, resourceId and slug
func (*ExternalServiceList) GetHTTPServer ¶
func (e *ExternalServiceList) GetHTTPServer(bindAddr string, router http.Handler) HTTPServer
GetHTTPServer creates an http server and sets the Server flag to true
func (*ExternalServiceList) GetHealthCheck ¶
func (e *ExternalServiceList) GetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error)
GetHealthCheck creates a healthcheck with versionInfo and sets teh HealthCheck flag to true
func (*ExternalServiceList) GetHealthClient ¶
func (e *ExternalServiceList) GetHealthClient(name, url string) *health.Client
GetHealthClient returns a healthclient for the provided URL
func (*ExternalServiceList) GetKafkaProducer ¶
func (e *ExternalServiceList) GetKafkaProducer(ctx context.Context, cfg *config.Config) (producer kafka.IProducer, err error)
GetKafkaProducer returns a kafka producer
func (*ExternalServiceList) GetMongoDB ¶
func (e *ExternalServiceList) GetMongoDB(ctx context.Context, cfg *config.Config) (api.MongoServer, error)
GetMongoDB creates a mongoDB client and sets the Mongo flag to true
func (*ExternalServiceList) GetResponder ¶
func (e *ExternalServiceList) GetResponder(ctx context.Context, cfg *config.Config) (*responder.Responder, error)
GetResponder returns rhe responder for handling responses in a generic way
func (*ExternalServiceList) GetS3Client ¶
func (e *ExternalServiceList) GetS3Client(ctx context.Context, cfg *config.Config) (api.S3Interface, error)
GetS3Uploaded creates a S3 client and sets the S3Uploaded flag to true
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{}
func (*Init) DoGetAuthorisationMiddleware ¶
func (e *Init) DoGetAuthorisationMiddleware(ctx context.Context, authorisationConfig *authorisation.Config) (authorisation.Middleware, error)
DoGetAuthorisationMiddleware creates authorisation middleware for the given config
func (*Init) DoGetFilesService ¶
DoGetFilesService returns a files service backend
func (*Init) DoGetGenerators ¶
DoGetGenerators 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) DoGetHealthClient ¶
DoGetHealthClient creates a new Health Client for the provided name and url
func (*Init) DoGetKafkaProducer ¶
DoGetKafkaProducer creates a kafka producer for the provided broker addresses, topic and envMax values in config
func (*Init) DoGetMongoDB ¶
DoGetMongoDB returns a MongoDB
func (*Init) DoGetResponder ¶
DoGetResponder creates the default responder
func (*Init) DoGetS3Client ¶
DoGetS3Uploaded returns a S3Client
type Initialiser ¶
type Initialiser interface {
DoGetHTTPServer(bindAddr string, router http.Handler) HTTPServer
DoGetMongoDB(ctx context.Context, cfg *config.Config) (api.MongoServer, error)
DoGetKafkaProducer(ctx context.Context, cfg *config.Config) (kafka.IProducer, error)
DoGetHealthClient(name, url string) *health.Client
DoGetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error)
DoGetS3Client(ctx context.Context, cfg *config.Config) (api.S3Interface, error)
DoGetAuthorisationMiddleware(ctx context.Context, authorisationConfig *authorisation.Config) (authorisation.Middleware, error)
DoGetGenerators() (data.Generator, data.Generator, data.Generator)
DoGetFilesService(ctx context.Context, cfg *config.Config) (api.FilesService, error)
DoGetResponder(ctx context.Context, cfg *config.Config) (*responder.Responder, error)
}
Initialiser defines the methods to initialise external services