[Reactives3client] use S3CatsIOClient
This commit is contained in:
parent
f099765dd3
commit
837ab362c3
1 changed files with 7 additions and 7 deletions
|
@ -1,20 +1,20 @@
|
|||
package net.kemitix.s3thorp
|
||||
|
||||
import cats.effect.IO
|
||||
import com.github.j5ik2o.reactive.aws.s3.S3AsyncClient
|
||||
import com.github.j5ik2o.reactive.aws.s3.cats.S3CatsIOClient
|
||||
import software.amazon.awssdk.services.s3.model.HeadObjectRequest
|
||||
import software.amazon.awssdk.services.s3.{S3AsyncClient => JavaS3AsyncClient}
|
||||
|
||||
class ReactiveS3Client extends S3Client {
|
||||
|
||||
val s3Client = S3AsyncClient(JavaS3AsyncClient.create())
|
||||
private val s3Client = S3CatsIOClient(S3AsyncClient(JavaS3AsyncClient.create))
|
||||
|
||||
override def objectHead(bucket: String, key: String) = {
|
||||
IO.fromFuture(IO(
|
||||
s3Client.headObject(HeadObjectRequest.builder()
|
||||
val request = HeadObjectRequest.builder()
|
||||
.bucket(bucket)
|
||||
.key(key)
|
||||
.build()))).
|
||||
.build()
|
||||
s3Client.headObject(request).
|
||||
map(r => (r.eTag(), r.lastModified()))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue