Documentation
¶
Index ¶
- type ExternalServiceList
- 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) GetImageAPIClient(cfg *config.Config) ImageAPIClient
- func (e *ExternalServiceList) GetKafkaConsumer(ctx context.Context, cfg *config.Config) (kafkaConsumer kafka.IConsumerGroup, err error)
- func (e *ExternalServiceList) GetVault(cfg *config.Config) (VaultClient, error)
- type HTTPServer
- type HealthChecker
- type ImageAPIClient
- type Init
- 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) DoGetImageAPIClient(imageAPIURL string) ImageAPIClient
- func (e *Init) DoGetKafkaConsumer(ctx context.Context, cfg *config.Config) (kafka.IConsumerGroup, error)
- func (e *Init) DoGetVault(vaultToken, vaultAddress string, retries int) (VaultClient, error)
- type Initialiser
- type Service
- type VaultClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExternalServiceList ¶
type ExternalServiceList struct { HealthCheck bool KafkaConsumerPublished bool Init Initialiser }
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) 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) GetImageAPIClient ¶ added in v0.3.0
func (e *ExternalServiceList) GetImageAPIClient(cfg *config.Config) ImageAPIClient
GetImageAPIClient creates a new image API client
func (*ExternalServiceList) GetKafkaConsumer ¶ added in v0.3.0
func (e *ExternalServiceList) GetKafkaConsumer(ctx context.Context, cfg *config.Config) (kafkaConsumer kafka.IConsumerGroup, err error)
GetKafkaConsumer returns a kafka consumer group
func (*ExternalServiceList) GetVault ¶ added in v0.3.0
func (e *ExternalServiceList) GetVault(cfg *config.Config) (VaultClient, error)
GetVault creates a new vault client
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 ImageAPIClient ¶ added in v0.3.0
type ImageAPIClient interface {
Checker(ctx context.Context, state *healthcheck.CheckState) error
}
ImageAPIClient defines the required methods from dp-api-clients-go ImageAPI
type Init ¶
type Init struct{}
Init implements the Initialiser interface to initialise dependencies
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) DoGetImageAPIClient ¶ added in v0.3.0
func (e *Init) DoGetImageAPIClient(imageAPIURL string) ImageAPIClient
DoGetImageAPIClient creates a new image api client using dp-api-clients-go library
func (*Init) DoGetKafkaConsumer ¶ added in v0.3.0
func (e *Init) DoGetKafkaConsumer(ctx context.Context, cfg *config.Config) (kafka.IConsumerGroup, error)
DoGetKafkaConsumer creates a new Kafka Consumer Group using dp-kafka library
func (*Init) DoGetVault ¶ added in v0.3.0
func (e *Init) DoGetVault(vaultToken, vaultAddress string, retries int) (VaultClient, error)
DoGetVault creates a new vault client using dp-vault library
type Initialiser ¶
type Initialiser interface { DoGetHTTPServer(bindAddr string, router http.Handler) HTTPServer DoGetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error) DoGetVault(vaultToken, vaultAddress string, retries int) (VaultClient, error) DoGetImageAPIClient(imageAPIURL string) ImageAPIClient DoGetKafkaConsumer(ctx context.Context, cfg *config.Config) (kafka.IConsumerGroup, error) }
Initialiser defines the methods to initialise external services
type Service ¶
type Service struct { Config *config.Config Server HTTPServer Router *mux.Router API *api.API ServiceList *ExternalServiceList HealthCheck HealthChecker VaultCli VaultClient ImageAPICli ImageAPIClient KafkaConsumer kafka.IConsumerGroup }
Service contains all the configs, server and clients to run the Image API
type VaultClient ¶ added in v0.3.0
type VaultClient interface {
Checker(ctx context.Context, state *healthcheck.CheckState) error
}
VaultClient defines the required methods from dp-vault client