Skip to content

Commit

Permalink
Fix weird Scala 3 doc compilation due to cyclic references to Java cl…
Browse files Browse the repository at this point in the history
…asses :/
  • Loading branch information
lorandszakacs committed Aug 5, 2021
1 parent 70a202e commit 558fb5c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import scala.concurrent.duration.FiniteDuration
object PureJavaS3 {

import software.amazon.awssdk.auth.credentials._
import software.amazon.awssdk.core.client.config._
import software.amazon.awssdk.core.client.config.{ClientAsyncConfiguration, ClientOverrideConfiguration}
import software.amazon.awssdk.services.s3.{S3AsyncClient, S3Configuration}

def buildClient(config: S3Config): S3AsyncClient = {
Expand All @@ -39,31 +39,25 @@ object PureJavaS3 {
val aWSCredentialsProvider: AwsCredentialsProvider =
StaticCredentialsProvider.create(awsCredentials)

val asyncConfig: ClientAsyncConfiguration = ClientAsyncConfiguration.builder().build()

val s3Config: S3Configuration =
S3Configuration.builder().build()

import scala.jdk.CollectionConverters._

val headers: java.util.Map[String, java.util.List[String]] =
config.headers.groupBy(_.name).view.mapValues(_.map(_.value).asJava).toMap.asJava

val overrideConfiguration: ClientOverrideConfiguration =
ClientOverrideConfiguration
.builder()
.apiCallAttemptTimeout(config.apiCallAttemptTimeout.asJava)
.apiCallTimeout(config.apiCallTimeout.asJava)
.headers(headers)
.build()

val builder = S3AsyncClient
.builder()
.credentialsProvider(aWSCredentialsProvider)
.region(config.region.toSDKRegion)
.serviceConfiguration(s3Config)
.asyncConfiguration(asyncConfig)
.overrideConfiguration(overrideConfiguration)
.serviceConfiguration(S3Configuration.builder().build())
.asyncConfiguration(ClientAsyncConfiguration.builder().build())
.overrideConfiguration(
ClientOverrideConfiguration
.builder()
.apiCallAttemptTimeout(config.apiCallAttemptTimeout.asJava)
.apiCallTimeout(config.apiCallTimeout.asJava)
.headers(headers)
.build()
)

val client: S3AsyncClient = config.endpointOverride match {
case None => builder.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import scala.concurrent.duration.FiniteDuration
object PureJavaS3 {

import software.amazon.awssdk.auth.credentials._
import software.amazon.awssdk.core.client.config._
import software.amazon.awssdk.core.client.config.{ClientAsyncConfiguration, ClientOverrideConfiguration}
import software.amazon.awssdk.services.s3.{S3AsyncClient, S3Configuration}

def buildClient(config: S3Config): S3AsyncClient = {
Expand All @@ -39,31 +39,25 @@ object PureJavaS3 {
val aWSCredentialsProvider: AwsCredentialsProvider =
StaticCredentialsProvider.create(awsCredentials)

val asyncConfig: ClientAsyncConfiguration = ClientAsyncConfiguration.builder().build()

val s3Config: S3Configuration =
S3Configuration.builder().build()

import scala.jdk.CollectionConverters._

val headers: java.util.Map[String, java.util.List[String]] =
config.headers.groupBy(_.name).view.mapValues(_.map(_.value).asJava).toMap.asJava

val overrideConfiguration: ClientOverrideConfiguration =
ClientOverrideConfiguration
.builder()
.apiCallAttemptTimeout(config.apiCallAttemptTimeout.asJava)
.apiCallTimeout(config.apiCallTimeout.asJava)
.headers(headers)
.build()

val builder = S3AsyncClient
.builder()
.credentialsProvider(aWSCredentialsProvider)
.region(config.region.toSDKRegion)
.serviceConfiguration(s3Config)
.asyncConfiguration(asyncConfig)
.overrideConfiguration(overrideConfiguration)
.serviceConfiguration(S3Configuration.builder().build())
.asyncConfiguration(ClientAsyncConfiguration.builder().build())
.overrideConfiguration(
ClientOverrideConfiguration
.builder()
.apiCallAttemptTimeout(config.apiCallAttemptTimeout.asJava)
.apiCallTimeout(config.apiCallTimeout.asJava)
.headers(headers)
.build()
)

val client: S3AsyncClient = config.endpointOverride match {
case None => builder.build()
Expand Down

0 comments on commit 558fb5c

Please sign in to comment.