From b61499ed8f4b052097ad0793a5ee91b2c8873e01 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 10 May 2019 08:24:40 +0100 Subject: [PATCH] [reactives3client] remove logging --- .../s3thorp/awssdk/ReactiveS3Client.scala | 26 ++++--------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/src/main/scala/net/kemitix/s3thorp/awssdk/ReactiveS3Client.scala b/src/main/scala/net/kemitix/s3thorp/awssdk/ReactiveS3Client.scala index b5e70e2..0abbfc9 100644 --- a/src/main/scala/net/kemitix/s3thorp/awssdk/ReactiveS3Client.scala +++ b/src/main/scala/net/kemitix/s3thorp/awssdk/ReactiveS3Client.scala @@ -1,43 +1,27 @@ package net.kemitix.s3thorp.awssdk import cats.effect.IO -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, HeadObjectResponse, PutObjectRequest} +import software.amazon.awssdk.services.s3.model.{HeadObjectRequest, PutObjectRequest} private class ReactiveS3Client extends S3Client with CatsIOS3Client { override def objectHead(bucket: Bucket, remoteKey: RemoteKey) = { - val request = HeadObjectRequest.builder() - .bucket(bucket) - .key(remoteKey) - .build() - println(s"S3:HeadObject: $bucket : $remoteKey") + val request = HeadObjectRequest.builder().bucket(bucket).key(remoteKey).build() s3Client.headObject(request).attempt.map { - case Right(response) => { - println(s" -- ${response.eTag()} : ${response.lastModified()}") - Some((response.eTag(), response.lastModified())) - } - case Left(_) => { - println(" -- Not found in S3") - None - } + case Right(response) => Some((response.eTag(), response.lastModified())) + case Left(_) =>None } } override def upload(localFile: LocalFile, bucket: Bucket, remoteKey: RemoteKey): IO[Unit] = { - val request = PutObjectRequest.builder() - .bucket(bucket) - .key(remoteKey) - .build() + val request = PutObjectRequest.builder().bucket(bucket).key(remoteKey).build() val body = AsyncRequestBody.fromFile(localFile) for { - _ <- putStrLn(s"S3:PutObject: $bucket : $remoteKey") _ <- s3Client.putObject(request, body) - _ <- putStrLn(" -- Done") } yield () } }