.replaceAll("\\{" + "logpath" + "\\}", apiClient.escapeString(logpath.toString())); final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
public ApiClient build() { final ApiClient client = new ApiClient(); basePath = basePath.substring(0, basePath.length() - 1); client.setBasePath(basePath); client.setVerifyingSsl(verifyingSsl); client.setSslCaCert(new ByteArrayInputStream(caCertBytes));
/** * Build HTTP call with the given options. * * @param path The sub-path of the HTTP URL * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" * @param queryParams The query parameters * @param collectionQueryParams The collection query parameters * @param body The request body object * @param headerParams The header parameters * @param formParams The form parameters * @param authNames The authentications to apply * @param progressRequestListener Progress request listener * @return The HTTP call * @throws ApiException If fail to serialize the request body object */ public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, progressRequestListener); return httpClient.newCall(request); }
public static ApiClient fromUrl(String url, boolean validateSSL) { return new ApiClient().setBasePath(url).setVerifyingSsl(validateSSL); }
/** * * * @param logpath path to the log (required) * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Void> logFileHandlerWithHttpInfo(String logpath) throws ApiException { com.squareup.okhttp.Call call = logFileHandlerValidateBeforeCall(logpath, null, null); return apiClient.execute(call); }
/** * {@link #executeAsync(Call, Type, ApiCallback)} * * @param <T> Type * @param call An instance of the Call object * @param callback ApiCallback<T> */ public <T> void executeAsync(Call call, ApiCallback<T> callback) { executeAsync(call, null, callback); }
public void close() { // Trigger shutdown of the dispatcher's executor so this process can exit cleanly. client.getHttpClient().getDispatcher().getExecutorService().shutdown(); }
Object obj = client .getJSON() .getGson() .fromJson(json, Class.forName("io.kubernetes.client.models." + args[1])); String output = client.getJSON().getGson().toJson(obj); .getJSON() .getGson() .fromJson( new StringReader(output), Class.forName("io.kubernetes.client.models." + args[1])); String output2 = client.getJSON().getGson().toJson(obj2);
@VisibleForTesting void setupClient() throws Exception { if (appsClient == null) { if (k8Uri == null) { log.info("k8Uri is null thus going by defaults"); ApiClient cli; if (submittingInsidePod) { log.info("Looks like we are inside a k8 pod ourselves. Initializing as cluster"); cli = Config.fromCluster(); } else { log.info("Using default cluster since we are not running inside k8"); cli = Config.defaultClient(); } Configuration.setDefaultApiClient(cli); appsClient = new AppsV1Api(); coreClient = new CoreV1Api(); } else { log.info("Setting up k8Client using uri " + k8Uri); final ApiClient apiClient = new ApiClient().setBasePath(k8Uri); appsClient = new AppsV1Api(apiClient); coreClient = new CoreV1Api(apiClient); } } } }
/** * * * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Void> logFileListHandlerWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = logFileListHandlerValidateBeforeCall(null, null); return apiClient.execute(call); }
/** * {@link #executeAsync(Call, Type, ApiCallback)} * * @param <T> Type * @param call An instance of the Call object * @param callback ApiCallback<T> */ public <T> void executeAsync(Call call, ApiCallback<T> callback) { executeAsync(call, null, callback); }
private static void streamRequest(Request request, ApiClient client, SocketListener listener) { WebSocketCall.create(client.getHttpClient(), request).enqueue(new Listener(listener)); }
public static ApiClient fromUrl(String url, boolean validateSSL) { return new ApiClient().setBasePath(url).setVerifyingSsl(validateSSL); }
V1Status status = client.getJSON().deserialize(body, returnType); if (status == null) { return -1;
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
/** * * get available resources * @return ApiResponse<V1APIResourceList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<V1APIResourceList> getAPIResourcesWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getAPIResourcesValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<V1APIResourceList>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
apiClient.executeAsync(call, callback); return call;
public ApiClient build() { final ApiClient client = new ApiClient(); basePath = basePath.substring(0, basePath.length() - 1); client.setBasePath(basePath); client.setVerifyingSsl(verifyingSsl); client.setSslCaCert(new ByteArrayInputStream(caCertBytes));
private static void streamRequest(Request request, ApiClient client, SocketListener listener) { WebSocketCall.create(client.getHttpClient(), request).enqueue(new Listener(listener)); }
private void submitService() throws Exception { final V1Service service = createService(); log.info("Submitting the following service to k8 {}", coreClient.getApiClient().getJSON().serialize(service)); final Response response = coreClient.createNamespacedServiceCall(jobNamespace, service, null, null, null).execute(); if (!response.isSuccessful()) { if (response.code() == HTTP_CONFLICT) { log.warn("Service already created for function {}/{}/{}", instanceConfig.getFunctionDetails().getTenant(), instanceConfig.getFunctionDetails().getNamespace(), instanceConfig.getFunctionDetails().getName()); } else { log.error("Error creating Service for function {}/{}/{}:- {}", instanceConfig.getFunctionDetails().getTenant(), instanceConfig.getFunctionDetails().getNamespace(), instanceConfig.getFunctionDetails().getName(), response.message()); // construct a message based on the k8s api server response throw new IllegalStateException(response.message()); } } else { log.info("Service Created Successfully for function {}/{}/{}", instanceConfig.getFunctionDetails().getTenant(), instanceConfig.getFunctionDetails().getNamespace(), instanceConfig.getFunctionDetails().getName()); } }