Makes a REST call to Kubernetes API and returns the result JSON.

@param urlString Kubernetes API REST endpoint
@return parsed JSON
@throws KubernetesClientException if Kubernetes API didn't respond with 200 and a valid JSON content
541392
private JsonObject callGet(final String urlString) {
        return RetryUtils.retry(new Callable<JsonObject>() {
            @Override
            public JsonObject call() {
                return Json
                        .parse(RestClient.create(urlString).withHeader("Authorization", String.format("Bearer %s", apiToken))
                                         .withCaCertificate(caCertificate)
                                         .get())
                        .asObject();
            }
        }, retries, NON_RETRYABLE_KEYWORDS);
    }
826371
public static JsonNode parse(final String jsonString) {
        if (Strings.isEmpty(jsonString)) {
            return newObject();
        }

        try {
            return createObjectMapper().readValue(jsonString, JsonNode.class);
        } catch (Throwable e) {
            throw new ParseException(String.format("can't parse string [%s]", jsonString), e);
        }
    }
838972
public List<T> parseList(String jsonString) throws IOException {
        JsonParser jsonParser = LoganSquare.JSON_FACTORY.createParser(jsonString);
        jsonParser.nextToken();
        return parseList(jsonParser);
    }
553704
public static HttpResponse getJson(String urlStr) throws IOException, ServiceException {
        URL url = new URL(urlStr);
        HttpURLConnection urlConnection = (HttpURLConnection) url
                .openConnection();
        if (urlConnection instanceof HttpsURLConnection) {
            setTLSConnection((HttpsURLConnection)urlConnection);
        }
        urlConnection.addRequestProperty("Accept", "application/json");

        return getHttpResponse(urlConnection);
    }
149147
public static RequestResponse callHttpGet(String url, Map<String, Object> headers,
            Map<String, Object> urlParams) {
        return callHttpGet(httpJsonRpcClient, url, headers, urlParams);
    }
1045609
public static String readString(URL url, String charset) throws IORuntimeException {
		if (url == null) {
			throw new NullPointerException("Empty url provided!");
		}

		InputStream in = null;
		try {
			in = url.openStream();
			return IoUtil.read(in, charset);
		} catch (IOException e) {
			throw new IORuntimeException(e);
		} finally {
			IoUtil.close(in);
		}
	}
694935
public static String decode(String urlString) {
		StringBuilder s = new StringBuilder();
		UrlDecoderState state = UrlDecoderState.INITIAL;
		int hiNibble = 0;
		int lowNibble = 0;
		int length = urlString.length();
		for (int i = 0; i < length; i++) {
			char c = urlString.charAt(i);
			switch (state) {
			case INITIAL:
				if (c == '%') {
					state = UrlDecoderState.FIRST_HEX;
				} else {
					s.append(c);
				}
				break;
			case FIRST_HEX:
				hiNibble = lookup(c);
				state = UrlDecoderState.SECOND_HEX;
				break;
			case SECOND_HEX:
				lowNibble = lookup(c);
				byte b = (byte) ((hiNibble << 4) | lowNibble);
				s.append((char) b);
				state = UrlDecoderState.INITIAL;
				break;
			}
		}
		return s.toString();
	}
626922
public static String getURLProtocol(String urlString) {
        String protocol = null;
        int firstColon = urlString.indexOf(':');
        if (firstColon >= 0) {
            String specifiedProtocol = urlString.substring(0, firstColon);
            if (FindBugs.knownURLProtocolSet.contains(specifiedProtocol)) {
                protocol = specifiedProtocol;
            }
        }
        return protocol;
    }
737033
private URL createURL(final String urlString) throws MalformedURLException {

        URL url;
        try {
            url = AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() {

                @Override
                public URL run() throws MalformedURLException {
                    return new URL(urlString);
                }
            });
        } catch (PrivilegedActionException e) {
            throw (MalformedURLException) e.getCause();
        }

        return url;
    }
913416
public static String post(String urlString, String body, int timeout) {
		return HttpRequest.post(urlString).timeout(timeout).body(body).execute().body();
	}
187402
private static URL safeURL(String urlString) throws ClassNotFoundException
	{
		try
		{
			return new URL(urlString);
		}
		catch (MalformedURLException exception)
		{
			throw new ClassNotFoundException(exception.getMessage());
		}
	}
76226
public <T> T fromJson(@Nullable String jsonString, Class<T> clazz) {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}

		try {
			return mapper.readValue(jsonString, clazz);
		} catch (IOException e) {
			logger.warn("parse json string error:" + jsonString, e);
			return null;
		}
	}
580372
public static String get(String urlString, Charset customCharset) {
		return HttpRequest.get(urlString).charset(customCharset).execute().body();
	}
982379
public static JSONObject getJSONFromString(final String jsonString) {
        if (isBlank(jsonString)) {
            return new JSONObject();
        }
        return JSON.parseObject(jsonString);
    }
133714
protected String getString(HttpClient httpClient, String url) {
        try {
            HttpEntity entity = get(httpClient, url);
            if (entity == null) return null;
            return EntityUtils.toString(entity);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
824970
public static String prettyFormatJson(String jsonString) {
        requireNonNull(jsonString, "jsonString is null");
        return JSON.toJSONString(getJSONFromString(jsonString), true);
    }
400215
public HttpRequestBase getHttpRequest(HttpServletRequest req, String urlString)
	{	 // Prepare a request object
		HttpRequestBase httpget = null;
		String method = req.getMethod();
		if (GET.equalsIgnoreCase(method))
			httpget = new HttpGet(urlString);
		else if (POST.equalsIgnoreCase(method))
			httpget = new HttpPost(urlString);
		else if (PUT.equalsIgnoreCase(method))
			httpget = new HttpPut(urlString);
		else if (DELETE.equalsIgnoreCase(method))
			httpget = new HttpDelete(urlString);
		else if (HEAD.equalsIgnoreCase(method))
			httpget = new HttpHead(urlString);
		else if (OPTIONS.equalsIgnoreCase(method))
			httpget = new HttpOptions(urlString);
		else if (TRACE.equalsIgnoreCase(method))
			httpget = new HttpTrace(urlString);
		return httpget;
	}