forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogConfig.java
More file actions
104 lines (86 loc) · 2.66 KB
/
Copy pathLogConfig.java
File metadata and controls
104 lines (86 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package com.github.dockerjava.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.CheckForNull;
import java.io.Serializable;
import java.util.Map;
/**
* Log driver to use for a created/running container. The available types are:
* <p>
* json-file (default) syslog journald none
* <p>
* If a driver is specified that is NOT supported,docker will default 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 detailed
* and up-to-date explanation of the available types and their options.
*/
public class LogConfig implements Serializable {
private static final long serialVersionUID = 1L;
@JsonProperty("Type")
public LoggingType type = null;
@JsonProperty("Config")
public Map<String, String> config;
public LogConfig(LoggingType type, Map<String, String> 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<String, String> getConfig() {
return config;
}
@JsonIgnore
public LogConfig setConfig(Map<String, String> config) {
this.config = config;
return this;
}
public enum LoggingType {
NONE("none"),
DEFAULT("json-file"),
LOCAL("local"),
ETWLOGS("etwlogs"),
JSON_FILE("json-file"),
SYSLOG("syslog"),
JOURNALD("journald"),
GELF("gelf"),
FLUENTD("fluentd"),
AWSLOGS("awslogs"),
DB("db"), // Synology specific driver
SPLUNK("splunk"),
GCPLOGS("gcplogs");
private String type;
LoggingType(String type) {
this.type = type;
}
@JsonValue
public String getType() {
return type;
}
@JsonCreator
@CheckForNull
public static LoggingType fromValue(String text) {
for (LoggingType b : LoggingType.values()) {
if (String.valueOf(b.type).equals(text)) {
return b;
}
}
return null;
}
@Override
public String toString() {
return String.valueOf(type);
}
}
}