Record Class AuditQuery

java.lang.Object
java.lang.Record
com.tnsai.security.audit.AuditQuery
Record Components:
agentId - filter by agent ID (null = all agents)
action - filter by action/tool name (null = all actions)
decision - filter by decision (null = all decisions)
sessionId - filter by session ID (null = all sessions)
from - start of time range inclusive (null = no lower bound)
to - end of time range exclusive (null = no upper bound)
limit - maximum number of results (0 = unlimited)

public record AuditQuery(String agentId, String action, String decision, String sessionId, Instant from, Instant to, int limit) extends Record
Query criteria for filtering audit events.

All fields are optional. A null field means "no filter on this dimension".

  • Constructor Details

    • AuditQuery

      public AuditQuery(String agentId, String action, String decision, String sessionId, Instant from, Instant to, int limit)
      Creates an instance of a AuditQuery record class.
      Parameters:
      agentId - the value for the agentId record component
      action - the value for the action record component
      decision - the value for the decision record component
      sessionId - the value for the sessionId record component
      from - the value for the from record component
      to - the value for the to record component
      limit - the value for the limit record component
  • Method Details

    • all

      public static AuditQuery all()
      Creates a query that matches all events.
      Returns:
      query matching everything
    • builder

      public static AuditQuery.Builder builder()
      Creates a builder for constructing queries.
      Returns:
      new builder
    • matches

      public boolean matches(AuditEvent event)
      Tests whether an event matches this query.
      Parameters:
      event - the event to test
      Returns:
      true if the event matches all non-null criteria
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • 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
    • sessionId

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

      public Instant from()
      Returns the value of the from record component.
      Returns:
      the value of the from record component
    • to

      public Instant to()
      Returns the value of the to record component.
      Returns:
      the value of the to record component
    • limit

      public int limit()
      Returns the value of the limit record component.
      Returns:
      the value of the limit record component