protected < T > T handleResponse ( OkHttpClient client , Request . Builder requestBuilder , Class < T > type , Map < String , String > parameters ) throws ExecutionException , InterruptedException , KubernetesClientException , IOException { VersionUsageUtils . log ( this . resourceT , this . apiGroupVersion ) ; Request request = requestBuilder . build ( ) ; Response response = client . newCall ( request ) . execute ( ) ; try ( ResponseBody body = response . body ( ) ) { assertResponseCode ( request , response ) ; if ( type != null ) { try ( InputStream bodyInputStream = body . byteStream ( ) ) { return Serialization . unmarshal ( bodyInputStream , type , parameters ) ; } } else { return null ; } } catch ( Exception e ) { if ( e instanceof KubernetesClientException ) { throw e ; } throw requestException ( request , e ) ; } finally { if ( response != null && response . body ( ) != null ) { response . body ( ) . close ( ) ; } } }
Send an http request and handle the response optionally performing placeholder substitution to the response .