Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 1.8 KB

README.md

File metadata and controls

34 lines (26 loc) · 1.8 KB

ZIO OCI Object Storage

CI Release Maven Central Scala Steward badge

An OCI Object Storage client for ZIO

Usage

import com.oracle.bmc.Region
import zio.ExitCode
import zio.console._
import zio.stream.ZSink

object App extends zio.App {
  val mkObjectStorageLayer = ObjectStorageAuth.fromConfigFileDefaultProfile.map(auth => live(ObjectStorageSettings(Region.US_ASHBURN_1, auth)))

  val program = for {
    _ <- getObject(
      "namespace",
      "bucket",
      "object"
    ).run(ZSink.fromOutputStream(new java.io.FileOutputStream("/tmp/foo")))
  } yield ()

  override def run(args: List[String]): zio.URIO[zio.ZEnv, ExitCode] =
    mkObjectStorageLayer.flatMap(osLayer => program.provideCustomLayer(osLayer)).exitCode
}