class FixYarnWebServiceUrl extends AbstractUpgradeServerAction {

    @Override
    public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
            throws AmbariException, InterruptedException{

        String clusterName = getExecutionCommand().getClusterName();
        Cluster cluster = getClusters().getCluster(clusterName);
        Config config = cluster.getDesiredConfigByType(SOURCE_CONFIG_TYPE);

        if (config == null) {
            return  createCommandReport(0, HostRoleStatus.FAILED,"{}",
                    String.format("Source type %s not found", SOURCE_CONFIG_TYPE), "");
        }

        Map<String, String> properties = config.getProperties();
        String policy = properties.get(YARN_HTTP_POLICY);

        if (policy == null) {
            return  createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
                    String.format("%s/%s property is null", SOURCE_CONFIG_TYPE,YARN_HTTP_POLICY), "");
        }

        if (policy.equalsIgnoreCase(HTTP)) {
           String webappHttpAddress = properties.get(YARN_TIMELINE_WEBAPP_HTTPADDRESS);

           if (webappHttpAddress == null) {
               return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
                       String.format("%s/%s property is null", SOURCE_CONFIG_TYPE, YARN_TIMELINE_WEBAPP_HTTPADDRESS), "");
           }

           properties.put(YARN_LOGSERVER_WEBSERVICE_URL, "http://" + webappHttpAddress + "/ws/v1/applicationhistory");

        } else if (policy.equalsIgnoreCase(HTTPS)) {
            String webappHttpsAddress = properties.get(YARN_TIMELINE_WEBAPP_HTTPSADDRESS);

            if (webappHttpsAddress == null) {
                return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
                        String.format("%s/%s property is null", SOURCE_CONFIG_TYPE, YARN_TIMELINE_WEBAPP_HTTPSADDRESS), "");
            }

            properties.put(YARN_LOGSERVER_WEBSERVICE_URL, "https://"+webappHttpsAddress+"/ws/v1/applicationhistory");

        } else {
          return  createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
                    String.format("%s/%s property contains an invalid value. It should be from [%s,%s]", SOURCE_CONFIG_TYPE, YARN_HTTP_POLICY,HTTP,HTTPS), "");
        }

        config.setProperties(properties);
        config.save();
        agentConfigsHolder.updateData(cluster.getClusterId(), cluster.getHosts().stream().map(Host::getHostId).collect(Collectors.toList()));

        return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
                String.format("The %s/%s property was changed based on %s. ", SOURCE_CONFIG_TYPE, YARN_LOGSERVER_WEBSERVICE_URL, YARN_HTTP_POLICY),"");
    }

}