@Override
  public RangerExportPolicyList importRangerPolicies(RangerExportPolicyList rangerExportPolicyList, String dbName,
                                                     String baseUrl,
                                                     String rangerHiveServiceName,
                                                     HiveConf hiveConf)
      throws Exception {
    String sourceClusterServiceName = null;
    String serviceMapJsonFileName = "hive_servicemap.json";
    String rangerPoliciesJsonFileName = "hive_replicationPolicies.json";

    if (!rangerExportPolicyList.getPolicies().isEmpty()) {
      sourceClusterServiceName = rangerExportPolicyList.getPolicies().get(0).getService();
    }

    if (StringUtils.isEmpty(sourceClusterServiceName)) {
      sourceClusterServiceName = rangerHiveServiceName;
    }

    Map<String, String> serviceMap = new LinkedHashMap<String, String>();
    if (!StringUtils.isEmpty(sourceClusterServiceName) && !StringUtils.isEmpty(rangerHiveServiceName)) {
      serviceMap.put(sourceClusterServiceName, rangerHiveServiceName);
    }

    Gson gson = new GsonBuilder().create();
    String jsonServiceMap = gson.toJson(serviceMap);

    String jsonRangerExportPolicyList = gson.toJson(rangerExportPolicyList);
    String finalUrl = getRangerImportUrl(baseUrl, dbName);
    LOG.debug("URL to import policies on target Ranger: {}", finalUrl);
    Retryable retryable = Retryable.builder()
      .withHiveConf(hiveConf).withFailOnException(RuntimeException.class)
      .withRetryOnException(Exception.class).build();
    try {
      return retryable.executeCallable(() -> importRangerPoliciesPlain(jsonRangerExportPolicyList,
              rangerPoliciesJsonFileName,
              serviceMapJsonFileName, jsonServiceMap, finalUrl, rangerExportPolicyList, 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