22
33import com .google .gson .annotations .SerializedName ;
44
5+ import java .util .Arrays ;
56import java .util .List ;
67import java .util .Map ;
78
@@ -13,6 +14,11 @@ public class NewService {
1314
1415 public static class Check {
1516
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
1622 @ SerializedName ("Script" )
1723 private String script ;
1824
@@ -22,6 +28,12 @@ public static class Check {
2228 @ SerializedName ("Shell" )
2329 private String shell ;
2430
31+ /**
32+ * Should be used for consul before 1.0
33+ */
34+ @ SerializedName ("Args" )
35+ private String [] args ;
36+
2537 @ SerializedName ("Interval" )
2638 private String interval ;
2739
@@ -52,10 +64,20 @@ public static class Check {
5264 @ SerializedName ("Status" )
5365 private String status ;
5466
67+ /**
68+ * Should only be used for Consul before 1.0
69+ * For newer versions, {@link #getArgs()} should be used instead of script
70+ */
71+ @ Deprecated
5572 public String getScript () {
5673 return script ;
5774 }
5875
76+ /**
77+ * Should only be used for Consul after 1.0
78+ * For newer versions, {@link #setArgs(String)} should be used instead of script
79+ */
80+ @ Deprecated
5981 public void setScript (String script ) {
6082 this .script = script ;
6183 }
@@ -76,6 +98,14 @@ public void setShell(String shell) {
7698 this .shell = shell ;
7799 }
78100
101+ public String [] getArgs () {
102+ return args ;
103+ }
104+
105+ public void setArgs (String script ) {
106+ this .args = script .split (" " );
107+ }
108+
79109 public String getInterval () {
80110 return interval ;
81111 }
@@ -160,6 +190,7 @@ public void setStatus(String status) {
160190 public String toString () {
161191 return "Check{" +
162192 "script='" + script + '\'' +
193+ ", args='" + Arrays .deepToString (args ) + '\'' +
163194 ", interval='" + interval + '\'' +
164195 ", ttl='" + ttl + '\'' +
165196 ", http='" + http + '\'' +
0 commit comments