List of usage examples for com.amazonaws ClientConfiguration setProxyUsername
public void setProxyUsername(String proxyUsername)
From source file:com.upplication.s3fs.S3FileSystemProvider.java
License:Open Source License
protected ClientConfiguration createClientConfig(Properties props) { ClientConfiguration config = new ClientConfiguration(); if (props == null) return config; if (props.containsKey("connection_timeout")) { log.trace("AWS client config - connection_timeout: {}", props.getProperty("connection_timeout")); config.setConnectionTimeout(Integer.parseInt(props.getProperty("connection_timeout"))); }//from ww w .j av a 2 s .co m if (props.containsKey("max_connections")) { log.trace("AWS client config - max_connections: {}", props.getProperty("max_connections")); config.setMaxConnections(Integer.parseInt(props.getProperty("max_connections"))); } if (props.containsKey("max_error_retry")) { log.trace("AWS client config - max_error_retry: {}", props.getProperty("max_error_retry")); config.setMaxErrorRetry(Integer.parseInt(props.getProperty("max_error_retry"))); } if (props.containsKey("protocol")) { log.trace("AWS client config - protocol: {}", props.getProperty("protocol")); config.setProtocol(Protocol.valueOf(props.getProperty("protocol").toUpperCase())); } if (props.containsKey("proxy_domain")) { log.trace("AWS client config - proxy_domain: {}", props.getProperty("proxy_domain")); config.setProxyDomain(props.getProperty("proxy_domain")); } if (props.containsKey("proxy_host")) { log.trace("AWS client config - proxy_host: {}", props.getProperty("proxy_host")); config.setProxyHost(props.getProperty("proxy_host")); } if (props.containsKey("proxy_port")) { log.trace("AWS client config - proxy_port: {}", props.getProperty("proxy_port")); config.setProxyPort(Integer.parseInt(props.getProperty("proxy_port"))); } if (props.containsKey("proxy_username")) { log.trace("AWS client config - proxy_username: {}", props.getProperty("proxy_username")); config.setProxyUsername(props.getProperty("proxy_username")); } if (props.containsKey("proxy_password")) { log.trace("AWS client config - proxy_password: {}", props.getProperty("proxy_password")); config.setProxyPassword(props.getProperty("proxy_password")); } if (props.containsKey("proxy_workstation")) { log.trace("AWS client config - proxy_workstation: {}", props.getProperty("proxy_workstation")); config.setProxyWorkstation(props.getProperty("proxy_workstation")); } if (props.containsKey("signer_override")) { log.debug("AWS client config - signerOverride: {}", props.getProperty("signer_override")); config.setSignerOverride(props.getProperty("signer_override")); } if (props.containsKey("socket_send_buffer_size_hints") || props.containsKey("socket_recv_buffer_size_hints")) { log.trace("AWS client config - socket_send_buffer_size_hints: {}, socket_recv_buffer_size_hints: {}", props.getProperty("socket_send_buffer_size_hints", "0"), props.getProperty("socket_recv_buffer_size_hints", "0")); int send = Integer.parseInt(props.getProperty("socket_send_buffer_size_hints", "0")); int recv = Integer.parseInt(props.getProperty("socket_recv_buffer_size_hints", "0")); config.setSocketBufferSizeHints(send, recv); } if (props.containsKey("socket_timeout")) { log.trace("AWS client config - socket_timeout: {}", props.getProperty("socket_timeout")); config.setSocketTimeout(Integer.parseInt(props.getProperty("socket_timeout"))); } if (props.containsKey("user_agent")) { log.trace("AWS client config - user_agent: {}", props.getProperty("user_agent")); config.setUserAgent(props.getProperty("user_agent")); } return config; }
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)); }/*from w w w .j a v a2s .com*/ } } }
From source file:de.taimos.pipeline.aws.ProxyConfiguration.java
License:Apache License
private static void configureProxy(ClientConfiguration config, String env, int defaultPort) { Pattern pattern = Pattern.compile(PROXY_PATTERN); Matcher matcher = pattern.matcher(env); if (matcher.matches()) { if (matcher.group(3) != null) { config.setProxyUsername(matcher.group(3)); }//from w ww .j ava2s. c om if (matcher.group(5) != null) { config.setProxyPassword(matcher.group(5)); } config.setProxyHost(matcher.group(6)); if (matcher.group(8) != null) { config.setProxyPort(Integer.parseInt(matcher.group(8))); } else { config.setProxyPort(defaultPort); } } }
From source file:ec2watch.EC2Watch.java
License:Open Source License
private ClientConfiguration getClientConfig() { ClientConfiguration config = new ClientConfiguration(); String proxyHost = System.getenv("PROXY_HOST"); String proxyPort = System.getenv("PROXY_PORT"); String proxyUser = System.getenv("PROXY_USER"); String proxyPass = System.getenv("PROXY_PASSWORD"); if (proxyHost != null && proxyPort != null) { config.setProxyHost(proxyHost);// w w w .j a v a 2 s .c om config.setProxyPort(Integer.valueOf(proxyPort)); if (proxyUser != null) { config.setProxyUsername(proxyUser); } if (proxyPass != null) { config.setProxyPassword(proxyPass); } } return config; }
From source file:hudson.plugins.ec2.EC2Cloud.java
License:Open Source License
/*** * Connect to an EC2 instance./*from w w w . ja va 2 s .c o m*/ * @return {@link AmazonEC2} client */ public synchronized static AmazonEC2 connect(AWSCredentialsProvider credentialsProvider, URL endpoint) { awsCredentialsProvider = credentialsProvider; ClientConfiguration config = new ClientConfiguration(); ProxyConfiguration proxyConfig = Jenkins.getInstance().proxy; Proxy proxy = proxyConfig == null ? Proxy.NO_PROXY : proxyConfig.createProxy(endpoint.getHost()); if (!proxy.equals(Proxy.NO_PROXY) && proxy.address() instanceof InetSocketAddress) { InetSocketAddress address = (InetSocketAddress) proxy.address(); config.setProxyHost(address.getHostName()); config.setProxyPort(address.getPort()); if (null != proxyConfig.getUserName()) { config.setProxyUsername(proxyConfig.getUserName()); config.setProxyPassword(proxyConfig.getPassword()); } } AmazonEC2 client = new AmazonEC2Client(credentialsProvider.getCredentials(), config); client.setEndpoint(endpoint.toString()); return client; }
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()); }// w w w . j a va2s .co m io.relution.jenkins.awssqs.logging.Log.info("Proxy settings for SQS: %s:%s", config.getProxyHost(), config.getProxyPort()); } return config; }
From source file:jp.primecloud.auto.aws.amazon.AmazonAwsClientFactory.java
License:Open Source License
protected ClientConfiguration createConfiguration() { ClientConfiguration configuration = new ClientConfiguration(); // Proxy// w w w . j ava 2 s . c o m if (proxyHost != null && proxyPort != null) { configuration.setProxyHost(proxyHost); configuration.setProxyPort(proxyPort); if (proxyUser != null && proxyPassword != null) { configuration.setProxyUsername(proxyUser); configuration.setProxyPassword(proxyPassword); } } // ??? configuration.setMaxErrorRetry(0); return configuration; }
From source file:org.adroitlogic.build.aws.maven.S3Utils.java
License:Apache License
static ClientConfiguration getClientConfiguration(ProxyInfoProvider proxyInfoProvider) { ClientConfiguration clientConfiguration = new ClientConfiguration(); if (proxyInfoProvider != null) { ProxyInfo proxyInfo = proxyInfoProvider.getProxyInfo("s3"); if (proxyInfo != null) { //System.out.println("Proxy Info : NTLM host: " + proxyInfo.getNtlmHost() + " domain: " + proxyInfo.getNtlmDomain() + " username: " + proxyInfo.getUserName() + " password: " + proxyInfo.getPassword() + " host: " + proxyInfo.getHost() + " port: " + proxyInfo.getPort()); clientConfiguration.withProxyHost(proxyInfo.getHost()).withProxyPort(proxyInfo.getPort()); if (proxyInfo.getUserName() != null) { clientConfiguration.setProxyUsername(proxyInfo.getUserName()); clientConfiguration.setProxyPassword(proxyInfo.getPassword()); }// www . ja va 2 s .c o m if (proxyInfo.getNtlmDomain() != null) { clientConfiguration.setProxyDomain(proxyInfo.getNtlmDomain()); } if (proxyInfo.getNtlmHost() != null) { clientConfiguration.setProxyWorkstation(proxyInfo.getNtlmHost()); } } } //clientConfiguration.setProtocol(com.amazonaws.Protocol.HTTP); return clientConfiguration; }
From source file:org.adroitlogic.build.aws.maven.SimpleStorageServiceWagon.java
License:Apache License
@Override protected void connectToRepository(Repository repository, AuthenticationInfo authenticationInfo, ProxyInfoProvider proxyInfoProvider) throws AuthenticationException { if (this.amazonS3 == null) { AuthenticationInfoAWSCredentialsProviderChain credentialsProvider = new AuthenticationInfoAWSCredentialsProviderChain( authenticationInfo);/*from ww w . j av a 2 s.c o m*/ ClientConfiguration clientConfiguration = S3Utils.getClientConfiguration(proxyInfoProvider); this.bucketName = S3Utils.getBucketName(repository); this.baseDirectory = S3Utils.getBaseDirectory(repository); if (proxyInfoProvider != null) { ProxyInfo pi = proxyInfoProvider.getProxyInfo("s3"); if (pi != null) { clientConfiguration.setProxyHost(pi.getHost()); clientConfiguration.setProxyPort(pi.getPort()); clientConfiguration.setProxyUsername(pi.getUserName()); clientConfiguration.setProxyPassword(pi.getPassword()); clientConfiguration.setProxyDomain(pi.getNtlmDomain()); clientConfiguration.setProxyWorkstation(pi.getNtlmHost()); } } this.amazonS3 = new AmazonS3Client(credentialsProvider, clientConfiguration); Region region = Region.fromLocationConstraint(this.amazonS3.getBucketLocation(this.bucketName)); this.amazonS3.setEndpoint(region.getEndpoint()); } }
From source file:org.apache.druid.storage.s3.S3StorageDruidModule.java
License:Apache License
private static ClientConfiguration setProxyConfig(ClientConfiguration conf, AWSProxyConfig proxyConfig) { if (StringUtils.isNotEmpty(proxyConfig.getHost())) { conf.setProxyHost(proxyConfig.getHost()); }// www . j a v a2 s . c o m if (proxyConfig.getPort() != -1) { conf.setProxyPort(proxyConfig.getPort()); } if (StringUtils.isNotEmpty(proxyConfig.getUsername())) { conf.setProxyUsername(proxyConfig.getUsername()); } if (StringUtils.isNotEmpty(proxyConfig.getPassword())) { conf.setProxyPassword(proxyConfig.getPassword()); } return conf; }