[catsios3client] Extract as trait

This commit is contained in:
Paul Campbell 2019-05-09 21:11:46 +01:00
parent 69029730e2
commit 3eddc09a20
2 changed files with 15 additions and 6 deletions

View file

@ -0,0 +1,12 @@
package net.kemitix.s3thorp.awssdk
import com.github.j5ik2o.reactive.aws.s3.S3AsyncClient
import com.github.j5ik2o.reactive.aws.s3.cats.S3CatsIOClient
import software.amazon.awssdk.services.s3.{S3AsyncClient => JavaS3AsyncClient}
trait CatsIOS3Client {
def s3Client = S3CatsIOClient(S3AsyncClient(JavaS3AsyncClient.create))
}

View file

@ -1,17 +1,14 @@
package net.kemitix.s3thorp.awssdk
import cats.effect.IO
import com.github.j5ik2o.reactive.aws.s3.S3AsyncClient
import com.github.j5ik2o.reactive.aws.s3.cats.S3CatsIOClient
import net.kemitix.s3thorp.Main.putStrLn
import net.kemitix.s3thorp.Sync.{Bucket, LocalFile, RemoteKey}
import software.amazon.awssdk.core.async.AsyncRequestBody
import software.amazon.awssdk.services.s3.model.{HeadObjectRequest, NoSuchKeyException, PutObjectRequest}
import software.amazon.awssdk.services.s3.{S3AsyncClient => JavaS3AsyncClient}
private class ReactiveS3Client extends S3Client {
private val s3Client = S3CatsIOClient(S3AsyncClient(JavaS3AsyncClient.create))
private class ReactiveS3Client
extends S3Client
with CatsIOS3Client {
override def objectHead(bucket: Bucket, remoteKey: RemoteKey) = {
val request = HeadObjectRequest.builder()