@@ -35,14 +35,17 @@ type noopWrapper struct {
3535 backend * NoopAudit
3636}
3737
38- // NoopAuditEventListener is a callback used by noopWrapper.Process() to notify
39- // of each received audit event .
40- type NoopAuditEventListener func ( * AuditEvent )
41-
42- func (n * NoopAudit ) SetListener (listener NoopAuditEventListener ) {
38+ // SetListener provides a callback func to the NoopAudit which can be invoked
39+ // during processing of the Event .
40+ //
41+ // Deprecated: SetListener should not be used in new tests.
42+ func (n * NoopAudit ) SetListener (listener func ( event * Event ) ) {
4343 n .listener = listener
4444}
4545
46+ // NoopAudit only exists to allow legacy tests to continue working.
47+ //
48+ // Deprecated: NoopAudit should not be used in new tests.
4649type NoopAudit struct {
4750 Config * BackendConfig
4851
@@ -68,16 +71,16 @@ type NoopAudit struct {
6871 nodeIDList []eventlogger.NodeID
6972 nodeMap map [eventlogger.NodeID ]eventlogger.Node
7073
71- listener NoopAuditEventListener
74+ listener func ( event * Event )
7275}
7376
74- // NoopHeaderFormatter can be used within no-op audit devices to do nothing when
77+ // noopHeaderFormatter can be used within no-op audit devices to do nothing when
7578// it comes to only allow configured headers to appear in the result.
7679// Whatever is passed in will be returned (nil becomes an empty map) in lowercase.
77- type NoopHeaderFormatter struct {}
80+ type noopHeaderFormatter struct {}
7881
79- // ApplyConfig implements the relevant interface to make NoopHeaderFormatter an HeaderFormatter.
80- func (f * NoopHeaderFormatter ) ApplyConfig (_ context.Context , headers map [string ][]string , _ Salter ) (result map [string ][]string , retErr error ) {
82+ // ApplyConfig implements the relevant interface to make noopHeaderFormatter an HeaderFormatter.
83+ func (f * noopHeaderFormatter ) ApplyConfig (_ context.Context , headers map [string ][]string , _ Salter ) (result map [string ][]string , retErr error ) {
8184 if len (headers ) < 1 {
8285 return map [string ][]string {}, nil
8386 }
@@ -95,6 +98,8 @@ func (f *NoopHeaderFormatter) ApplyConfig(_ context.Context, headers map[string]
9598// NewNoopAudit should be used to create a NoopAudit as it handles creation of a
9699// predictable salt and wraps eventlogger nodes so information can be retrieved on
97100// what they've seen or formatted.
101+ //
102+ // Deprecated: NewNoopAudit only exists to allow legacy tests to continue working.
98103func NewNoopAudit (config * BackendConfig ) (* NoopAudit , error ) {
99104 view := & logical.InmemStorage {}
100105
@@ -122,7 +127,7 @@ func NewNoopAudit(config *BackendConfig) (*NoopAudit, error) {
122127 nodeMap : make (map [eventlogger.NodeID ]eventlogger.Node , 2 ),
123128 }
124129
125- cfg , err := newFormatterConfig (& NoopHeaderFormatter {}, nil )
130+ cfg , err := newFormatterConfig (& noopHeaderFormatter {}, nil )
126131 if err != nil {
127132 return nil , err
128133 }
@@ -158,6 +163,8 @@ func NewNoopAudit(config *BackendConfig) (*NoopAudit, error) {
158163// NoopAuditFactory should be used when the test needs a way to access bytes that
159164// have been formatted by the pipeline during audit requests.
160165// The records parameter will be repointed to the one used within the pipeline.
166+ //
167+ // Deprecated: NoopAuditFactory only exists to allow legacy tests to continue working.
161168func NoopAuditFactory (records * * [][]byte ) Factory {
162169 return func (config * BackendConfig , _ HeaderFormatter ) (Backend , error ) {
163170 n , err := NewNoopAudit (config )
@@ -184,7 +191,7 @@ func (n *noopWrapper) Process(ctx context.Context, e *eventlogger.Event) (*event
184191 var err error
185192
186193 // We're expecting audit events since this is an audit device.
187- a , ok := e .Payload .(* AuditEvent )
194+ a , ok := e .Payload .(* Event )
188195 if ! ok {
189196 return nil , errors .New ("cannot parse payload as an audit event" )
190197 }
@@ -244,7 +251,7 @@ func (n *noopWrapper) Process(ctx context.Context, e *eventlogger.Event) (*event
244251 // formatted headers that would have made it to the logs via the sink node.
245252 // They only appear in requests.
246253 if a .Subtype == RequestType {
247- reqEntry := & Entry {}
254+ reqEntry := & entry {}
248255 err = json .Unmarshal (b , & reqEntry )
249256 if err != nil {
250257 return nil , fmt .Errorf ("unable to parse formatted audit entry data: %w" , err )
@@ -336,6 +343,7 @@ func (n *NoopAudit) IsFallback() bool {
336343 return false
337344}
338345
346+ // Deprecated: TestNoopAudit only exists to allow legacy tests to continue working.
339347func TestNoopAudit (t * testing.T , path string , config map [string ]string ) * NoopAudit {
340348 cfg := & BackendConfig {
341349 Config : config ,
0 commit comments