Package com.tnsai.security.audit
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".
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaction()Returns the value of theactionrecord component.agentId()Returns the value of theagentIdrecord component.static AuditQueryall()Creates a query that matches all events.static AuditQuery.Builderbuilder()Creates a builder for constructing queries.decision()Returns the value of thedecisionrecord component.final booleanIndicates whether some other object is "equal to" this one.from()Returns the value of thefromrecord component.final inthashCode()Returns a hash code value for this object.intlimit()Returns the value of thelimitrecord component.booleanmatches(AuditEvent event) Tests whether an event matches this query.Returns the value of thesessionIdrecord component.to()Returns the value of thetorecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
AuditQuery
public AuditQuery(String agentId, String action, String decision, String sessionId, Instant from, Instant to, int limit) Creates an instance of aAuditQueryrecord class.- Parameters:
agentId- the value for theagentIdrecord componentaction- the value for theactionrecord componentdecision- the value for thedecisionrecord componentsessionId- the value for thesessionIdrecord componentfrom- the value for thefromrecord componentto- the value for thetorecord componentlimit- the value for thelimitrecord component
-
-
Method Details
-
all
Creates a query that matches all events.- Returns:
- query matching everything
-
builder
Creates a builder for constructing queries.- Returns:
- new builder
-
matches
Tests whether an event matches this query.- Parameters:
event- the event to test- Returns:
- true if the event matches all non-null criteria
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
agentId
Returns the value of theagentIdrecord component.- Returns:
- the value of the
agentIdrecord component
-
action
Returns the value of theactionrecord component.- Returns:
- the value of the
actionrecord component
-
decision
Returns the value of thedecisionrecord component.- Returns:
- the value of the
decisionrecord component
-
sessionId
Returns the value of thesessionIdrecord component.- Returns:
- the value of the
sessionIdrecord component
-
from
Returns the value of thefromrecord component.- Returns:
- the value of the
fromrecord component
-
to
Returns the value of thetorecord component.- Returns:
- the value of the
torecord component
-
limit
public int limit()Returns the value of thelimitrecord component.- Returns:
- the value of the
limitrecord component
-