Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler interface {
Handle(ctx context.Context, ImageUploaded *ImageUploaded) error
}
Handler represents a handler for processing a single event.
type ImageAPIClient ¶
type ImageAPIClient interface { Checker(ctx context.Context, state *healthcheck.CheckState) error GetImage(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, imageID string) (image.Image, error) PutImage(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, imageID string, data image.Image) (image.Image, error) PostDownloadVariant(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, imageID string, data image.NewImageDownload) (image.ImageDownload, error) PutDownloadVariant(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, imageID, variant string, data image.ImageDownload) (image.ImageDownload, error) }
ImageAPIClient defines the required methods from image API client
type ImageUploaded ¶
type ImageUploaded struct { Path string `avro:"path"` ImageID string `avro:"image_id"` Filename string `avro:"filename"` }
ImageUploaded provides an avro structure for an image uploaded event
type ImageUploadedHandler ¶
type ImageUploadedHandler struct { AuthToken string S3Upload S3Reader S3Private S3Writer ImageCli ImageAPIClient DownloadServiceURL string }
ImageUploadedHandler ...
func (*ImageUploadedHandler) Handle ¶
func (h *ImageUploadedHandler) Handle(ctx context.Context, event *ImageUploaded) (err error)
Handle takes a single event. From the uploaded S3 bucket, it writes it to the private bucket. It also calls the API to create a new download variant and to update it after the variant has been imported.
type S3Reader ¶
type S3Reader interface { Checker(ctx context.Context, state *healthcheck.CheckState) error Session() *session.Session BucketName() string Get(key string) (io.ReadCloser, *int64, error) }
S3Reader defines the required methods from dp-s3 to read data to an AWS S3 Bucket
type S3Writer ¶
type S3Writer interface { Checker(ctx context.Context, state *healthcheck.CheckState) error Session() *session.Session BucketName() string Upload(input *s3manager.UploadInput, options ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error) }
S3Writer defines the required methods from dp-s3 to interact with a particular bucket of AWS S3
Click to show internal directories.
Click to hide internal directories.