laserdisc-io / zio-oci-objectstorage   0.7.3

MIT License GitHub

An OCI Object Storage client for ZIO

Scala versions: 3.x 2.13

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
}