org.graylog2.audit.AuditEventType Maven / Gradle / Ivy
/**
* This file is part of Graylog.
*
* Graylog is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Graylog is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Graylog. If not, see .
*/
package org.graylog2.audit;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import javax.annotation.Nonnull;
import java.util.List;
import static org.elasticsearch.common.Strings.isNullOrEmpty;
/**
* Represents an audit event with namespace, object and action.
*
* Plugins should use their own namespace for audit events.
*
* The {@link #create(String)} method expects an event type string with the following format:
*
* {@code namespace:object:action}
*
* Examples:
*
* {@code server:message_input:create}
* {@code pipeline-processor:configuration:update}
*/
@JsonAutoDetect
@AutoValue
public abstract class AuditEventType {
private static final String FIELD_NAMESPACE = "namespace";
private static final String FIELD_OBJECT = "object";
private static final String FIELD_ACTION = "action";
private static final String ARGUMENT_ERROR = "Type string needs to be in the following format: :