Search in sources :

Example 76 with ClientConfiguration

use of com.amazonaws.ClientConfiguration in project aws-xray-sdk-java by aws.

the class XRayClient method newClient.

/**
 * @deprecated aws-xray-recorder only supports communicating with the X-Ray daemon, which does
 * not require the usual AWS API signatures so we have stopped using the SDK X-Ray client.
 */
@Deprecated
public static AWSXRay newClient() {
    DaemonConfiguration config = new DaemonConfiguration();
    ClientConfiguration clientConfig = new ClientConfiguration().withRequestTimeout(TIME_OUT);
    AwsClientBuilder.EndpointConfiguration endpointConfig = new AwsClientBuilder.EndpointConfiguration(config.getEndpointForTCPConnection(), DUMMY_REGION);
    return AWSXRayClientBuilder.standard().withEndpointConfiguration(endpointConfig).withClientConfiguration(clientConfig).withCredentials(// This will entirely skip signing too
    ANONYMOUS_CREDENTIALS).build();
}
Also used : DaemonConfiguration(com.amazonaws.xray.config.DaemonConfiguration) AwsClientBuilder(com.amazonaws.client.builder.AwsClientBuilder) ClientConfiguration(com.amazonaws.ClientConfiguration)

Example 77 with ClientConfiguration

use of com.amazonaws.ClientConfiguration in project bender by Nextdoor.

the class FirehoseTransportFactory method setConf.

@Override
public void setConf(AbstractConfig config) {
    this.config = (FirehoseTransportConfig) config;
    this.serializer = new FirehoseTransportSerializer(this.config.getAppendNewline());
    this.client = new AmazonKinesisFirehoseClient(new ClientConfiguration().withGzip(true));
    if (this.config.getRegion() != null) {
        this.client.withRegion(this.config.getRegion());
    }
}
Also used : AmazonKinesisFirehoseClient(com.amazonaws.services.kinesisfirehose.AmazonKinesisFirehoseClient) ClientConfiguration(com.amazonaws.ClientConfiguration)

Example 78 with ClientConfiguration

use of com.amazonaws.ClientConfiguration in project kork by spinnaker.

the class SNSPublisherProvider method start.

@PostConstruct
public void start() {
    if (properties == null) {
        return;
    }
    List<PubsubPublisher> publishers = new ArrayList<>();
    properties.getSubscriptions().forEach((AmazonPubsubProperties.AmazonPubsubSubscription subscription) -> {
        ARN topicARN = new ARN(subscription.getTopicARN());
        log.info("Bootstrapping SNS topic: {}", topicARN);
        AmazonSNS amazonSNS = AmazonSNSClientBuilder.standard().withCredentials(awsCredentialsProvider).withClientConfiguration(new ClientConfiguration()).withRegion(topicARN.getRegion()).build();
        Supplier<Boolean> isEnabled = PubSubUtils.getEnabledSupplier(dynamicConfig, subscription, discoveryStatus);
        SNSPublisher publisher = new SNSPublisher(subscription, amazonSNS, isEnabled, registry, retrySupport);
        publishers.add(publisher);
    });
    pubsubPublishers.putAll(publishers);
}
Also used : PubsubPublisher(com.netflix.spinnaker.kork.pubsub.model.PubsubPublisher) ArrayList(java.util.ArrayList) ARN(com.netflix.spinnaker.kork.aws.ARN) ClientConfiguration(com.amazonaws.ClientConfiguration) AmazonSNS(com.amazonaws.services.sns.AmazonSNS) PostConstruct(javax.annotation.PostConstruct)

Example 79 with ClientConfiguration

use of com.amazonaws.ClientConfiguration in project kork by spinnaker.

the class SQSSubscriberProvider method start.

@PostConstruct
public void start() {
    Preconditions.checkNotNull(properties, "Can't initialize SQSSubscriberProvider with null properties");
    ExecutorService executorService = Executors.newFixedThreadPool(properties.getSubscriptions().size());
    List<PubsubSubscriber> subscribers = new ArrayList<>();
    properties.getSubscriptions().forEach((AmazonPubsubProperties.AmazonPubsubSubscription subscription) -> {
        log.info("Bootstrapping SQS for SNS topic: {}", subscription.getTopicARN());
        ARN queueArn = new ARN(subscription.getQueueARN());
        ARN topicArn = new ARN(subscription.getTopicARN());
        SQSSubscriber worker = new SQSSubscriber(subscription, pubsubMessageHandlerFactory.create(subscription), messageAcknowledger, AmazonSNSClientBuilder.standard().withCredentials(awsCredentialsProvider).withClientConfiguration(new ClientConfiguration()).withRegion(topicArn.getRegion()).build(), AmazonSQSClientBuilder.standard().withCredentials(awsCredentialsProvider).withClientConfiguration(new ClientConfiguration()).withRegion(queueArn.getRegion()).build(), PubSubUtils.getEnabledSupplier(dynamicConfig, subscription, discoveryStatus), registry);
        try {
            executorService.submit(worker);
            subscribers.add(worker);
            log.debug("Created worker {} for subscription: {}", worker.getWorkerName(), subscription.getName());
        } catch (RejectedExecutionException e) {
            log.error("Could not start {}", worker.getWorkerName(), e);
        }
    });
    pubsubSubscribers.putAll(subscribers);
}
Also used : PubsubSubscriber(com.netflix.spinnaker.kork.pubsub.model.PubsubSubscriber) ExecutorService(java.util.concurrent.ExecutorService) ArrayList(java.util.ArrayList) ARN(com.netflix.spinnaker.kork.aws.ARN) ClientConfiguration(com.amazonaws.ClientConfiguration) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) PostConstruct(javax.annotation.PostConstruct)

Example 80 with ClientConfiguration

use of com.amazonaws.ClientConfiguration in project presto by prestodb.

the class TestPrestoS3FileSystem method testUserAgentPrefix.

@Test
public void testUserAgentPrefix() throws Exception {
    String userAgentPrefix = "agent_prefix";
    Configuration config = new Configuration();
    config.set(S3_USER_AGENT_PREFIX, userAgentPrefix);
    try (PrestoS3FileSystem fs = new PrestoS3FileSystem()) {
        fs.initialize(new URI("s3n://test-bucket/"), config);
        ClientConfiguration clientConfig = getFieldValue(fs.getS3Client(), AmazonWebServiceClient.class, "clientConfiguration", ClientConfiguration.class);
        assertEquals(clientConfig.getUserAgentSuffix(), S3_USER_AGENT_SUFFIX);
        assertEquals(clientConfig.getUserAgentPrefix(), userAgentPrefix);
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) ClientConfiguration(com.amazonaws.ClientConfiguration) URI(java.net.URI) ClientConfiguration(com.amazonaws.ClientConfiguration) Test(org.testng.annotations.Test)

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