docs: public String readResource(URI endpoint, CredentialsEndpointRetryPolicy retryPolicy, Map<String, String> headers) throws IOException {
          int retriesAttempted = 0;
          InputStream inputStream = null;
  
          headers = addDefaultHeaders(headers);
  
          while (true) {
              try {
                  HttpURLConnection connection = connectionUtils.connectToEndpoint(endpoint, headers);
  
                  int statusCode = connection.getResponseCode();
  
                  if (statusCode == HttpURLConnection.HTTP_OK) {
                      inputStream = connection.getInputStream();
                      return IOUtils.toString(inputStream);
                  } else if (statusCode == HttpURLConnection.HTTP_NOT_FOUND) {
                      // This is to preserve existing behavior of EC2 Instance metadata service.
                      throw new SdkClientException("The requested metadata is not found at " + connection.getURL());
                  } else {
                      if (!retryPolicy.shouldRetry(retriesAttempted++, CredentialsEndpointRetryParameters.builder().withStatusCode(statusCode).build())) {
                          inputStream = connection.getErrorStream();
                          handleErrorResponse(inputStream, statusCode, connection.getResponseMessage());
                      }
                  }
              } catch (IOException ioException) {
                  if (!retryPolicy.shouldRetry(retriesAttempted++, CredentialsEndpointRetryParameters.builder().withException(ioException).build())) {
                      throw ioException;
                  }
                  LOG.debug("An IOException occured when connecting to service endpoint: " + endpoint  + "\n Retrying to connect again.");
              } finally {
                  IOUtils.closeQuietly(inputStream, LOG);
              }
          }
  
      }