Record Class AuditEvent

java.lang.Object
java.lang.Record
com.tnsai.security.audit.AuditEvent
Record Components:
id - unique event identifier
timestamp - when the event occurred
agentId - the agent that triggered the action
action - the action or tool name
decision - outcome: APPROVED, REJECTED, AUTO_APPROVED, TIMEOUT
approver - who made the decision: user, system, auto
context - additional key-value metadata
sessionId - the session in which the event occurred

public record AuditEvent(String id, Instant timestamp, String agentId, String action, String decision, String approver, Map<String,Object> context, String sessionId) extends Record
Immutable audit event recording a security-relevant decision.

Captures tool approval/rejection decisions, permission checks, and other security actions for compliance and forensic analysis.

  • Constructor Details

  • Method Details

    • builder

      public static AuditEvent.Builder builder()
      Creates a builder for constructing audit events.
      Returns:
      new builder
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • agentId

      public String agentId()
      Returns the value of the agentId record component.
      Returns:
      the value of the agentId record component
    • action

      public String action()
      Returns the value of the action record component.
      Returns:
      the value of the action record component
    • decision

      public String decision()
      Returns the value of the decision record component.
      Returns:
      the value of the decision record component
    • approver

      public String approver()
      Returns the value of the approver record component.
      Returns:
      the value of the approver record component
    • context

      public Map<String,Object> context()
      Returns the value of the context record component.
      Returns:
      the value of the context record component
    • sessionId

      public String sessionId()
      Returns the value of the sessionId record component.
      Returns:
      the value of the sessionId record component