com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration Java Examples

The following examples show how to use com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration. 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: SnsConfiguration.java    From data-highway with Apache License 2.0 7 votes vote down vote up
@Bean
public AmazonSNSAsync snsClient(
    @Value("${notification.sns.region}") String region,
    @Value("${notification.sns.endpointUrl:disabled}") String snsEndpointUrl) {
  if ("disabled".equalsIgnoreCase(snsEndpointUrl)) {
    return null;
  }
  AmazonSNSAsync client = AmazonSNSAsyncClientBuilder
      .standard()
      .withClientConfiguration(
          new ClientConfiguration().withRetryPolicy(PredefinedRetryPolicies.getDefaultRetryPolicy()))
      .withExecutorFactory(() -> Executors.newSingleThreadScheduledExecutor())
      .withEndpointConfiguration(new EndpointConfiguration(snsEndpointUrl, region))
      .build();
  return client;
}
 
Example #2
Source File: PutObject.java    From aws-doc-sdk-examples with Apache License 2.0 6 votes vote down vote up
public static PutObjectResult putObject(String containerName, String filePath, InputStream body) throws IOException {
    final String endpoint = getContainerEndpoint(containerName);
    if (endpoint == null || endpoint.isEmpty()) {
        System.err.println("Could not determine container endpoint!");
        System.exit(1);
    }
    final String region = new DefaultAwsRegionProviderChain().getRegion();
    final EndpointConfiguration endpointConfig = new EndpointConfiguration(endpoint, region);

    final AWSMediaStoreData mediastoredata = AWSMediaStoreDataClientBuilder
        .standard()
        .withEndpointConfiguration(endpointConfig)
        .build();
    final PutObjectRequest request = new PutObjectRequest()
        .withContentType("application/octet-stream")
        .withBody(body)
        .withPath(filePath);

    try {
        return mediastoredata.putObject(request);
    } catch (AWSMediaStoreException e) {
        System.err.println(e.getErrorMessage());
        System.exit(1);
    }
    return null;
}
 
Example #3
Source File: JceksAmazonS3ClientFactory.java    From circus-train with Apache License 2.0 6 votes vote down vote up
private AmazonS3 newInstance(
    String region,
    S3S3CopierOptions s3s3CopierOptions,
    HadoopAWSCredentialProviderChain credentialsChain) {
  AmazonS3ClientBuilder builder = AmazonS3ClientBuilder
      .standard()
      .withCredentials(credentialsChain);

  applyClientConfigurations(builder, s3s3CopierOptions);

  URI s3Endpoint = s3s3CopierOptions.getS3Endpoint(region);
  if (s3Endpoint != null) {
    EndpointConfiguration endpointConfiguration = new EndpointConfiguration(s3Endpoint.toString(), region);
    builder.withEndpointConfiguration(endpointConfiguration);
  } else {
    builder.withRegion(region);
  }

  return builder.build();
}
 
Example #4
Source File: JceksAmazonS3ClientFactory.java    From circus-train with Apache License 2.0 6 votes vote down vote up
private AmazonS3 newGlobalInstance(
    S3S3CopierOptions s3s3CopierOptions,
    HadoopAWSCredentialProviderChain credentialsChain) {
  AmazonS3ClientBuilder builder = AmazonS3ClientBuilder
      .standard()
      .withForceGlobalBucketAccessEnabled(Boolean.TRUE)
      .withCredentials(credentialsChain);

  applyClientConfigurations(builder, s3s3CopierOptions);

  URI s3Endpoint = s3s3CopierOptions.getS3Endpoint();
  if (s3Endpoint != null) {
    EndpointConfiguration endpointConfiguration = new EndpointConfiguration(s3Endpoint.toString(),
        Region.US_Standard.getFirstRegionId());
    builder.withEndpointConfiguration(endpointConfiguration);
  }
  return builder.build();
}
 
Example #5
Source File: GlueHiveMetastore.java    From presto with Apache License 2.0 6 votes vote down vote up
private static AWSGlueAsync createAsyncGlueClient(GlueHiveMetastoreConfig config, Optional<RequestHandler2> requestHandler)
{
    ClientConfiguration clientConfig = new ClientConfiguration().withMaxConnections(config.getMaxGlueConnections());
    AWSGlueAsyncClientBuilder asyncGlueClientBuilder = AWSGlueAsyncClientBuilder.standard()
            .withClientConfiguration(clientConfig);

    requestHandler.ifPresent(asyncGlueClientBuilder::setRequestHandlers);

    if (config.getGlueEndpointUrl().isPresent()) {
        checkArgument(config.getGlueRegion().isPresent(), "Glue region must be set when Glue endpoint URL is set");
        asyncGlueClientBuilder.setEndpointConfiguration(new EndpointConfiguration(
                config.getGlueEndpointUrl().get(),
                config.getGlueRegion().get()));
    }
    else if (config.getGlueRegion().isPresent()) {
        asyncGlueClientBuilder.setRegion(config.getGlueRegion().get());
    }
    else if (config.getPinGlueClientToCurrentRegion()) {
        asyncGlueClientBuilder.setRegion(getCurrentRegionFromEC2Metadata().getName());
    }

    asyncGlueClientBuilder.setCredentials(getAwsCredentialsProvider(config));

    return asyncGlueClientBuilder.build();
}
 
Example #6
Source File: S3.java    From rdf-delta with Apache License 2.0 6 votes vote down vote up
public static AmazonS3 buildS3(LocalServerConfig configuration) {
    String region = configuration.getProperty(pRegion);
    String endpoint = configuration.getProperty(pEndpoint);
    String credentialsFile =  configuration.getProperty(pCredentialFile);
    String credentialsProfile =  configuration.getProperty(pCredentialProfile);

    AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard();
    if ( endpoint == null )
        builder.withRegion(region);
    else  {
        // Needed for S3mock
        builder.withPathStyleAccessEnabled(true);
        builder.withEndpointConfiguration(new EndpointConfiguration(endpoint, region));
        builder.withCredentials(new AWSStaticCredentialsProvider(new AnonymousAWSCredentials()));
    }
    if ( credentialsFile != null )
        builder.withCredentials(new ProfileCredentialsProvider(credentialsFile, credentialsProfile));
    return builder.build();
}
 
Example #7
Source File: DynamoDBClientPool.java    From geowave with Apache License 2.0 6 votes vote down vote up
public synchronized AmazonDynamoDBAsync getClient(final DynamoDBOptions options) {
  AmazonDynamoDBAsync client = clientCache.get(options);
  if (client == null) {

    if ((options.getRegion() == null)
        && ((options.getEndpoint() == null) || options.getEndpoint().isEmpty())) {
      throw new ParameterException("Compulsory to specify either the region or the endpoint");
    }

    final ClientConfiguration clientConfig = options.getClientConfig();
    final AmazonDynamoDBAsyncClientBuilder builder =
        AmazonDynamoDBAsyncClientBuilder.standard().withClientConfiguration(clientConfig);
    if ((options.getEndpoint() != null) && (options.getEndpoint().length() > 0)) {
      builder.withEndpointConfiguration(
          new EndpointConfiguration(
              options.getEndpoint(),
              options.getRegion() != null ? options.getRegion().getName() : "local"));
    } else {
      builder.withRegion(options.getRegion());
    }
    client = builder.build();
    clientCache.put(options, client);
  }
  return client;
}
 
Example #8
Source File: TestWhiteListedBuckets.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() {
  this.s3Mock = new S3Mock.Builder().withPort(0).withInMemoryBackend().build();
  Http.ServerBinding binding = s3Mock.start();
  port = binding.localAddress().getPort();

  EndpointConfiguration endpoint = new EndpointConfiguration(String.format("http://localhost:%d", port), Region.US_EAST_1.toString());
  AmazonS3 client = AmazonS3ClientBuilder
    .standard()
    .withPathStyleAccessEnabled(true)
    .withEndpointConfiguration(endpoint)
    .withCredentials(new AWSStaticCredentialsProvider(new AnonymousAWSCredentials()))
    .build();

  client.createBucket("bucket-a");
  client.createBucket("bucket-b");
  client.createBucket("bucket-c");
}
 
Example #9
Source File: ITSQSCollector.java    From zipkin-aws with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() {
  store = InMemoryStorage.newBuilder().build();
  metrics = new InMemoryCollectorMetrics();

  collector =
      new SQSCollector.Builder()
          .queueUrl(sqsRule.queueUrl())
          .parallelism(2)
          .waitTimeSeconds(1) // using short wait time to make test teardown faster
          .endpointConfiguration(new EndpointConfiguration(sqsRule.queueUrl(), "us-east-1"))
          .credentialsProvider(
              new AWSStaticCredentialsProvider(new BasicAWSCredentials("x", "x")))
          .metrics(metrics)
          .sampler(CollectorSampler.ALWAYS_SAMPLE)
          .storage(store)
          .build()
          .start();
  metrics = metrics.forTransport("sqs");
}
 
Example #10
Source File: AwsSdkTest.java    From s3proxy with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    TestUtils.S3ProxyLaunchInfo info = TestUtils.startS3Proxy(
            "s3proxy.conf");
    awsCreds = new BasicAWSCredentials(info.getS3Identity(),
            info.getS3Credential());
    context = info.getBlobStore().getContext();
    s3Proxy = info.getS3Proxy();
    s3Endpoint = info.getSecureEndpoint();
    servicePath = info.getServicePath();
    s3EndpointConfig = new EndpointConfiguration(
            s3Endpoint.toString() + servicePath, "us-east-1");
    client = AmazonS3ClientBuilder.standard()
            .withCredentials(new AWSStaticCredentialsProvider(awsCreds))
            .withEndpointConfiguration(s3EndpointConfig)
            .build();

    containerName = createRandomContainerName();
    info.getBlobStore().createContainerInLocation(null, containerName);

    blobStoreType = context.unwrap().getProviderMetadata().getId();
    if (Quirks.OPAQUE_ETAG.contains(blobStoreType)) {
        System.setProperty(
                SkipMd5CheckStrategy
                        .DISABLE_GET_OBJECT_MD5_VALIDATION_PROPERTY,
                "true");
        System.setProperty(
                SkipMd5CheckStrategy
                        .DISABLE_PUT_OBJECT_MD5_VALIDATION_PROPERTY,
                "true");
    }
}
 
Example #11
Source File: AwsS3ClientFactory.java    From circus-train with Apache License 2.0 5 votes vote down vote up
private static EndpointConfiguration getEndpointConfiguration(Configuration conf) {
  String endpointUrl = conf.get(ConfigurationVariable.S3_ENDPOINT_URI.getName());
  if (endpointUrl == null) {
    return null;
  }
  return new EndpointConfiguration(endpointUrl, getRegion(conf));
}
 
Example #12
Source File: CrossOriginResourceSharingResponseTest.java    From s3proxy with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    TestUtils.S3ProxyLaunchInfo info = TestUtils.startS3Proxy(
            "s3proxy-cors.conf");
    awsCreds = new BasicAWSCredentials(info.getS3Identity(),
            info.getS3Credential());
    context = info.getBlobStore().getContext();
    s3Proxy = info.getS3Proxy();
    s3Endpoint = info.getSecureEndpoint();
    servicePath = info.getServicePath();
    s3EndpointConfig = new EndpointConfiguration(
            s3Endpoint.toString() + servicePath, "us-east-1");
    s3Client = AmazonS3ClientBuilder.standard()
            .withCredentials(new AWSStaticCredentialsProvider(awsCreds))
            .withEndpointConfiguration(s3EndpointConfig)
            .build();
    httpClient = getHttpClient();

    containerName = createRandomContainerName();
    info.getBlobStore().createContainerInLocation(null, containerName);

    s3Client.setBucketAcl(containerName,
            CannedAccessControlList.PublicRead);

    String blobName = "test";
    ByteSource payload = ByteSource.wrap("blob-content".getBytes(
            StandardCharsets.UTF_8));
    Blob blob = info.getBlobStore().blobBuilder(blobName)
            .payload(payload).contentLength(payload.size()).build();
    info.getBlobStore().putBlob(containerName, blob);

    Date expiration = new Date(System.currentTimeMillis() +
            TimeUnit.HOURS.toMillis(1));
    presignedGET = s3Client.generatePresignedUrl(containerName, blobName,
            expiration, HttpMethod.GET).toURI();

    publicGET = s3Client.getUrl(containerName, blobName).toURI();
}
 
Example #13
Source File: CommandLineInterfaceTests.java    From dynamodb-cross-region-library with Apache License 2.0 5 votes vote down vote up
@Test
public void testKclDynamoDbClientDefault() {
    cmd.parse(sampleArgs);
    CommandLineInterface cli = new CommandLineInterface(args);
    EndpointConfiguration config = cli.createKclDynamoDbEndpointConfiguration();
    assertEquals(cli.getSourceRegion().getName(), config.getSigningRegion());
}
 
Example #14
Source File: CommandLineInterfaceTests.java    From dynamodb-cross-region-library with Apache License 2.0 5 votes vote down vote up
@Test
public void testCreateEndpointConfiguration() {
    final AwsClientBuilder.EndpointConfiguration config = CommandLineInterface.createEndpointConfiguration(RegionUtils.getRegion(Regions.US_EAST_1.getName()),
            Optional.<String>absent(), AmazonDynamoDB.ENDPOINT_PREFIX);
    assertTrue(config.getServiceEndpoint().contains("https"));
    assertTrue(config.getServiceEndpoint().contains(AmazonDynamoDB.ENDPOINT_PREFIX));
    assertEquals(Regions.US_EAST_1.getName(), config.getSigningRegion());
}
 
Example #15
Source File: KinesisSenderTest.java    From zipkin-aws with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
  sender =
      KinesisSender.newBuilder()
          .streamName("test")
          .endpointConfiguration(
              new EndpointConfiguration(server.url("/").toString(), "us-east-1"))
          .credentialsProvider(new AWSStaticCredentialsProvider(new AnonymousAWSCredentials()))
          .build();
}
 
Example #16
Source File: AmazonSQSRule.java    From zipkin-aws with Apache License 2.0 5 votes vote down vote up
public AmazonSQSRule start(int httpPort) {
  if (server == null) {
    server = SQSRestServerBuilder.withPort(httpPort).withSQSLimits(SQSLimits.Strict()).start();
    server.waitUntilStarted();
  }

  if (client == null) {
    client = AmazonSQSClientBuilder.standard()
        .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("x", "x")))
        .withEndpointConfiguration(new EndpointConfiguration(String.format("http://localhost:%d", httpPort), null))
        .build();
    queueUrl = client.createQueue("zipkin").getQueueUrl();
  }
  return this;
}
 
Example #17
Source File: S3RepositoryAutoConfiguration.java    From hawkbit-extensions with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @return the {@link AmazonS3Client} if no other {@link AmazonS3} bean is
 *         registered.
 */
@Bean
@ConditionalOnMissingBean
public AmazonS3 amazonS3() {
    final AmazonS3ClientBuilder s3ClientBuilder = AmazonS3ClientBuilder.standard()
            .withCredentials(awsCredentialsProvider()).withClientConfiguration(awsClientConfiguration());
    if (!StringUtils.isEmpty(endpoint)) {
        final String signingRegion = StringUtils.isEmpty(region) ? "" : region;
        s3ClientBuilder.withEndpointConfiguration(new EndpointConfiguration(endpoint, signingRegion));
    } else if (!StringUtils.isEmpty(region)) {
        s3ClientBuilder.withRegion(region);
    }
    return s3ClientBuilder.build();
}
 
Example #18
Source File: S3T.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
public static Pair<PatchStore, S3Mock> setup() {
        TestingServer server = ZkT.localServer();
        String connectString = "localhost:" + server.getPort();
        int port = WebLib.choosePort();

        S3Mock api = new S3Mock.Builder()
            .withPort(port)
            .withInMemoryBackend().build();
        // Must start so provider.create works.
        api.start();

//      AWSCredentials credentials = new AnonymousAWSCredentials();
//      AmazonS3ClientBuilder
//          .standard()
//          .withPathStyleAccessEnabled(true)
//          .withEndpointConfiguration(endpoint)
//          .withCredentials(new AWSStaticCredentialsProvider(credentials))
//          .build();

        EndpointConfiguration endpointCfg = new EndpointConfiguration("http://localhost:"+port+"/", REGION);
        String endpoint = endpointCfg.getServiceEndpoint();

        S3Config cfg = S3Config.create()
            .bucketName(BUCKET_NAME)
            .region(REGION)
            .endpoint(endpoint)
            .build();
        LocalServerConfig config = S3.configZkS3(connectString, cfg);

        PatchStoreProvider provider = new PatchStoreProviderZkS3();
        PatchStore patchStore = provider.create(config);
        patchStore.initialize(new DataSourceRegistry("X"), config);
        return Pair.create(patchStore, api);
    }
 
Example #19
Source File: TestCmdServerZkS3.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
@Before public void before() {
    int port = WebLib.choosePort();
    EndpointConfiguration endpoint = new EndpointConfiguration("http://localhost:"+port, REGION);
    api = new S3Mock.Builder().withPort(port).withInMemoryBackend().build();
    api.start();
    endpointURL = endpoint.getServiceEndpoint();
}
 
Example #20
Source File: DocumentText.java    From aws-doc-sdk-examples with Apache License 2.0 5 votes vote down vote up
public static void main(String arg[]) throws Exception {
    
    // The S3 bucket and document
    String document = "";
    String bucket = "";

    
    AmazonS3 s3client = AmazonS3ClientBuilder.standard()
            .withEndpointConfiguration( 
                    new EndpointConfiguration("https://s3.amazonaws.com","us-east-1"))
            .build();
    
           
    // Get the document from S3
    com.amazonaws.services.s3.model.S3Object s3object = s3client.getObject(bucket, document);
    S3ObjectInputStream inputStream = s3object.getObjectContent();
    BufferedImage image = ImageIO.read(inputStream);

    // Call DetectDocumentText
    EndpointConfiguration endpoint = new EndpointConfiguration(
            "https://textract.us-east-1.amazonaws.com", "us-east-1");
    AmazonTextract client = AmazonTextractClientBuilder.standard()
            .withEndpointConfiguration(endpoint).build();


    DetectDocumentTextRequest request = new DetectDocumentTextRequest()
        .withDocument(new Document().withS3Object(new S3Object().withName(document).withBucket(bucket)));

    DetectDocumentTextResult result = client.detectDocumentText(request);
    
    // Create frame and panel.
    JFrame frame = new JFrame("RotateImage");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    DocumentText panel = new DocumentText(result, image);
    panel.setPreferredSize(new Dimension(image.getWidth() , image.getHeight() ));
    frame.setContentPane(panel);
    frame.pack();
    frame.setVisible(true);

}
 
Example #21
Source File: S3FileSystemTest.java    From beam with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void beforeClass() {
  api = new S3Mock.Builder().withInMemoryBackend().build();
  Http.ServerBinding binding = api.start();

  EndpointConfiguration endpoint =
      new EndpointConfiguration(
          "http://localhost:" + binding.localAddress().getPort(), "us-west-2");
  client =
      AmazonS3ClientBuilder.standard()
          .withPathStyleAccessEnabled(true)
          .withEndpointConfiguration(endpoint)
          .withCredentials(new AWSStaticCredentialsProvider(new AnonymousAWSCredentials()))
          .build();
}
 
Example #22
Source File: KmsEncryptionConfiguration.java    From spring-cloud-config-aws-kms with Apache License 2.0 5 votes vote down vote up
@Bean
public AWSKMS kms() {
    final AWSKMSClientBuilder builder = AWSKMSClient.builder();

    if (Optional.ofNullable(properties.getEndpoint()).isPresent()) {
        builder.withEndpointConfiguration(new EndpointConfiguration(properties.getEndpoint().getServiceEndpoint(), properties.getEndpoint().getSigningRegion()));
    } else {
        Optional.ofNullable(properties.getRegion()).ifPresent(builder::setRegion);
    }

    return builder.build();
}
 
Example #23
Source File: AbstractAmazonDockerClientsHolder.java    From spring-localstack with Apache License 2.0 5 votes vote down vote up
<S, T extends AwsClientBuilder<T, S>> S decorateWithConfigsAndBuild(
    T builder,
    Function<LocalstackDocker, String> endpointFunction
) {
    return builder
        .withCredentials(TestUtils.getCredentialsProvider())
        .withEndpointConfiguration(new EndpointConfiguration(
            endpointFunction.apply(localstackDocker),
            localstackDocker.getRegion()
        ))
        .build();
}
 
Example #24
Source File: LoadingBayApp.java    From data-highway with Apache License 2.0 5 votes vote down vote up
@Bean
AmazonS3 s3(
    @Value("${s3.endpoint.url}") String s3EndpointUrl,
    @Value("${s3.endpoint.signingRegion}") String signingRegion) {
  return AmazonS3Client
      .builder()
      .withCredentials(new DefaultAWSCredentialsProviderChain())
      .withEndpointConfiguration(new EndpointConfiguration(s3EndpointUrl, signingRegion))
      .build();
}
 
Example #25
Source File: TruckParkAppIntegrationTest.java    From data-highway with Apache License 2.0 5 votes vote down vote up
@Primary
@Bean
AmazonS3 testS3(@Value("${s3.port}") int port) {
  return AmazonS3Client
      .builder()
      .withCredentials(new AWSStaticCredentialsProvider(new AnonymousAWSCredentials()))
      .withEndpointConfiguration(new EndpointConfiguration("http://127.0.0.1:" + port, "us-west-2"))
      .build();
}
 
Example #26
Source File: S3Configuration.java    From data-highway with Apache License 2.0 5 votes vote down vote up
@Bean
@Lazy
AmazonS3 s3(
    @Value("${s3.endpoint.url}") String s3EndpointUrl,
    @Value("${s3.endpoint.signingRegion}") String signingRegion) {
  return AmazonS3Client
      .builder()
      .withCredentials(new DefaultAWSCredentialsProviderChain())
      .withEndpointConfiguration(new EndpointConfiguration(s3EndpointUrl, signingRegion))
      .build();
}
 
Example #27
Source File: S3KeyGenerator.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
@Override
public Void call() throws Exception {

  if (multiPart && fileSize < OM_MULTIPART_MIN_SIZE) {
    throw new IllegalArgumentException(
        "Size of multipart upload parts should be at least 5MB (5242880)");
  }
  init();

  AmazonS3ClientBuilder amazonS3ClientBuilder =
      AmazonS3ClientBuilder.standard()
          .withCredentials(new EnvironmentVariableCredentialsProvider());

  if (endpoint.length() > 0) {
    amazonS3ClientBuilder
        .withPathStyleAccessEnabled(true)
        .withEndpointConfiguration(
            new EndpointConfiguration(endpoint, "us-east-1"));

  } else {
    amazonS3ClientBuilder.withRegion(Regions.DEFAULT_REGION);
  }

  s3 = amazonS3ClientBuilder.build();

  content = RandomStringUtils.randomAscii(fileSize);

  timer = getMetrics().timer("key-create");

  System.setProperty(DISABLE_PUT_OBJECT_MD5_VALIDATION_PROPERTY, "true");
  runTests(this::createKey);

  return null;
}
 
Example #28
Source File: GlueTestClientFactory.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 5 votes vote down vote up
@Override
public AWSGlue newClient() throws MetaException {
  AWSGlueClientBuilder glueClientBuilder = AWSGlueClientBuilder.standard()
      .withClientConfiguration(createGatewayTimeoutRetryableConfiguration())
      .withCredentials(new DefaultAWSCredentialsProviderChain());

  String endpoint = System.getProperty("endpoint");
  if (StringUtils.isNotBlank(endpoint)) {
    glueClientBuilder.setEndpointConfiguration(new EndpointConfiguration(endpoint, null));
  }

  return glueClientBuilder.build();
}
 
Example #29
Source File: TowtruckApp.java    From data-highway with Apache License 2.0 5 votes vote down vote up
@Bean
AmazonS3 s3(
    @Value("${s3.endpoint.url}") String s3EndpointUrl,
    @Value("${s3.endpoint.signingRegion}") String signingRegion) {
  return AmazonS3Client
      .builder()
      .withCredentials(new DefaultAWSCredentialsProviderChain())
      .withEndpointConfiguration(new EndpointConfiguration(s3EndpointUrl, signingRegion))
      .build();
}
 
Example #30
Source File: DynamoClient.java    From xyz-hub with Apache License 2.0 5 votes vote down vote up
DynamoClient(String tableArn) {
  arn = new ARN(tableArn);

  final AmazonDynamoDBAsyncClientBuilder builder = AmazonDynamoDBAsyncClientBuilder.standard();
  if (isLocal()) {
    builder.setCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("dummy", "dummy")));
    final String endpoint = String.format("http://%s:%s", arn.getRegion(), Integer.parseInt(arn.getAccountId()));
    builder.setEndpointConfiguration(new EndpointConfiguration(endpoint, "US-WEST-1"));
  }

  client = builder.build();
  db = new DynamoDB(client);
  tableName = new ARN(tableArn).getResourceWithoutType();
}