feat: implement a presignGetObject method#500
Conversation
| "software.amazon.awssdk" % "sts" % awsVersion, | ||
| "dev.zio" %% "zio-test" % zioVersion % Test, | ||
| "dev.zio" %% "zio-test-sbt" % zioVersion % Test, | ||
| "com.dimafeng" %% "testcontainers-scala-minio" % "0.41.4" % Test, |
There was a problem hiding this comment.
please remove test container, we already have a minio in place with docker compose
There was a problem hiding this comment.
Hi Regis,
Actually we find that handy to not have a launch containers by hand before running tests.
Could you elaborate on why you don't like it, please?
There was a problem hiding this comment.
For multiple reason: slow down the execution, more code to add in unit-test, more librairies dependencies etc...
Prefer to stick to docker-compose, since it works pretty well.
thank you
| * See https://web.archive.org/web/20240621234636/https://docs.aws.amazon.com/AmazonS3/latest/userguide/ShareObjectPreSignedURL.html | ||
| * for further details regarding signature with S3. | ||
| */ | ||
| override def presignGetObject( |
There was a problem hiding this comment.
i dont think this code should be in the client. since there is nothing related to this. you could move this into the extra utils function
def presignGetObject[R](
bucketName: String,
key: String,
signatureDuration: Duration
): ZIO[S3Presigner, S3Exception, Unit] = ZIO.serviceWithZIO[S3Presigner]{ s3Presigner =>
//should wrap this unasync call with ZIO
s3Presigner.presignGetObject(
GetObjectPresignRequest
.builder()
.signatureDuration(signatureDuration)
.getObjectRequest(GetObjectRequest.builder().bucket(bucketName).key(key).build())
.build()
}
There was a problem hiding this comment.
Actually, the reason why we chose to put it in the client is that the configuration required is very similiar to the S3 client one.
The other solution is to provide another service with it's own layer definition, but then we should probably provide a layer for the configuration to avoid asking the same configuration twice to the user.
What do you think?
We implemented a method to generate presigned links :
It requires to instantiate a
S3Presignerin theLiveclass but it doesn't leak to the user.