Documentation ¶
Index ¶
- func AllWorkers() []string
- func BuildTestLambdaWorker() awsConfigV1Worker
- func BuildTestLambdaWorkerWithName(name string) awsConfigV1Worker
- func BuildTestWebWorker() webConfigV1Worker
- func MkRIEURL(lambdaName string) string
- func SendEvidenceCreatedEvent(db *database.Connection, reqLogger logging.Logger, operationID int64, ...) error
- func SendServiceWorkerEvent(db *database.Connection, input SendServiceWorkerEventInput)
- func SetNotifyWorkersRunForTest(notifier chan<- bool)
- func SetTestLambdaClient(client LambdaInvokableClient)
- func SetWebRequestFunctionForWorker(workerName string, fn *RequestFn)
- type AWSConfigV1
- type BasicServiceWorkerConfig
- type ExpandedNewEvidencePayload
- func BatchBuildNewEvidencePayload(ctx context.Context, db database.ConnectionProxy, operationID int64, ...) ([]ExpandedNewEvidencePayload, error)
- func BatchBuildNewEvidencePayloadForAllEvidence(ctx context.Context, db database.ConnectionProxy, operationID int64) ([]ExpandedNewEvidencePayload, error)
- func BatchBuildNewEvidencePayloadFromUUIDs(ctx context.Context, db database.ConnectionProxy, operationID int64, ...) ([]ExpandedNewEvidencePayload, error)
- type LambdaInvokableClient
- type LambdaRIEClient
- type LambdaResponse
- type NewEvidencePayload
- type ProcessResponse
- type RequestFn
- type SendServiceWorkerEventInput
- type ServiceTestResult
- type ServiceWorker
- type TestResp
- type WebConfigV1
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllWorkers ¶
func AllWorkers() []string
AllWorkers is an effective constant representing all possible workers (not deleted)
func BuildTestLambdaWorker ¶
func BuildTestLambdaWorker() awsConfigV1Worker
BuildTestLambdaWorker provides a way to conduct unit tests. This function creates a canned worker suitable for immediate use. Not intended for regular use
func BuildTestLambdaWorkerWithName ¶
func BuildTestLambdaWorkerWithName(name string) awsConfigV1Worker
BuildTestLambdaWorkerWithName provides a way to conduct unit tests. This function creates a canned worker suitable for immediate use, of the provided name. Not intended for regular use
func BuildTestWebWorker ¶
func BuildTestWebWorker() webConfigV1Worker
func SendEvidenceCreatedEvent ¶
func SendEvidenceCreatedEvent(db *database.Connection, reqLogger logging.Logger, operationID int64, evidenceUUIDs []string, workerNames []string) error
SendEvidenceCreatedEvent starts a specified set of workers for a specified set of evidenceUUIDs Note that this process kicks off a number of goroutines.
func SendServiceWorkerEvent ¶
func SendServiceWorkerEvent(db *database.Connection, input SendServiceWorkerEventInput)
func SetNotifyWorkersRunForTest ¶
func SetNotifyWorkersRunForTest(notifier chan<- bool)
func SetTestLambdaClient ¶
func SetTestLambdaClient(client LambdaInvokableClient)
SetTestLambdaClient provides a way to conduct unit tests. Not intended for regular use
Types ¶
type AWSConfigV1 ¶
type AWSConfigV1 struct { BasicServiceWorkerConfig LambdaName string `json:"lambdaName"` AsyncFn bool `json:"asyncFunction"` }
type ExpandedNewEvidencePayload ¶
type ExpandedNewEvidencePayload struct { NewEvidencePayload EvidenceID int64 `db:"id"` }
func BatchBuildNewEvidencePayload ¶
func BatchBuildNewEvidencePayload(ctx context.Context, db database.ConnectionProxy, operationID int64, evidenceUUIDs []string) ([]ExpandedNewEvidencePayload, error)
BatchBuildNewEvidencePayload creates a set of payloads for the given operation and evidence uuids. This function provides convenience over the alternatives: BatchBuildNewEvidencePayloadFromUUIDs and BatchBuildNewEvidencePayloadForAllEvidence. Note that if no evidenceUUIDs are provided, then all evidence is chosen for the indicated operation.
func BatchBuildNewEvidencePayloadForAllEvidence ¶
func BatchBuildNewEvidencePayloadForAllEvidence(ctx context.Context, db database.ConnectionProxy, operationID int64) ([]ExpandedNewEvidencePayload, error)
BatchBuildNewEvidencePayloadForAllEvidence creates a set of payloads, ordered by evidence ID, for all evidence in an operation. Also see BatchBuildNewEvidencePayload, which allows for specifying a subset of evidence uuids
func BatchBuildNewEvidencePayloadFromUUIDs ¶
func BatchBuildNewEvidencePayloadFromUUIDs(ctx context.Context, db database.ConnectionProxy, operationID int64, evidenceUUIDs []string) ([]ExpandedNewEvidencePayload, error)
BatchBuildNewEvidencePayloadFromUUIDs creates a set of payloads, ordered by evidence ID, for the given operationID and evidenceUUIDs. If the list of uuids is empty, then _no payloads will be returned_. Also see BatchBuildNewEvidencePayload, which allows for getting all evidence if no uuids are specified
type LambdaInvokableClient ¶
type LambdaInvokableClient interface { // Invoke(input *lambda.InvokeInput) (*lambda.InvokeOutput, error) Invoke(ctx context.Context, params *lambda.InvokeInput, optFns ...func(*lambda.Options)) (*lambda.InvokeOutput, error) }
func NewTestRIELambdaClient ¶
func NewTestRIELambdaClient(fn RequestFn) LambdaInvokableClient
NewTestRIELambdaClient creates an instance of LambdaInvokableClient that can be used for unit testing
type LambdaRIEClient ¶
type LambdaRIEClient struct {
// contains filtered or unexported fields
}
func (LambdaRIEClient) Invoke ¶
func (l LambdaRIEClient) Invoke(ctx context.Context, input *lambda.InvokeInput, optFns ...func(*lambda.Options)) (*lambda.InvokeOutput, error)
Invoke mimics the aws Lambda function of the same name. This is useful for development testing without incurring AWS fees
type LambdaResponse ¶
type NewEvidencePayload ¶
type NewEvidencePayload struct { Type string `json:"type" db:"type"` EvidenceUUID string `json:"evidenceUuid" db:"uuid"` OperationSlug string `json:"operationSlug" db:"operation_slug"` ContentType string `json:"contentType" db:"content_type"` GlobalVariables []dtos.GlobalVar `json:"globalVariables"` OperationVars []dtos.OperationVar `json:"operationVariables"` }
type ProcessResponse ¶
type ServiceTestResult ¶
type ServiceTestResult struct { // Message contains helpful text detailing _why_ there was a failure Message string // Live indicates if the service is available or not Live bool // Error indicates if there was some fundamental error that prevented a full test Error error }
ServiceTestResult provides a view of a Worker test
func TestServiceWorker ¶
func TestServiceWorker(workerData models.ServiceWorker) ServiceTestResult
TestServiceWorker contacts the indicated worker to verify that it's running
type ServiceWorker ¶
type ServiceWorker interface { Build(workerName string, config []byte) error Test() ServiceTestResult ProcessMetadata(evidenceID int64, payload *NewEvidencePayload) (*models.EvidenceMetadata, error) ProcessEvent(payload interface{}) error }
type WebConfigV1 ¶
type WebConfigV1 struct { BasicServiceWorkerConfig URL string `json:"url"` Headers map[string]string `json:"headers"` }