public RangerExportPolicyList exportRangerPolicies(String sourceRangerEndpoint,
                                                     String dbName,
                                                     String rangerHiveServiceName,
                                                     HiveConf hiveConf)throws Exception {
    LOG.info("Ranger endpoint for cluster " + sourceRangerEndpoint);
    if (StringUtils.isEmpty(rangerHiveServiceName)) {
      throw new SemanticException(ErrorMsg.REPL_INVALID_CONFIG_FOR_SERVICE.format("Ranger Service Name " +
        "cannot be empty", ReplUtils.REPL_RANGER_SERVICE));
    }
    String finalUrl = getRangerExportUrl(sourceRangerEndpoint, rangerHiveServiceName, dbName);
    LOG.debug("Url to export policies from source Ranger: {}", finalUrl);
    Retryable retryable = Retryable.builder()
      .withHiveConf(hiveConf).withFailOnException(RuntimeException.class)
      .withRetryOnException(Exception.class).build();
    try {
      return retryable.executeCallable(() -> exportRangerPoliciesPlain(finalUrl, hiveConf));
    } catch (RuntimeException e) {
      throw e;
    } catch (Exception e) {
      throw new SemanticException(ErrorMsg.REPL_RETRY_EXHAUSTED.format(e.getMessage()), e);
    }
  }
RangerRestClientImpl to connect to Ranger and export policies.
ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ranger/RangerRestClientImpl.java