in data/src/main/java/com/microsoft/azure/kusto/data/auth/CloudInfo.java [111:133]
private static Mono<CloudInfo> fetchCloudInfoAsync(String clusterUrl, @Nullable HttpClient givenHttpClient) {
try {
HttpClient localHttpClient = givenHttpClient == null ? HttpClientFactory.create(null) : givenHttpClient;
String metadataEndpoint = UriUtils.setPathForUri(clusterUrl, METADATA_ENDPOINT); // Metadata endpoint is always on the root of the cluster
HttpRequest request = new HttpRequest(HttpMethod.GET, metadataEndpoint);
request.setHeader(HttpHeaderName.ACCEPT_ENCODING, "gzip,deflate");
request.setHeader(HttpHeaderName.ACCEPT, "application/json");
return MonitoredActivity.wrap(localHttpClient.send(request, RequestUtils.contextWithTimeout(CLOUD_INFO_TIMEOUT)),
"CloudInfo.httpCall")
.flatMap(response -> getCloudInfo(response, clusterUrl))
.doFinally(ignore -> {
if (givenHttpClient == null && localHttpClient instanceof Closeable) {
try {
((Closeable) localHttpClient).close();
} catch (IOException ignore1) {
}
}
});
} catch (URISyntaxException e) {
throw new DataServiceException(clusterUrl, "URISyntaxException when trying to retrieve cluster metadata: " + e.getMessage(), e, true);
}
}