All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.robothy.s3.jupiter.extensions.S3ClientResolver Maven / Gradle / Ivy

The newest version!
package com.robothy.s3.jupiter.extensions;

import lombok.SneakyThrows;
import software.amazon.awssdk.auth.credentials.AnonymousCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;

import java.net.URI;

public class S3ClientResolver extends AbstractLocalS3ParameterResolver {

  @Override
  protected String className() {
    return "software.amazon.awssdk.services.s3.S3Client";
  }

  @SneakyThrows
  @Override
  protected Object resolve(int port) {
    String endpoint = "http://localhost:" + port;

    return S3Client.builder()
      .forcePathStyle(true)
      .endpointOverride(new URI(endpoint))
      .region(Region.of("local"))
      .credentialsProvider(AnonymousCredentialsProvider.create())
      .build();
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy