Welcome to ZIO AWS S3 !
This project aims to ease ZIO integration with AWS S3, providing a clean, simple and efficient API.
- AWS S3 Java v2 2.13.26
- ZIO RC-20
- ZIO Module wrapper for all AWS methods
- Module Pattern with ZIO Layer implementation
- ZIO Test integration
- Support for Scala 2.13.2 and 2.12.11
"io.github.neurodyne" %% "zio-aws-s3" % version
ivy"io.github.neurodyne::zio-aws-s3:$version"
// build.sbt
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % "1.0.0-RC20",
"io.github.neurodyne" %% "zio-aws-s3" % "0.4.13"
)
// build.sc
def ivyDeps = Agg(
ivy"dev.zio::zio:1.0.0-RC20",
ivy"io.github.neurodyne::zio-aws-s3:0.4.13"
)
import zio._
import zio.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]): ZIO[ZEnv, Nothing, Int] = {
app.fold(_ => 1, _ => 0)
}
}
- 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]