private String getATSUrlFromCluster() {
    String url;

    String httpPolicy = getYarnConfig(YARN_HTTP_POLICY);

    if (!(HTTP_ONLY.equals(httpPolicy) || HTTPS_ONLY.equals(httpPolicy))) {
      LOG.error(String.format("RA030 Unknown value %s of yarn-site/yarn.http.policy. HTTP_ONLY assumed.", httpPolicy));
      httpPolicy = HTTP_ONLY;
    }

    if (httpPolicy.equals(HTTPS_ONLY)) {
      url = getYarnConfig(YARN_TIMELINE_WEBAPP_HTTPS_ADDRESS_KEY);
    } else {
      url = getYarnConfig(YARN_TIMELINE_WEBAPP_HTTP_ADDRESS_KEY);
    }
    url = addProtocolIfMissing(url, getProtocol(httpPolicy));

    return url;
  }
@return Returns the protocol used by YARN daemons, the value is always taken from the
yarn-site.xml.
contrib/views/utils/src/main/java/org/apache/ambari/view/utils/ambari/Services.java