// emitSessionEndEventFn returns function that uses the provided emitter to
// emit an audit event when database session ends.
emitSessionEndEventFn returns function that uses the provided emitter to
emit an audit event when database session ends.
// emitSessionEndEventFn returns function that uses the provided emitter to // emit an audit event when database session ends .
func (s *Server) emitSessionEndEventFn(streamWriter libevents.StreamWriter) func(session.Context) error {
	return func(session session.Context) error {
		return streamWriter.EmitAuditEvent(s.closeContext, &events.DatabaseSessionEnd{
			Metadata: events.Metadata{
				Type: libevents.DatabaseSessionEndEvent,
				Code: libevents.DatabaseSessionEndCode,
			},
			UserMetadata: events.UserMetadata{
				User: session.Identity.Username,
			},
			SessionMetadata: events.SessionMetadata{
				SessionID: session.ID,
			},
			DatabaseMetadata: events.DatabaseMetadata{
				DatabaseService:  session.Server.GetName(),
				DatabaseProtocol: session.Server.GetProtocol(),
				DatabaseURI:      session.Server.GetURI(),
				DatabaseName:     session.DatabaseName,
				DatabaseUser:     session.DatabaseUser,
			},
		})
	}
}
func ( s * Server ) emitSessionEndEventFn ( streamWriter libevents . StreamWriter ) func ( session . Context ) error { return func ( session session . Context ) error { return streamWriter . EmitAuditEvent ( s . closeContext , & events . DatabaseSessionEnd { Metadata : events . Metadata { Type : libevents . DatabaseSessionEndEvent , Code : libevents . DatabaseSessionEndCode , } , UserMetadata : events . UserMetadata { User : session . Identity . Username , } , SessionMetadata : events . SessionMetadata { SessionID : session . ID , } , DatabaseMetadata : events . DatabaseMetadata { DatabaseService : session . Server . GetName ( ) , DatabaseProtocol : session . Server . GetProtocol ( ) , DatabaseURI : session . Server . GetURI ( ) , DatabaseName : session . DatabaseName , DatabaseUser : session . DatabaseUser , } , } ) } }
emitSessionEndEventFn returns function that uses the provided emitter to
emit an audit event when database session ends.
emitSessionEndEventFn returns function that uses the provided emitter to emit an audit event when database session ends .