Documentation
¶
Overview ¶
Services used by API endpoint handlers and other bits of code. This is a collection of common things needed by code, such as:
- Access to an instance of logger
- AWS S3 API
- The current Mongo DB connection
- Facilities to send user notifications
- API configuration
among others
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ApiVersion string
NOTE: these 2 vars are set during compilation in 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
// Anything talking to S3 should use this
S3 s3iface.S3API
// AWS SNS - At time of writing used for triggering Data Import lambda (it gets triggered by SNS
// from iSDS pipeline, so we also trigger it the same way) and sending email alerts
SNS awsutil.SNSInterface
// AWS SQS - At time of writing used for triggering Image Coreg importing lambda
SQS awsutil.SQSInterface
// Anything accessing files should use this
FS fileaccess.FileAccess
// Validation of JWT tokens
JWTReader jwtparser.IJWTReader
// ID generator
IDGen idgen.IDGenerator
// Timestamp retriever - so can be mocked for unit tests
TimeStamper timestamper.ITimeStamper
// Our mongo db connection
MongoDB *mongo.Database
// And how we connected to it (so we can run mongodump later if needed)
MongoDetails mongoDBConnection.MongoConnectionDetails
Notifier INotifier
// The unique identifier of this API instance (so we can log/debug issues that are cross-instance!)
InstanceId string
}
type INotifier ¶
type INotifier interface {
// When a scan downlinks, or is uploaded by a user
NotifyNewScan(scanName string, scanId string)
// When a scan import is re-triggered
NotifyUpdatedScan(scanName string, scanId string)
// When a scan is deleted, or its metadata edited
// NOTE: This does NOT send emails, it's of system-level interest only so UI can update caches as required
SysNotifyScanChanged(scanId string)
// When an ROI has changed
SysNotifyROIChanged(roiId string)
// When a map (created by client library saveMapData function) has changed
SysNotifyMapChanged(mapId string)
// When an image is added to a scan
NotifyNewScanImage(scanName string, scanId string, imageName string)
// When an image is deleted, or set as default, or had its metadata changed
// NOTE: This does NOT send emails, it's of system-level interest only so UI can update caches as required
SysNotifyScanImagesChanged(imageName string, scanIds []string)
// When a quant is completed or uploaded
NotifyNewQuant(uploaded bool, quantId string, quantName string, status string, scanName string, scanId string)
// When a quant is deleted
// NOTE: This does NOT send emails, it's of system-level interest only so UI can update caches as required
SysNotifyQuantChanged(quantId string)
NotifyObjectShared(objectType string, objectId string, objectName, sharerName string)
// When a user sends a message to the group they belong to
NotifyUserGroupMessage(subject string, message string, notificationType protos.NotificationType, actionLink string, groupId string, groupName string, sender string)
// Sending a message to a list of users, eg when sending out notifications to an admin group
NotifyUserMessage(subject string, message string, notificationType protos.NotificationType, actionLink string, requestorUserId string, destUserIds []string, sender string)
}
Click to show internal directories.
Click to hide internal directories.