[catsios3client] Extract as trait
This commit is contained in:
parent
69029730e2
commit
3eddc09a20
2 changed files with 15 additions and 6 deletions
|
@ -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))
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,17 +1,14 @@
|
||||||
package net.kemitix.s3thorp.awssdk
|
package net.kemitix.s3thorp.awssdk
|
||||||
|
|
||||||
import cats.effect.IO
|
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.Main.putStrLn
|
||||||
import net.kemitix.s3thorp.Sync.{Bucket, LocalFile, RemoteKey}
|
import net.kemitix.s3thorp.Sync.{Bucket, LocalFile, RemoteKey}
|
||||||
import software.amazon.awssdk.core.async.AsyncRequestBody
|
import software.amazon.awssdk.core.async.AsyncRequestBody
|
||||||
import software.amazon.awssdk.services.s3.model.{HeadObjectRequest, NoSuchKeyException, PutObjectRequest}
|
import software.amazon.awssdk.services.s3.model.{HeadObjectRequest, NoSuchKeyException, PutObjectRequest}
|
||||||
import software.amazon.awssdk.services.s3.{S3AsyncClient => JavaS3AsyncClient}
|
|
||||||
|
|
||||||
private class ReactiveS3Client extends S3Client {
|
private class ReactiveS3Client
|
||||||
|
extends S3Client
|
||||||
private val s3Client = S3CatsIOClient(S3AsyncClient(JavaS3AsyncClient.create))
|
with CatsIOS3Client {
|
||||||
|
|
||||||
override def objectHead(bucket: Bucket, remoteKey: RemoteKey) = {
|
override def objectHead(bucket: Bucket, remoteKey: RemoteKey) = {
|
||||||
val request = HeadObjectRequest.builder()
|
val request = HeadObjectRequest.builder()
|
||||||
|
|
Loading…
Reference in a new issue