services

package
v2.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApiVersion string

NOTE: these 2 vars are set during compilation in gitlab CI build (see Makefile)

View Source
var GitHash string

Functions

This section is empty.

Types

type APIServices

type APIServices struct {
	// Configuration read in on startup
	Config config.APIConfig

	// Default logger
	Log logger.ILogger

	// This is configured on startup to talk to the configured AWSCloudwatchRegion
	AWSSessionCW *session.Session

	// Anything talking to S3 should use this
	S3 s3iface.S3API

	SNS awsutil.SNSInterface

	// Anything accessing files should use this
	FS fileaccess.FileAccess

	// Validation of JWT tokens
	JWTReader IJWTReader

	// ID generator
	IDGen IDGenerator

	// URL signer for S3
	Signer URLSigner

	// Zip File Generator
	Exporter ExportZipper

	// Notification Handler
	Notifications notifications.NotificationManager

	// Timestamp retriever - so can be mocked for unit tests
	TimeStamper timestamper.ITimeStamper

	// Our mongo db connection
	Mongo *mongo.Client

	// "User DB"
	Users pixlUser.UserDetailsLookup

	// "Expression DB"
	Expressions expressionStorage.ExpressionDB
}

APIServices contains any services that HTTP handlers would want to use, like logging/config reading

func InitAPIServices

func InitAPIServices(cfg config.APIConfig, jwtReader IJWTReader, idGen IDGenerator, signer URLSigner, exporter ExportZipper) APIServices

InitAPIServices sets up a new APIServices instance

type ExportZipper

type ExportZipper interface {
	MakeExportFilesZip(*APIServices, string, string, string, string, string, []string, []string) ([]byte, error)
}

ExportZipper - Interface for creating an export zip file

type IDGenerator

type IDGenerator interface {
	GenObjectID() string
}

IDGenerator - Generates ID strings

type IJWTReader

type IJWTReader interface {
	GetUserInfo(*http.Request) (pixlUser.UserInfo, error)
}

IJWTReader - User ID getter from HTTP request

type MockIDGenerator added in v2.1.4

type MockIDGenerator struct {
	IDs []string
}

Here we really just expose some test helpers

func (*MockIDGenerator) GenObjectID added in v2.1.4

func (m *MockIDGenerator) GenObjectID() string

type URLSigner

type URLSigner interface {
	GetSignedURL(s3iface.S3API, string, string, time.Duration) (string, error)
}

URLSigner - Generates AWS S3 signed URLs

Jump to

Keyboard shortcuts

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