Welcome to ZIO AWS S3 !
This project aims to ease ZIO integration with AWS S3, providing a clean, simple and efficient API.
- The latest asynch AWS Java v2 API
- ZIO Implementation with Module Pattern
- ZIO Test integration
- Scala 2.12 and Scala 2.13 support
"hot.crew" %% "zio-aws-s3" % latestVersion
// build.sbt
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % "1.0.0-RC21-2",
"hot.crew" %% "zio-aws-s3" % latestVersion
)
import zio._
import hot.crew.s3.{ AwsAgent, AwsApp }
import software.amazon.awssdk.regions.Region
import scala.jdk.CollectionConverters._
object Main extends App {
val BUCKET = "<your-bucket>"
val awsEnv = AwsApp.ExtDeps.live >>> AwsApp.AwsLink.live
val app = for {
s3 <- AwsAgent.createClient(Region.US_WEST_2)
response <- AwsApp.listBuckets().provideLayer(awsEnv).provide(s3)
buckets <- Task(response.buckets.asScala.toList.map(_.name))
_ = buckets.foreach(println)
} yield ()
def run(args: List[String]): URIO[Any with zio.console.Console, ExitCode] = app.exitCode
- See [API Reference]
All the tests are integration tests. That is, they make real API requests to S3. As such, you'll need to make sure you have variables set to a bucket and object that you can access and manipulate.
Here are all the things you will need to change to run the tests locally:
- Export
AWS_BUCKET
as an environment variable in the window you will be running the tests. - Change the
region
inSetup.scala
to your region. - Change the
prefix
andkey
inAwsSpec.scala
to a prefix/key in your bucket.
Then:
> sbt
> testOnly *BuckSpec
Please open an issue with your commercial integration request
- AWS SDK Java v2 [Documentation]
- AWS SDK Java v2 [Repo]