Search in sources :

Example 1 with AuditLogContext

use of org.apache.cassandra.audit.AuditLogContext in project cassandra by apache.

the class SchemaAnnouncementEvent method toMap.

public Map<String, Serializable> toMap() {
    HashMap<String, Serializable> ret = new HashMap<>();
    if (schemaDestinationEndpoints != null) {
        Set<String> eps = schemaDestinationEndpoints.stream().map(Object::toString).collect(Collectors.toSet());
        ret.put("endpointDestinations", new HashSet<>(eps));
    }
    if (schemaEndpointsIgnored != null) {
        Set<String> eps = schemaEndpointsIgnored.stream().map(Object::toString).collect(Collectors.toSet());
        ret.put("endpointIgnored", new HashSet<>(eps));
    }
    if (statement != null) {
        AuditLogContext logContext = statement.getAuditLogContext();
        if (logContext != null) {
            HashMap<String, String> log = new HashMap<>();
            if (logContext.auditLogEntryType != null)
                log.put("type", logContext.auditLogEntryType.name());
            if (logContext.keyspace != null)
                log.put("keyspace", logContext.keyspace);
            if (logContext.scope != null)
                log.put("table", logContext.scope);
            ret.put("statement", log);
        }
    }
    if (sender != null)
        ret.put("sender", sender.toString());
    return ret;
}
Also used : Serializable(java.io.Serializable) AuditLogContext(org.apache.cassandra.audit.AuditLogContext) HashMap(java.util.HashMap)

Aggregations

Serializable (java.io.Serializable)1 HashMap (java.util.HashMap)1 AuditLogContext (org.apache.cassandra.audit.AuditLogContext)1