Documentation
¶
Index ¶
- type ExternalServiceList
- func (e *ExternalServiceList) GetFilesService(ctx context.Context, cfg *config.Config) file.FilesService
- 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) event.ImageAPIClient
- func (e *ExternalServiceList) GetKafkaFilePublishedConsumer(ctx context.Context, cfg *config.Config) (KafkaConsumer, error)
- func (e *ExternalServiceList) GetKafkaImagePublishedConsumer(ctx context.Context, cfg *config.Config) (KafkaConsumer, error)
- func (e *ExternalServiceList) GetS3Client(cfg *config.Config, bucketName string) (file.S3Client, error)
- func (e *ExternalServiceList) GetS3Clients(cfg *config.Config) (s3Private, s3Public file.S3Client, err error)
- type HTTPServer
- type HealthChecker
- type Init
- func (e *Init) DoGetFilesService(_ context.Context, cfg *config.Config) file.FilesService
- 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(cfg *config.Config) event.ImageAPIClient
- func (e *Init) DoGetKafkaFilePublishedConsumer(ctx context.Context, cfg *config.Config) (KafkaConsumer, error)
- func (e *Init) DoGetKafkaImagePublishedConsumer(ctx context.Context, cfg *config.Config) (KafkaConsumer, error)
- func (e *Init) DoGetKafkaTopicConsumer(ctx context.Context, cfg *config.Config, topic string) (KafkaConsumer, error)
- func (e *Init) DoGetS3Client(awsRegion, bucketName string) (file.S3Client, error)
- func (e *Init) DoGetS3ClientWithSession(bucketName string, s *session.Session) (file.S3Client, error)
- type Initialiser
- type KafkaConsumer
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExternalServiceList ¶
type ExternalServiceList struct { ImageAPI bool FilesService bool HealthCheck bool KafkaImagePublishedConsumer bool KafkaFilePublishedConsumer bool S3Private bool S3Public bool S3Client 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) GetFilesService ¶ added in v1.3.0
func (e *ExternalServiceList) GetFilesService(ctx context.Context, cfg *config.Config) file.FilesService
GetFilesService creates files service and sets the FilesService flag to true
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) event.ImageAPIClient
GetImageAPIClient creates an ImageAPI client and sets the ImageAPI flag to true
func (*ExternalServiceList) GetKafkaFilePublishedConsumer ¶ added in v1.3.0
func (e *ExternalServiceList) GetKafkaFilePublishedConsumer(ctx context.Context, cfg *config.Config) (KafkaConsumer, error)
GetKafkaFilePublishedConsumer creates a Kafka consumer and sets the consumer flag to true
func (*ExternalServiceList) GetKafkaImagePublishedConsumer ¶ added in v1.3.0
func (e *ExternalServiceList) GetKafkaImagePublishedConsumer(ctx context.Context, cfg *config.Config) (KafkaConsumer, error)
GetKafkaImagePublishedConsumer creates a Kafka consumer and sets the consumer flag to true
func (*ExternalServiceList) GetS3Client ¶ added in v1.4.1
func (e *ExternalServiceList) GetS3Client(cfg *config.Config, bucketName string) (file.S3Client, error)
GetS3Client returns S3 clients private and public. They share the same AWS session.
func (*ExternalServiceList) GetS3Clients ¶ added in v0.4.0
func (e *ExternalServiceList) GetS3Clients(cfg *config.Config) (s3Private, s3Public file.S3Client, err error)
GetS3Clients returns S3 clients private and public. They share the same AWS session.
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) DoGetFilesService ¶ added in v1.3.0
DoGetFilesService returns a files service backend
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(cfg *config.Config) event.ImageAPIClient
DoGetImageAPIClient returns an Image API client
func (*Init) DoGetKafkaFilePublishedConsumer ¶ added in v1.3.0
func (*Init) DoGetKafkaImagePublishedConsumer ¶ added in v1.3.0
func (e *Init) DoGetKafkaImagePublishedConsumer(ctx context.Context, cfg *config.Config) (KafkaConsumer, error)
DoGetKafkaImagePublishedConsumer returns a Kafka Consumer group
func (*Init) DoGetKafkaTopicConsumer ¶ added in v1.3.0
func (*Init) DoGetS3Client ¶ added in v0.4.0
func (*Init) DoGetS3ClientWithSession ¶ added in v0.7.0
func (e *Init) DoGetS3ClientWithSession(bucketName string, s *session.Session) (file.S3Client, error)
DoGetS3ClientWithSession creates a new S3Client (extension of S3Client with Upload operations) for the provided bucket name, using an existing AWS session
type Initialiser ¶
type Initialiser interface { DoGetHTTPServer(bindAddr string, router http.Handler) HTTPServer DoGetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error) DoGetImageAPIClient(cfg *config.Config) event.ImageAPIClient DoGetKafkaImagePublishedConsumer(ctx context.Context, cfg *config.Config) (KafkaConsumer, error) DoGetKafkaFilePublishedConsumer(ctx context.Context, cfg *config.Config) (KafkaConsumer, error) DoGetS3Client(awsRegion, bucketName string) (file.S3Client, error) DoGetS3ClientWithSession(bucketName string, s *session.Session) (file.S3Client, error) DoGetFilesService(ctx context.Context, cfg *config.Config) file.FilesService }
Initialiser defines the methods to initialise external services
type KafkaConsumer ¶ added in v0.7.0
type Service ¶
type Service struct { Config *config.Config Server HTTPServer Router *mux.Router ServiceList *ExternalServiceList HealthCheck HealthChecker ImageAPICli event.ImageAPIClient KafkaImagePublishedConsumer KafkaConsumer KafkaFilePublishedConsumer KafkaConsumer S3Public event.S3Writer S3Private event.S3Reader FilesClient file.FilesService }
Service contains all the configs, server and clients to run the Image API