Skip to content

zio-mesh/zio-aws-s3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maven

zio-aws-s3

Welcome to ZIO AWS S3 !

This project aims to ease ZIO integration with AWS S3, providing a clean, simple and efficient API.

Features

Integration

"io.github.neurodyne" %% "zio-aws-s3" % version
ivy"io.github.neurodyne::zio-aws-s3:$version"

Getting Started

// 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)
  }
}

API Reference

  1. See [API Reference]

Running Tests

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:

  1. Export AWS_BUCKET as an environment variable in the window you will be running the tests.
  2. Change the region in Setup.scala to your region.
  3. Change the prefix and key in AwsSpec.scala to a prefix/key in your bucket.

Then:

> sbt
> testOnly *BuckSpec

Commercial integration and support services are available

Please open an issue with your commercial integration request

Resources

  1. AWS SDK Java v2 [Documentation]
  2. AWS SDK Java v2 [Repo]

About

ZIO integration with AWS S3 SDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published