Example usage for com.amazonaws ClientConfiguration setNonProxyHosts

List of usage examples for com.amazonaws ClientConfiguration setNonProxyHosts

Introduction

In this page you can find the example usage for com.amazonaws ClientConfiguration setNonProxyHosts.

Prototype

public void setNonProxyHosts(String nonProxyHosts) 

Source Link

Document

Set the optional hosts the client will access without going through the proxy.

Usage

From source file:de.taimos.pipeline.aws.ProxyConfiguration.java

License:Apache License

private static void useJenkinsProxy(ClientConfiguration config) {
    if (Jenkins.getInstance() != null) {
        hudson.ProxyConfiguration proxyConfiguration = Jenkins.getInstance().proxy;
        if (proxyConfiguration != null) {
            config.setProxyHost(proxyConfiguration.name);
            config.setProxyPort(proxyConfiguration.port);
            config.setProxyUsername(proxyConfiguration.getUserName());
            config.setProxyPassword(proxyConfiguration.getPassword());

            if (proxyConfiguration.noProxyHost != null) {
                String[] noProxyParts = proxyConfiguration.noProxyHost.split("[ \t\n,|]+");
                config.setNonProxyHosts(Joiner.on('|').join(noProxyParts));
            }/*w ww.  ja  va2  s .  c o m*/
        }
    }
}

From source file:de.taimos.pipeline.aws.ProxyConfiguration.java

License:Apache License

private static void configureNonProxyHosts(EnvVars vars, ClientConfiguration config) {
    String noProxy = vars.get(NO_PROXY, vars.get(NO_PROXY_LC));
    if (noProxy != null) {
        config.setNonProxyHosts(Joiner.on('|').join(noProxy.split(",")));
    }/*from ww  w .java2  s .  c om*/
}

From source file:io.relution.jenkins.awssqs.factories.SQSFactoryImpl.java

License:Apache License

private ClientConfiguration getClientConfiguration(final io.relution.jenkins.awssqs.interfaces.SQSQueue queue) {
    final ClientConfiguration config = new ClientConfiguration();

    // Check to see if Jenkins is up yet
    Jenkins jenkins = Jenkins.getInstance();
    ProxyConfiguration proxyConfig = jenkins.proxy;
    Proxy proxy = proxyConfig == null ? Proxy.NO_PROXY : proxyConfig.createProxy(queue.getEndpoint());
    if (!proxy.equals(Proxy.NO_PROXY) && proxy.address() instanceof InetSocketAddress) {
        InetSocketAddress address = (InetSocketAddress) proxy.address();
        config.setProxyHost(address.getHostName());
        config.setProxyPort(address.getPort());
        config.setNonProxyHosts("169.254.169.254");
        if (null != proxyConfig.getUserName()) {
            config.setProxyUsername(proxyConfig.getUserName());
            config.setProxyPassword(proxyConfig.getPassword());
        }//  www.ja  v  a2s. co m
        io.relution.jenkins.awssqs.logging.Log.info("Proxy settings for SQS: %s:%s", config.getProxyHost(),
                config.getProxyPort());
    }
    return config;
}