class ProxyConfigProvider {

    public void decoratePillarWithProxyDataIfNeeded(Map<String, SaltPillarProperties> servicePillar, Cluster cluster) {
        Optional<ProxyConfig> proxyConfig = proxyConfigDtoService.getByCrnWithEnvironmentFallback(cluster.getProxyConfigCrn(), cluster.getEnvironmentCrn());
        proxyConfig.ifPresent(pc -> {
            Map<String, Object> proxy = new HashMap<>();
            proxy.put("host", pc.getServerHost());
            proxy.put("port", pc.getServerPort());
            proxy.put("protocol", pc.getProtocol());
            pc.getProxyAuthentication().ifPresent(auth -> {
                proxy.put("user", auth.getUserName());
                proxy.put("password", auth.getPassword());
            });
            servicePillar.put(PROXY_KEY, new SaltPillarProperties(PROXY_SLS_PATH, singletonMap(PROXY_KEY, proxy)));
            LOGGER.info("Salt pillar properties extend with proxy config: {}", pc);
        });
    }

}