in src/main/scala/managehelpcontentpublisher/S3.scala [43:59]
private def put(key: String, content: String): Either[Failure, PathAndContent] = {
val fullPath = s"s3://${config.aws.bucketName}/$key"
Try(
client.putObject(
PutObjectRequest
.builder()
.bucket(config.aws.bucketName)
.key(key)
.contentType("application/json")
.build(),
RequestBody.fromString(content)
)
).toEither
.left
.map(e => ResponseFailure(s"Failed to put $fullPath: ${e.getMessage}"))
.map(_ => PathAndContent(fullPath, content))
}