2
2
3
3
import com .google .gson .annotations .SerializedName ;
4
4
5
+ import java .util .Arrays ;
5
6
import java .util .List ;
6
7
import java .util .Map ;
7
8
@@ -13,6 +14,11 @@ public class NewService {
13
14
14
15
public static class Check {
15
16
17
+ /**
18
+ * Should only be used for Consul after 1.0
19
+ * For newer versions, {@link #args} should be used instead of script
20
+ */
21
+ @ Deprecated
16
22
@ SerializedName ("Script" )
17
23
private String script ;
18
24
@@ -22,6 +28,12 @@ public static class Check {
22
28
@ SerializedName ("Shell" )
23
29
private String shell ;
24
30
31
+ /**
32
+ * Should be used for consul before 1.0
33
+ */
34
+ @ SerializedName ("Args" )
35
+ private String [] args ;
36
+
25
37
@ SerializedName ("Interval" )
26
38
private String interval ;
27
39
@@ -52,10 +64,20 @@ public static class Check {
52
64
@ SerializedName ("Status" )
53
65
private String status ;
54
66
67
+ /**
68
+ * Should only be used for Consul < 1.0
69
+ * For newer versions, {@link #getArgs()} should be used instead of script
70
+ */
71
+ @ Deprecated
55
72
public String getScript () {
56
73
return script ;
57
74
}
58
75
76
+ /**
77
+ * Should only be used for Consul < 1.0
78
+ * For newer versions, {@link #setArgs(String)} should be used instead of script
79
+ */
80
+ @ Deprecated
59
81
public void setScript (String script ) {
60
82
this .script = script ;
61
83
}
@@ -76,6 +98,14 @@ public void setShell(String shell) {
76
98
this .shell = shell ;
77
99
}
78
100
101
+ public String [] getArgs () {
102
+ return args ;
103
+ }
104
+
105
+ public void setArgs (String script ) {
106
+ this .args = script .split (" " );
107
+ }
108
+
79
109
public String getInterval () {
80
110
return interval ;
81
111
}
@@ -160,6 +190,7 @@ public void setStatus(String status) {
160
190
public String toString () {
161
191
return "Check{" +
162
192
"script='" + script + '\'' +
193
+ ", args='" + Arrays .deepToString (args ) + '\'' +
163
194
", interval='" + interval + '\'' +
164
195
", ttl='" + ttl + '\'' +
165
196
", http='" + http + '\'' +
0 commit comments