aws-zio-s3

ZIO wrapper for AWS S3 SDK async client.

License

License

Categories

Categories

AWS Container PaaS Providers
GroupId

GroupId

com.github.branislavlazic
ArtifactId

ArtifactId

aws-zio-s3_2.12
Last Version

Last Version

0.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

aws-zio-s3
ZIO wrapper for AWS S3 SDK async client.
Project URL

Project URL

https://github.com/BranislavLazic/aws-zio-s3
Project Organization

Project Organization

Branislav Lazic
Source Code Management

Source Code Management

https://github.com/BranislavLazic/aws-zio-s3

Download aws-zio-s3_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.branislavlazic/aws-zio-s3_2.12/ -->
<dependency>
    <groupId>com.github.branislavlazic</groupId>
    <artifactId>aws-zio-s3_2.12</artifactId>
    <version>0.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.branislavlazic/aws-zio-s3_2.12/
implementation 'com.github.branislavlazic:aws-zio-s3_2.12:0.3.0'
// https://jarcasting.com/artifacts/com.github.branislavlazic/aws-zio-s3_2.12/
implementation ("com.github.branislavlazic:aws-zio-s3_2.12:0.3.0")
'com.github.branislavlazic:aws-zio-s3_2.12:jar:0.3.0'
<dependency org="com.github.branislavlazic" name="aws-zio-s3_2.12" rev="0.3.0">
  <artifact name="aws-zio-s3_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.branislavlazic', module='aws-zio-s3_2.12', version='0.3.0')
)
libraryDependencies += "com.github.branislavlazic" % "aws-zio-s3_2.12" % "0.3.0"
[com.github.branislavlazic/aws-zio-s3_2.12 "0.3.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.10
software.amazon.awssdk : s3 jar 2.10.69
dev.zio : zio_2.12 jar 1.0.0-RC17

test (2)

Group / Artifact Type Version
org.scalacheck : scalacheck_2.12 jar 1.14.0
org.scalatest : scalatest_2.12 jar 3.0.8

Project Modules

There are no modules declared in this project.

aws-zio-s3

Welcome to aws-zio-s3!

ZIO based client for AWS S3.

How to use

package com.github.branislavlazic.aws.zio.s3
import zio._
import zio.console._
import java.nio.file.Paths
import software.amazon.awssdk.auth.credentials.{ AwsBasicCredentials, StaticCredentialsProvider }
import software.amazon.awssdk.regions.Region
import scala.collection.JavaConverters._

object Main extends App {

  private val s3 = new S3(
    Region.EU_WEST_1,
    StaticCredentialsProvider.create(
      AwsBasicCredentials.create("api-key", "secret-key")
    )
  )

  override def run(args: List[String]): ZIO[ZEnv, Nothing, Int] = (
    for {
      // Create the bucket 
      _    <- s3.createBucket("s3-bucket-name")
      // Upload the file
      _    <- s3.putObject("s3-bucket-name", Paths.get("/tmp/file.txt").getFileName.toString, Paths.get("/tmp/file.txt"))
      // Delete the file
      _    <- s3.deleteObject("s3-bucket-name", "file.txt")
      // Delete the bucket
      _    <- s3.deleteBucket("s3-bucket-name")
      // List all buckets
      resp <- s3.listBuckets().map(_.buckets().asScala)
      _    <- ZIO.foreach(resp)(b => putStrLn(b.name()))
    } yield 0).foldM(e => UIO(println(e.toString)).as(1), IO.succeed)
}

Add SBT dependency:

libraryDependencies += "com.github.branislavlazic" %% "aws-zio-s3" % "0.3.0"

Contribution policy

Contributions via GitHub pull requests are gladly accepted from their original author. Along with any pull requests, please state that the contribution is your original work and that you license the work to the project under the project's open source license. Whether or not you state this explicitly, by submitting any copyrighted material via pull request, email, or other means you agree to license the material under the project's open source license and warrant that you have the legal authority to do so.

License

This code is open source software licensed under the Apache-2.0 license.

Versions

Version
0.3.0
0.2.0