
org.testifyproject.github.dockerjava.api.model.LogConfig Maven / Gradle / Ivy
package org.testifyproject.testifyproject.github.dockerjava.api.model;
import java.org.testifyproject.testifyproject.IOException;
import java.util.Map;
import org.testifyproject.testifyproject.fasterxml.jackson.annotation.JsonIgnore;
import org.testifyproject.testifyproject.fasterxml.jackson.annotation.JsonProperty;
import org.testifyproject.testifyproject.fasterxml.jackson.core.JsonGenerator;
import org.testifyproject.testifyproject.fasterxml.jackson.core.JsonParser;
import org.testifyproject.testifyproject.fasterxml.jackson.core.JsonProcessingException;
import org.testifyproject.testifyproject.fasterxml.jackson.core.ObjectCodec;
import org.testifyproject.testifyproject.fasterxml.jackson.databind.DeserializationContext;
import org.testifyproject.testifyproject.fasterxml.jackson.databind.JsonDeserializer;
import org.testifyproject.testifyproject.fasterxml.jackson.databind.JsonNode;
import org.testifyproject.testifyproject.fasterxml.jackson.databind.JsonSerializer;
import org.testifyproject.testifyproject.fasterxml.jackson.databind.SerializerProvider;
import org.testifyproject.testifyproject.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.testifyproject.testifyproject.fasterxml.jackson.databind.annotation.JsonSerialize;
/**
* Log driver to use for a created/running container. The available types are:
*
* json-file (org.testifyproject.testifyprojectfault) syslog journald none
*
* If a driver is specified that is NOT supported,docker will org.testifyproject.testifyprojectfault to null. If configs are supplied that are not supported by the type
* docker will ignore them. In most cases setting the config option to null will suffice. Consult the docker remote API for a more org.testifyproject.testifyprojecttailed
* and up-to-date explanation of the available types and their options.
*/
public class LogConfig {
@JsonProperty("Type")
public LoggingType type = null;
@JsonProperty("Config")
public Map config;
public LogConfig(LoggingType type, Map config) {
this.type = type;
this.config = config;
}
public LogConfig(LoggingType type) {
this(type, null);
}
public LogConfig() {
}
public LoggingType getType() {
return type;
}
public LogConfig setType(LoggingType type) {
this.type = type;
return this;
}
@JsonIgnore
public Map getConfig() {
return config;
}
@JsonIgnore
public LogConfig setConfig(Map config) {
this.config = config;
return this;
}
@JsonDeserialize(using = LoggingType.Deserializer.class)
@JsonSerialize(using = LoggingType.Serializer.class)
public enum LoggingType {
DEFAULT("json-file"),
JSON_FILE("json-file"),
NONE("none"),
SYSLOG("syslog"),
JOURNALD("journald"),
GELF("gelf"),
FLUENTD("fluentd"),
AWSLOGS("awslogs"),
SPLUNK("splunk");
private String type;
LoggingType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public static final class Serializer extends JsonSerializer {
@Override
public void serialize(LoggingType value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonProcessingException {
jgen.writeString(value.getType());
}
}
public static final class Deserializer extends JsonDeserializer {
@Override
public LoggingType org.testifyproject.testifyprojectserialize(JsonParser jsonParser, DeserializationContext org.testifyproject.testifyprojectserializationContext)
throws IOException, JsonProcessingException {
ObjectCodec oc = jsonParser.getCodec();
JsonNode node = oc.readTree(jsonParser);
for (LoggingType loggingType : values()) {
if (loggingType.getType().equals(node.asText())) {
return loggingType;
}
}
throw new IllegalArgumentException("No enum constant " + LoggingType.class + "." + node.asText());
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy