event

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageAPIClient added in v0.7.0

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)
	GetDownloadVariant(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, imageID, variant string) (m image.ImageDownload, err 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 ImagePublished

type ImagePublished struct {
	SrcPath      string `avro:"src_path"`
	DstPath      string `avro:"dst_path"`
	ImageID      string `avro:"image_id"`
	ImageVariant string `avro:"image_variant"`
}

ImagePublished provides an avro structure for an image published event

type ImagePublishedHandler

type ImagePublishedHandler struct {
	AuthToken       string
	S3Public        S3Writer
	S3Private       S3Reader
	ImageAPICli     ImageAPIClient
	PublicBucketURL string
}

ImagePublishedHandler hold the details for publishing to s3.

func (*ImagePublishedHandler) Handle

func (h *ImagePublishedHandler) Handle(ctx context.Context, event *ImagePublished) error

Handle takes a single event. It moves the file from the private S3 bucket, and writes it to the public static bucket.

func (*ImagePublishedHandler) KafkaHandler added in v1.3.0

func (h *ImagePublishedHandler) KafkaHandler(ctx context.Context, msgs []kafka.Message) error

type S3Reader added in v0.7.0

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 added in v0.7.0

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL