1212*/
1313package io .kubernetes .client ;
1414
15- import io .kubernetes .client .Configuration ;
1615import io .kubernetes .client .models .V1Pod ;
1716import io .kubernetes .client .util .WebSocketStreamHandler ;
1817import io .kubernetes .client .util .WebSockets ;
18+ import org .apache .commons .lang3 .StringUtils ;
1919
20- import java .io .ByteArrayInputStream ;
21- import java .io .Closeable ;
2220import java .io .InputStream ;
2321import java .io .IOException ;
2422import java .io .OutputStream ;
25- import java .io .PipedInputStream ;
26- import java .io .PipedOutputStream ;
27- import java .io .Reader ;
28-
29- import org .apache .commons .lang .StringUtils ;
3023
3124public class Exec {
3225 private ApiClient apiClient ;
@@ -70,15 +63,15 @@ private String makePath(String namespace, String name, String[] command, String
7063 "/exec?" +
7164 "stdin=" + stdin +
7265 "&tty=" + tty +
73- (container != null ? "&container=" + container : "" ) +
66+ (container != null ? "&container=" + container : "" ) +
7467 "&command=" + StringUtils .join (command , "&command=" );
7568 return path ;
7669 }
7770
7871 /**
7972 * Execute a command in a container. If there are multiple containers in the pod, uses
8073 * the first container in the Pod.
81- *
74+ *
8275 * @param namespace The namespace of the Pod
8376 * @param name The name of the Pod
8477 * @param command The command to run
@@ -91,10 +84,10 @@ public Process exec(String namespace, String name, String[] command, boolean std
9184 /**
9285 * Execute a command in a container. If there are multiple containers in the pod, uses
9386 * the first container in the Pod.
94- *
87+ *
9588 * @param pod The pod where the command is run.
9689 * @param command The command to run
97- * @param stdin If true, pass a stdin stream into the container
90+ * @param stdin If true, pass a stdin stream into the container
9891 */
9992 public Process exec (V1Pod pod , String [] command , boolean stdin ) throws ApiException , IOException {
10093 return exec (pod , command , null , stdin , false );
@@ -103,11 +96,11 @@ public Process exec(V1Pod pod, String[] command, boolean stdin) throws ApiExcept
10396 /**
10497 * Execute a command in a container. If there are multiple containers in the pod, uses
10598 * the first container in the Pod.
106- *
99+ *
107100 * @param namespace The namespace of the Pod
108101 * @param name The name of the Pod
109102 * @param command The command to run
110- * @param stdin If true, pass a stdin stream into the container
103+ * @param stdin If true, pass a stdin stream into the container
111104 * @param tty If true, stdin is a tty.
112105 */
113106 public Process exec (String namespace , String name , String [] command , boolean stdin , boolean tty ) throws ApiException , IOException {
@@ -117,10 +110,10 @@ public Process exec(String namespace, String name, String[] command, boolean std
117110 /**
118111 * Execute a command in a container. If there are multiple containers in the pod, uses
119112 * the first container in the Pod.
120- *
113+ *
121114 * @param pod The pod where the command is run.
122115 * @param command The command to run
123- * @param stdin If true, pass a stdin stream into the container
116+ * @param stdin If true, pass a stdin stream into the container
124117 * @param tty If true, stdin is a tty.
125118 */
126119 public Process exec (V1Pod pod , String [] command , boolean stdin , boolean tty ) throws ApiException , IOException {
@@ -130,7 +123,7 @@ public Process exec(V1Pod pod, String[] command, boolean stdin, boolean tty) thr
130123 /**
131124 * Execute a command in a container. If there are multiple containers in the pod, uses
132125 * the first container in the Pod.
133- *
126+ *
134127 * @param pod The pod where the command is run.
135128 * @param command The command to run
136129 * @param container The container in the Pod where the command is run.
@@ -144,7 +137,7 @@ public Process exec(V1Pod pod, String[] command, String container, boolean stdin
144137 /**
145138 * Execute a command in a container. If there are multiple containers in the pod, uses
146139 * the first container in the Pod.
147- *
140+ *
148141 * @param namespace The namespace of the Pod
149142 * @param name The name of the Pod
150143 * @param command The command to run
@@ -166,7 +159,7 @@ private static class ExecProcess extends Process {
166159 WebSocketStreamHandler streamHandler ;
167160 private int statusCode ;
168161
169-
162+
170163 public ExecProcess (WebSocketStreamHandler handler ) throws IOException {
171164 this .streamHandler = handler ;
172165 this .statusCode = -1 ;
@@ -194,13 +187,13 @@ public int waitFor() throws InterruptedException {
194187 }
195188 return statusCode ;
196189 }
197-
190+
198191 public int exitValue () {
199192 return statusCode ;
200193 }
201194
202195 public void destroy () {
203196 streamHandler .close ();
204197 }
205- }
198+ }
206199}
0 commit comments