Search in sources :

Example 71 with ClientConfiguration

use of com.amazonaws.ClientConfiguration in project pipeline-aws-plugin by jenkinsci.

the class ProxyTest method shouldSetNonProxyHosts.

@Test
public void shouldSetNonProxyHosts() throws Exception {
    EnvVars vars = new EnvVars();
    vars.put(ProxyConfiguration.NO_PROXY, "127.0.0.1,localhost");
    vars.put(ProxyConfiguration.HTTPS_PROXY, "http://127.0.0.1:8888/");
    ClientConfiguration config = new ClientConfiguration();
    config.setProtocol(Protocol.HTTPS);
    ProxyConfiguration.configure(vars, config);
    Assert.assertEquals("127.0.0.1|localhost", config.getNonProxyHosts());
}
Also used : EnvVars(hudson.EnvVars) ClientConfiguration(com.amazonaws.ClientConfiguration) Test(org.junit.Test)

Example 72 with ClientConfiguration

use of com.amazonaws.ClientConfiguration in project pipeline-aws-plugin by jenkinsci.

the class ProxyTest method shouldParseProxyWithoutPort.

@Test
public void shouldParseProxyWithoutPort() throws Exception {
    EnvVars vars = new EnvVars();
    vars.put(ProxyConfiguration.HTTPS_PROXY, "http://127.0.0.1/");
    ClientConfiguration config = new ClientConfiguration();
    config.setProtocol(Protocol.HTTPS);
    ProxyConfiguration.configure(vars, config);
    Assert.assertNull(config.getProxyUsername());
    Assert.assertNull(config.getProxyPassword());
    Assert.assertEquals("127.0.0.1", config.getProxyHost());
    Assert.assertEquals(443, config.getProxyPort());
}
Also used : EnvVars(hudson.EnvVars) ClientConfiguration(com.amazonaws.ClientConfiguration) Test(org.junit.Test)

Example 73 with ClientConfiguration

use of com.amazonaws.ClientConfiguration in project pipeline-aws-plugin by jenkinsci.

the class ProxyTest method shouldSetNonProxyHostsLowerCase.

@Test
public void shouldSetNonProxyHostsLowerCase() throws Exception {
    EnvVars vars = new EnvVars();
    vars.put(ProxyConfiguration.NO_PROXY_LC, "127.0.0.1,localhost");
    vars.put(ProxyConfiguration.HTTPS_PROXY, "http://127.0.0.1:8888/");
    ClientConfiguration config = new ClientConfiguration();
    config.setProtocol(Protocol.HTTPS);
    ProxyConfiguration.configure(vars, config);
    Assert.assertEquals("127.0.0.1|localhost", config.getNonProxyHosts());
}
Also used : EnvVars(hudson.EnvVars) ClientConfiguration(com.amazonaws.ClientConfiguration) Test(org.junit.Test)

Example 74 with ClientConfiguration

use of com.amazonaws.ClientConfiguration in project pipeline-aws-plugin by jenkinsci.

the class AWSClientFactory method getClientConfiguration.

private static ClientConfiguration getClientConfiguration(EnvVars vars) {
    ClientConfiguration clientConfiguration = new ClientConfiguration();
    // the default max retry is 3. Increasing this to be more resilient to upstream errors
    clientConfiguration.setRetryPolicy(new RetryPolicy(null, null, 10, false));
    ProxyConfiguration.configure(vars, clientConfiguration);
    return clientConfiguration;
}
Also used : RetryPolicy(com.amazonaws.retry.RetryPolicy) ClientConfiguration(com.amazonaws.ClientConfiguration)

Example 75 with ClientConfiguration

use of com.amazonaws.ClientConfiguration in project iaf by ibissource.

the class AmazonS3FileSystem method getProxyConfig.

// public String getDestinationBucketName() {
// return destinationBucketName;
// }
// 
// public void setDestinationBucketName(String destinationBucketName) {
// this.destinationBucketName = destinationBucketName;
// }
// public String getBucketRegion() {
// return bucketRegion;
// }
// 
// public void setBucketRegion(String bucketRegion) {
// this.bucketRegion = bucketRegion;
// }
// public String getStorageClass() {
// return storageClass;
// }
// 
// public void setStorageClass(String storageClass) {
// this.storageClass = storageClass;
// }
// public String getTier() {
// return tier;
// }
// 
// public void setTier(String tier) {
// this.tier = tier;
// }
// public int getExpirationInDays() {
// return expirationInDays;
// }
// 
// public void setExpirationInDays(int experationInDays) {
// this.expirationInDays = experationInDays;
// }
// public boolean isStorageClassEnabled() {
// return storageClassEnabled;
// }
// 
// public void setStorageClassEnabled(boolean storageClassEnabled) {
// this.storageClassEnabled = storageClassEnabled;
// }
// public boolean isBucketCreationEnabled() {
// return bucketCreationEnabled;
// }
// public void setBucketCreationEnabled(boolean bucketCreationEnabled) {
// this.bucketCreationEnabled = bucketCreationEnabled;
// }
// 
// public boolean isBucketExistsThrowException() {
// return bucketExistsThrowException;
// }
public ClientConfiguration getProxyConfig() {
    ClientConfiguration proxyConfig = null;
    if (this.getProxyHost() != null && this.getProxyPort() != null) {
        proxyConfig = new ClientConfiguration();
        proxyConfig.setProtocol(Protocol.HTTPS);
        proxyConfig.setProxyHost(this.getProxyHost());
        proxyConfig.setProxyPort(this.getProxyPort());
    }
    return proxyConfig;
}
Also used : ClientConfiguration(com.amazonaws.ClientConfiguration)

Aggregations

ClientConfiguration (com.amazonaws.ClientConfiguration)134 Test (org.junit.Test)35 BasicAWSCredentials (com.amazonaws.auth.BasicAWSCredentials)29 AmazonS3Client (com.amazonaws.services.s3.AmazonS3Client)17 AWSCredentials (com.amazonaws.auth.AWSCredentials)14 AWSCredentialsProvider (com.amazonaws.auth.AWSCredentialsProvider)13 AWSStaticCredentialsProvider (com.amazonaws.auth.AWSStaticCredentialsProvider)13 AwsClientBuilder (com.amazonaws.client.builder.AwsClientBuilder)10 AwsParamsDto (org.finra.herd.model.dto.AwsParamsDto)8 ClientConfigurationFactory (com.amazonaws.ClientConfigurationFactory)7 EnvVars (hudson.EnvVars)7 File (java.io.File)7 AmazonS3ClientBuilder (com.amazonaws.services.s3.AmazonS3ClientBuilder)6 Configuration (org.apache.hadoop.conf.Configuration)6 AmazonClientException (com.amazonaws.AmazonClientException)5 DefaultAWSCredentialsProviderChain (com.amazonaws.auth.DefaultAWSCredentialsProviderChain)5 EndpointConfiguration (com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration)5 URI (java.net.URI)5 Properties (java.util.Properties)5 Test (org.testng.annotations.Test)5