com.amazonaws.Protocol Java Examples

The following examples show how to use com.amazonaws.Protocol. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientConfigurationHelper.java    From strongbox with Apache License 2.0 6 votes vote down vote up
public static com.amazonaws.ClientConfiguration transformAndVerifyOrThrow(ClientConfiguration clientConfiguration) {
    com.amazonaws.ClientConfiguration awsClientConfig = new com.amazonaws.ClientConfigurationFactory().getConfig();
    if (awsClientConfig.getProtocol() != Protocol.HTTPS) {
        throw new SecurityConfigurationException("Must use HTTPS protocol");
    }
    clientConfiguration.proxy.ifPresent(p -> {
        awsClientConfig.setProxyHost(p.proxyHost);
        awsClientConfig.setProxyPort(p.proxyPort);
        if (!p.nonProxyHosts.isEmpty()) {
            awsClientConfig.setNonProxyHosts(String.join("|", p.nonProxyHosts));
        }
        p.proxyUsername.ifPresent(awsClientConfig::setProxyUsername);
        p.proxyPassword.ifPresent(awsClientConfig::setProxyPassword);
    });
    return verifyOrThrow(awsClientConfig);
}
 
Example #2
Source File: AWSClientUtils.java    From camel-kafka-connector with Apache License 2.0 6 votes vote down vote up
public static AmazonSNS newSNSClient() {
    LOG.debug("Creating a custom SNS client for running a AWS SNS test");
    AmazonSNSClientBuilder clientBuilder = AmazonSNSClientBuilder
            .standard();

    String awsInstanceType = System.getProperty("aws-service.instance.type");
    String region = getRegion();

    if (awsInstanceType == null || awsInstanceType.equals("local-aws-container")) {
        String amazonHost = System.getProperty(AWSConfigs.AMAZON_AWS_HOST);

        ClientConfiguration clientConfiguration = new ClientConfiguration();
        clientConfiguration.setProtocol(Protocol.HTTP);

        clientBuilder
                .withClientConfiguration(clientConfiguration)
                .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(amazonHost, region))
                .withCredentials(new TestAWSCredentialsProvider("accesskey", "secretkey"));
    } else {
        clientBuilder
                .withRegion(region)
                .withCredentials(new TestAWSCredentialsProvider());
    }

    return clientBuilder.build();
}
 
Example #3
Source File: S3ClientSettings.java    From crate with Apache License 2.0 6 votes vote down vote up
private S3ClientSettings(AWSCredentials credentials,
                         String endpoint,
                         Protocol protocol,
                         String proxyHost,
                         int proxyPort,
                         String proxyUsername,
                         String proxyPassword,
                         int readTimeoutMillis,
                         int maxRetries,
                         boolean throttleRetries) {
    this.credentials = credentials;
    this.endpoint = endpoint;
    this.protocol = protocol;
    this.proxyHost = proxyHost;
    this.proxyPort = proxyPort;
    this.proxyUsername = proxyUsername;
    this.proxyPassword = proxyPassword;
    this.readTimeoutMillis = readTimeoutMillis;
    this.maxRetries = maxRetries;
    this.throttleRetries = throttleRetries;
}
 
Example #4
Source File: AwsS3ServiceImplTests.java    From crate with Apache License 2.0 6 votes vote down vote up
private void launchAWSConfigurationTest(Settings settings,
                                        Protocol expectedProtocol,
                                        String expectedProxyHost,
                                        int expectedProxyPort,
                                        String expectedProxyUsername,
                                        String expectedProxyPassword,
                                        Integer expectedMaxRetries,
                                        boolean expectedUseThrottleRetries,
                                        int expectedReadTimeout) {

    final S3ClientSettings clientSettings = S3ClientSettings.getClientSettings(settings);
    final ClientConfiguration configuration = S3Service.buildConfiguration(clientSettings);

    assertThat(configuration.getResponseMetadataCacheSize(), is(0));
    assertThat(configuration.getProtocol(), is(expectedProtocol));
    assertThat(configuration.getProxyHost(), is(expectedProxyHost));
    assertThat(configuration.getProxyPort(), is(expectedProxyPort));
    assertThat(configuration.getProxyUsername(), is(expectedProxyUsername));
    assertThat(configuration.getProxyPassword(), is(expectedProxyPassword));
    assertThat(configuration.getMaxErrorRetry(), is(expectedMaxRetries));
    assertThat(configuration.useThrottledRetries(), is(expectedUseThrottleRetries));
    assertThat(configuration.getSocketTimeout(), is(expectedReadTimeout));
}
 
Example #5
Source File: WarehouseExport.java    From usergrid with Apache License 2.0 6 votes vote down vote up
private void copyToS3( String fileName ) {

        String bucketName = ( String ) properties.get( BUCKET_PROPNAME );
        String accessId = ( String ) properties.get( ACCESS_ID_PROPNAME );
        String secretKey = ( String ) properties.get( SECRET_KEY_PROPNAME );

        Properties overrides = new Properties();
        overrides.setProperty( "s3" + ".identity", accessId );
        overrides.setProperty( "s3" + ".credential", secretKey );

        final Iterable<? extends Module> MODULES = ImmutableSet
                .of( new JavaUrlHttpCommandExecutorServiceModule(), new Log4JLoggingModule(),
                        new NettyPayloadModule() );

        AWSCredentials credentials = new BasicAWSCredentials(accessId, secretKey);
        ClientConfiguration clientConfig = new ClientConfiguration();
        clientConfig.setProtocol( Protocol.HTTP);

        AmazonS3Client s3Client = new AmazonS3Client(credentials, clientConfig);

        s3Client.createBucket( bucketName );
        File uploadFile = new File( fileName );
        PutObjectResult putObjectResult = s3Client.putObject( bucketName, uploadFile.getName(), uploadFile );
        logger.info("Uploaded file etag={}", putObjectResult.getETag());
    }
 
Example #6
Source File: AWSBinaryStore.java    From usergrid with Apache License 2.0 6 votes vote down vote up
private AmazonS3 getS3Client() throws Exception{

        this.bucketName = properties.getProperty( "usergrid.binary.bucketname" );
        if(bucketName == null){
            logger.error( "usergrid.binary.bucketname not properly set so amazon bucket is null" );
            throw new AwsPropertiesNotFoundException( "usergrid.binary.bucketname" );

        }

        final UsergridAwsCredentialsProvider ugProvider = new UsergridAwsCredentialsProvider();
        AWSCredentials credentials = ugProvider.getCredentials();
        ClientConfiguration clientConfig = new ClientConfiguration();
        clientConfig.setProtocol(Protocol.HTTP);

        s3Client = new AmazonS3Client(credentials, clientConfig);
        if(regionName != null)
            s3Client.setRegion( Region.getRegion(Regions.fromName(regionName)) );

        return s3Client;
    }
 
Example #7
Source File: S3URLConnection.java    From geowave with Apache License 2.0 6 votes vote down vote up
private ClientConfiguration buildClientConfig() {
  final String userAgent = System.getProperty(PROP_S3_HANDLER_USER_AGENT, null);
  final String protocol = System.getProperty(PROP_S3_HANDLER_PROTOCOL, "https");
  final String signerOverride = System.getProperty(PROP_S3_HANDLER_SIGNER_OVERRIDE, null);

  final ClientConfiguration clientConfig =
      new ClientConfiguration().withProtocol(
          "https".equalsIgnoreCase(protocol) ? Protocol.HTTPS : Protocol.HTTP);

  if (userAgent != null) {
    clientConfig.setUserAgent(userAgent);
  }
  if (signerOverride != null) {
    clientConfig.setSignerOverride(signerOverride);
  }

  return clientConfig;
}
 
Example #8
Source File: DynamoDBOptions.java    From geowave with Apache License 2.0 6 votes vote down vote up
public DynamoDBOptions(
    final String endpoint,
    final Regions region,
    final long writeCapacity,
    final long readCapacity,
    final int maxConnections,
    final Protocol protocol,
    final boolean enableCacheResponseMetadata,
    final String gwNamespace,
    final BaseDataStoreOptions baseOptions) {
  super(gwNamespace);
  this.endpoint = endpoint;
  this.region = region;
  this.writeCapacity = writeCapacity;
  this.readCapacity = readCapacity;
  this.maxConnections = maxConnections;
  this.protocol = protocol;
  this.enableCacheResponseMetadata = enableCacheResponseMetadata;
  this.baseOptions = baseOptions;
}
 
Example #9
Source File: KinesisPersistReader.java    From streams with Apache License 2.0 6 votes vote down vote up
@Override
public void prepare(Object configurationObject) {
  // Connect to Kinesis
  synchronized (this) {
    // Create the credentials Object
    AWSCredentials credentials = new BasicAWSCredentials(config.getKey(), config.getSecretKey());

    ClientConfiguration clientConfig = new ClientConfiguration();
    clientConfig.setProtocol(Protocol.valueOf(config.getProtocol().toString()));

    this.client = new AmazonKinesisClient(credentials, clientConfig);
    if (StringUtils.isNotEmpty(config.getRegion()))
      this.client.setRegion(Region.getRegion(Regions.fromName(config.getRegion())));
  }
  streamNames = this.config.getStreams();
  executor = Executors.newFixedThreadPool(streamNames.size());
}
 
Example #10
Source File: KinesisPersistWriter.java    From streams with Apache License 2.0 6 votes vote down vote up
@Override
public void prepare(Object configurationObject) {
  // Connect to Kinesis
  synchronized (this) {
    // Create the credentials Object
    AWSCredentials credentials = new BasicAWSCredentials(config.getKey(), config.getSecretKey());

    ClientConfiguration clientConfig = new ClientConfiguration();
    clientConfig.setProtocol(Protocol.valueOf(config.getProtocol().toString()));

    this.client = new AmazonKinesisClient(credentials, clientConfig);
    if (StringUtils.isNotEmpty(config.getRegion())) {
      this.client.setRegion(Region.getRegion(Regions.fromName(config.getRegion())));
    }
  }
  executor = Executors.newSingleThreadExecutor();

}
 
Example #11
Source File: S3PersistWriter.java    From streams with Apache License 2.0 5 votes vote down vote up
@Override
public void prepare(Object configurationObject) {

  lineWriterUtil = LineReadWriteUtil.getInstance(s3WriterConfiguration);

  // Connect to S3
  synchronized (this) {

    try {
      // if the user has chosen to not set the object mapper, then set a default object mapper for them.
      if (this.objectMapper == null) {
        this.objectMapper = StreamsJacksonMapper.getInstance();
      }

      // Create the credentials Object
      if (this.amazonS3Client == null) {
        AWSCredentials credentials = new BasicAWSCredentials(s3WriterConfiguration.getKey(), s3WriterConfiguration.getSecretKey());

        ClientConfiguration clientConfig = new ClientConfiguration();
        clientConfig.setProtocol(Protocol.valueOf(s3WriterConfiguration.getProtocol().toString()));

        // We do not want path style access
        S3ClientOptions clientOptions = new S3ClientOptions();
        clientOptions.setPathStyleAccess(false);

        this.amazonS3Client = new AmazonS3Client(credentials, clientConfig);
        if (StringUtils.isNotEmpty(s3WriterConfiguration.getRegion())) {
          this.amazonS3Client.setRegion(Region.getRegion(Regions.fromName(s3WriterConfiguration.getRegion())));
        }
        this.amazonS3Client.setS3ClientOptions(clientOptions);
      }
    } catch (Exception ex) {
      LOGGER.error("Exception while preparing the S3 client: {}", ex);
    }

    Preconditions.checkArgument(this.amazonS3Client != null);
  }
}
 
Example #12
Source File: AwsS3ServiceImplTests.java    From crate with Apache License 2.0 5 votes vote down vote up
@Test
public void testRepositoryThrottleRetries() {
    final boolean throttling = randomBoolean();

    final Settings settings = Settings.builder().put("use_throttle_retries", throttling).build();
    launchAWSConfigurationTest(settings, Protocol.HTTPS, null, -1, null, null, 3, throttling, 50000);
}
 
Example #13
Source File: S3ClientFactory.java    From front50 with Apache License 2.0 5 votes vote down vote up
public static AmazonS3 create(
    AWSCredentialsProvider awsCredentialsProvider, S3Properties s3Properties) {
  ClientConfiguration clientConfiguration = new ClientConfiguration();
  if (s3Properties.getProxyProtocol() != null) {
    if (s3Properties.getProxyProtocol().equalsIgnoreCase("HTTPS")) {
      clientConfiguration.setProtocol(Protocol.HTTPS);
    } else {
      clientConfiguration.setProtocol(Protocol.HTTP);
    }
    Optional.ofNullable(s3Properties.getProxyHost()).ifPresent(clientConfiguration::setProxyHost);
    Optional.ofNullable(s3Properties.getProxyPort())
        .map(Integer::parseInt)
        .ifPresent(clientConfiguration::setProxyPort);
  }

  AmazonS3Client client = new AmazonS3Client(awsCredentialsProvider, clientConfiguration);

  if (!StringUtils.isEmpty(s3Properties.getEndpoint())) {
    client.setEndpoint(s3Properties.getEndpoint());

    if (!StringUtils.isEmpty(s3Properties.getRegionOverride())) {
      client.setSignerRegionOverride(s3Properties.getRegionOverride());
    }

    client.setS3ClientOptions(
        S3ClientOptions.builder().setPathStyleAccess(s3Properties.getPathStyleAccess()).build());
  } else {
    Optional.ofNullable(s3Properties.getRegion())
        .map(Regions::fromName)
        .map(Region::getRegion)
        .ifPresent(client::setRegion);
  }

  return client;
}
 
Example #14
Source File: AwsS3ServiceImplTests.java    From crate with Apache License 2.0 5 votes vote down vote up
@Test
public void testAWSConfigurationWithAwsSettings() {
    final Settings settings = Settings.builder()
        .put("proxy_username", "aws_proxy_username")
        .put("proxy_password", "aws_proxy_password")
        .put("protocol", "http")
        .put("proxy_host", "aws_proxy_host")
        .put("proxy_port", 8080)
        .put("read_timeout", "10s")
        .build();
    launchAWSConfigurationTest(
        settings, Protocol.HTTP, "aws_proxy_host", 8080, "aws_proxy_username",
        "aws_proxy_password", 3, ClientConfiguration.DEFAULT_THROTTLE_RETRIES, 10000);
}
 
Example #15
Source File: SqsClientConfigurationTest.java    From spring-integration-aws with MIT License 5 votes vote down vote up
@Test
public void testClientConfigurationInjectedExplicitly() {

	setUp("SqsClientConfigurationTests.xml", getClass(),
			"sqsChannelWithClientConfiguration");

	final ClientConfiguration clientConfiguration = TestUtils
			.getPropertyValue(sqsChannelWithClientConfiguration,
					"sqsExecutor.awsClientConfiguration",
					ClientConfiguration.class);
	assertThat(clientConfiguration.getProtocol(), is(Protocol.HTTPS));
	assertThat(clientConfiguration.getProxyHost(), is("PROXY_HOST"));
}
 
Example #16
Source File: SnsClientConfigurationTest.java    From spring-integration-aws with MIT License 5 votes vote down vote up
@Test
public void testClientConfigurationInjectedExplicitly() {

	setUp("SnsClientConfigurationTests.xml", getClass(),
			"snsChannelWithClientConfiguration");

	final ClientConfiguration clientConfiguration = TestUtils
			.getPropertyValue(snsChannelWithClientConfiguration,
					"snsExecutor.awsClientConfiguration",
					ClientConfiguration.class);
	assertThat(clientConfiguration.getProtocol(), is(Protocol.HTTPS));
	assertThat(clientConfiguration.getProxyHost(), is("PROXY_HOST"));
}
 
Example #17
Source File: AwsS3ServiceImplTests.java    From crate with Apache License 2.0 5 votes vote down vote up
@Test
public void testAWSDefaultConfiguration() {
    launchAWSConfigurationTest(
        Settings.EMPTY,
        Protocol.HTTPS,
        null,
        -1,
        null,
        null,
        3,
        ClientConfiguration.DEFAULT_THROTTLE_RETRIES,
        ClientConfiguration.DEFAULT_SOCKET_TIMEOUT);
}
 
Example #18
Source File: S3ClientSettingsTests.java    From crate with Apache License 2.0 5 votes vote down vote up
@Test
public void testThereIsADefaultClientByDefault() {
    final S3ClientSettings settings = S3ClientSettings.getClientSettings(Settings.EMPTY);

    assertThat(settings.credentials, nullValue());
    assertThat(settings.endpoint, is(emptyString()));
    assertThat(settings.protocol, is(Protocol.HTTPS));
    assertThat(settings.proxyHost, is(emptyString()));
    assertThat(settings.proxyPort, is(80));
    assertThat(settings.proxyUsername, is(emptyString()));
    assertThat(settings.proxyPassword, is(emptyString()));
    assertThat(settings.readTimeoutMillis, is(ClientConfiguration.DEFAULT_SOCKET_TIMEOUT));
    assertThat(settings.maxRetries, is(ClientConfiguration.DEFAULT_RETRY_POLICY.getMaxErrorRetry()));
    assertThat(settings.throttleRetries, is(ClientConfiguration.DEFAULT_THROTTLE_RETRIES));
}
 
Example #19
Source File: DynamoDBOptions.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public Protocol convert(final String protocolName) {
  final String protocolUpperCase = protocolName.toUpperCase();
  if (!protocolUpperCase.equals("HTTP") && !protocolUpperCase.equals("HTTPS")) {
    throw new ParameterException(
        "Value "
            + protocolName
            + "can not be converted to Protocol. "
            + "Available values are: http and https.");
  }

  return Protocol.valueOf(protocolUpperCase);
}
 
Example #20
Source File: LambdaAggregatingForwarder.java    From kinesis-aggregation with Apache License 2.0 5 votes vote down vote up
/**
 * One-time initialization of resources for this Lambda function.
 */
public LambdaAggregatingForwarder()
{
    this.aggregator = new RecordAggregator();
    
    /*
     * If the Kinesis stream you're forwarding to is in the same account as this AWS Lambda function, you can just give the IAM Role executing
     * this function permissions to publish to the stream and DefaultAWSCredentialsProviderChain() will take care of it.  
     * 
     * If you're publishing to a Kinesis stream in another AWS account, it's trickier.  Kinesis doesn't currently provide cross-account publishing
     * permissions. You must create an IAM role in the AWS account with the DESTINATION stream that has permissions to publish to that stream
     * (fill that IAM role's ARN in for "<RoleToAssumeARN>" below) and then the IAM role executing this Lambda function must be given permission
     * to assume the role "<RoleToAssumeARN>" from the other AWS account.  
     */
    AWSCredentialsProvider provider = new DefaultAWSCredentialsProviderChain();
    //AWSCredentialsProvider provider = new STSAssumeRoleSessionCredentialsProvider(new DefaultAWSCredentialsProviderChain(), "<RoleToAssumeARN>", "KinesisForwarder");
    
    //Set max conns to 1 since we use this client serially
    ClientConfiguration kinesisConfig = new ClientConfiguration();
    kinesisConfig.setMaxConnections(1);
    kinesisConfig.setProtocol(Protocol.HTTPS);
    kinesisConfig.setConnectionTimeout(DESTINATION_CONNECTION_TIMEOUT);
    kinesisConfig.setSocketTimeout(DESTINATION_SOCKET_TIMEOUT);
    
    this.kinesisForwarder = new AmazonKinesisClient(provider, kinesisConfig);
    this.kinesisForwarder.setRegion(Region.getRegion(DESTINATION_STREAM_REGION));
}
 
Example #21
Source File: ProxyTest.java    From pipeline-aws-plugin with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example #22
Source File: ProxyTest.java    From pipeline-aws-plugin with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example #23
Source File: ProxyTest.java    From pipeline-aws-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldParseProxyWithAuth() throws Exception {
	EnvVars vars = new EnvVars();
	vars.put(ProxyConfiguration.HTTPS_PROXY, "http://foo:[email protected]:8888/");
	ClientConfiguration config = new ClientConfiguration();
	config.setProtocol(Protocol.HTTPS);
	ProxyConfiguration.configure(vars, config);

	Assert.assertEquals("foo", config.getProxyUsername());
	Assert.assertEquals("bar", config.getProxyPassword());
	Assert.assertEquals("127.0.0.1", config.getProxyHost());
	Assert.assertEquals(8888, config.getProxyPort());
}
 
Example #24
Source File: ProxyTest.java    From pipeline-aws-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldParseProxyLowerCase() throws Exception {
	EnvVars vars = new EnvVars();
	vars.put(ProxyConfiguration.HTTPS_PROXY_LC, "http://127.0.0.1:8888/");
	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(8888, config.getProxyPort());
}
 
Example #25
Source File: ProxyTest.java    From pipeline-aws-plugin with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example #26
Source File: ProxyTest.java    From pipeline-aws-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldParseProxy() throws Exception {
	EnvVars vars = new EnvVars();
	vars.put(ProxyConfiguration.HTTPS_PROXY, "http://127.0.0.1:8888/");
	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(8888, config.getProxyPort());
}
 
Example #27
Source File: ProxyTest.java    From pipeline-aws-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotChangeIfNotPresent() throws Exception {
	ClientConfiguration config = new ClientConfiguration();
	config.setProtocol(Protocol.HTTPS);
	ProxyConfiguration.configure(new EnvVars(), config);

	Assert.assertNull(config.getProxyUsername());
	Assert.assertNull(config.getProxyPassword());
	Assert.assertNull(config.getProxyHost());
	Assert.assertEquals(-1, config.getProxyPort());
}
 
Example #28
Source File: ProxyConfiguration.java    From pipeline-aws-plugin with Apache License 2.0 5 votes vote down vote up
static void configure(EnvVars vars, ClientConfiguration config) {
	useJenkinsProxy(config);

	if (config.getProtocol() == Protocol.HTTP) {
		configureHTTP(vars, config);
	} else {
		configureHTTPS(vars, config);
	}
	configureNonProxyHosts(vars, config);
}
 
Example #29
Source File: AWSKinesisLocalContainerService.java    From camel-kafka-connector with Apache License 2.0 5 votes vote down vote up
@Override
public AmazonKinesis getClient() {
    ClientConfiguration clientConfiguration = new ClientConfiguration();
    clientConfiguration.setProtocol(Protocol.HTTP);

    return AmazonKinesisClientBuilder
            .standard()
            .withEndpointConfiguration(getContainer().getEndpointConfiguration(LocalStackContainer.Service.KINESIS))
            .withCredentials(getContainer().getDefaultCredentialsProvider())
            .withClientConfiguration(clientConfiguration)
            .build();
}
 
Example #30
Source File: JavaKinesisVideoServiceClient.java    From amazon-kinesis-video-streams-producer-sdk-java with Apache License 2.0 5 votes vote down vote up
private static ClientConfiguration createClientConfiguration(final int timeoutInMillis) {
    return new ClientConfiguration()
            .withProtocol(Protocol.HTTPS)
            .withConnectionTimeout(timeoutInMillis)
            .withMaxConnections(DEFAULT_MAX_CONNECTIONS)
            .withSocketTimeout(timeoutInMillis)
            .withUserAgentPrefix(VersionUtil.getUserAgent());
}