@@ -32,7 +32,7 @@ public class WatchBuilder {
3232 private CallParamsImpl callParams = new CallParamsImpl ();
3333
3434 public interface WatchFactory {
35- <T > Watch <T > createWatch (ClientHolder clientHolder , CallParams callParams , Class <?> responseBodyType , BiFunction <ClientHolder , CallParams , Call > function ) throws ApiException ;
35+ <T > WatchI <T > createWatch (ClientHolder clientHolder , CallParams callParams , Class <?> responseBodyType , BiFunction <ClientHolder , CallParams , Call > function ) throws ApiException ;
3636 }
3737
3838 public WatchBuilder (ClientHolder clientHolder ) {
@@ -63,7 +63,7 @@ public Type getOwnerType() {
6363 * @return the active web hook
6464 * @throws ApiException if there is an error on the call that sets up the web hook.
6565 */
66- public Watch <V1Service > createServiceWatch (String namespace ) throws ApiException {
66+ public WatchI <V1Service > createServiceWatch (String namespace ) throws ApiException {
6767 return FACTORY .createWatch (clientHolder , callParams , V1Service .class , new ListNamespacedServiceCall (namespace ));
6868 }
6969
@@ -92,7 +92,7 @@ public Call apply(ClientHolder clientHolder, CallParams callParams) {
9292 * @return the active web hook
9393 * @throws ApiException if there is an error on the call that sets up the web hook.
9494 */
95- public Watch <V1Pod > createPodWatch (String namespace ) throws ApiException {
95+ public WatchI <V1Pod > createPodWatch (String namespace ) throws ApiException {
9696 return FACTORY .createWatch (clientHolder , callParams , V1Pod .class , new ListPodCall (namespace ));
9797 }
9898
@@ -121,7 +121,7 @@ public Call apply(ClientHolder clientHolder, CallParams callParams) {
121121 * @return the active web hook
122122 * @throws ApiException if there is an error on the call that sets up the web hook.
123123 */
124- public Watch <V1beta1Ingress > createIngressWatch (String namespace ) throws ApiException {
124+ public WatchI <V1beta1Ingress > createIngressWatch (String namespace ) throws ApiException {
125125 return FACTORY .createWatch (clientHolder , callParams , V1beta1Ingress .class , new ListIngressCall (namespace ));
126126 }
127127
@@ -151,7 +151,7 @@ public Call apply(ClientHolder clientHolder, CallParams callParams) {
151151 * @return the active web hook
152152 * @throws ApiException if there is an error on the call that sets up the web hook.
153153 */
154- public Watch <Domain > createDomainWatch (String namespace ) throws ApiException {
154+ public WatchI <Domain > createDomainWatch (String namespace ) throws ApiException {
155155 return FACTORY .createWatch (clientHolder , callParams , Domain .class , new ListDomainsCall (namespace ));
156156 }
157157
@@ -175,45 +175,6 @@ public Call apply(ClientHolder clientHolder, CallParams callParams) {
175175 }
176176 }
177177
178- /**
179- * Creates a web hook object to track changes to custom objects
180- * @param namespace the namespace in which to track custom objects.
181- * @param responseBodyType the type of objects returned in the events
182- * @param group the custom resource group name
183- * @param version the custom resource version
184- * @param plural the custom resource plural name @return the active web hook
185- * @throws ApiException if there is an error on the call that sets up the web hook.
186- */
187- public <T > Watch <T > createCustomObjectWatch (String namespace , Class <?> responseBodyType , String group , String version , String plural ) throws ApiException {
188- return FACTORY .createWatch (clientHolder , callParams , responseBodyType , new ListCustomObjectsInNamespaceCall (namespace , group , version , plural ));
189- }
190-
191- private class ListCustomObjectsInNamespaceCall implements BiFunction <ClientHolder , CallParams , Call > {
192- private String namespace ;
193- private String group ;
194- private String version ;
195- private String plural ;
196-
197- ListCustomObjectsInNamespaceCall (String namespace , String group , String version , String plural ) {
198- this .namespace = namespace ;
199- this .group = group ;
200- this .version = version ;
201- this .plural = plural ;
202- }
203-
204- @ Override
205- public Call apply (ClientHolder clientHolder , CallParams callParams ) {
206- try {
207- return clientHolder .getCustomObjectsApiClient ().listNamespacedCustomObjectCall (
208- group , version , namespace , plural ,
209- callParams .getPretty (), callParams .getLabelSelector (), callParams .getResourceVersion (),
210- WATCH , null , null );
211- } catch (ApiException e ) {
212- throw new UncheckedApiException (e );
213- }
214- }
215- }
216-
217178 /**
218179 * Sets a value for the fieldSelector parameter for the call that will set up this watch. Defaults to null.
219180 * @param fieldSelector the desired value
@@ -268,9 +229,9 @@ public WatchBuilder withProgressRequestListener(ProgressRequestBody.ProgressRequ
268229
269230 static class WatchFactoryImpl implements WatchFactory {
270231 @ Override
271- public <T > Watch <T > createWatch (ClientHolder clientHolder , CallParams callParams , Class <?> responseBodyType , BiFunction <ClientHolder , CallParams , Call > function ) throws ApiException {
232+ public <T > WatchI <T > createWatch (ClientHolder clientHolder , CallParams callParams , Class <?> responseBodyType , BiFunction <ClientHolder , CallParams , Call > function ) throws ApiException {
272233 try {
273- return Watch .createWatch (clientHolder .getApiClient (), function .apply (clientHolder , callParams ), getType (responseBodyType ));
234+ return new WatchImpl < T >( Watch .createWatch (clientHolder .getApiClient (), function .apply (clientHolder , callParams ), getType (responseBodyType ) ));
274235 } catch (UncheckedApiException e ) {
275236 throw e .getCause ();
276237 }
0 commit comments