All Downloads are FREE. Search and download functionalities are using the official Maven repository.

zio.aws.amplifybackend.model.BackendStoragePermissions.scala Maven / Gradle / Ivy

There is a newer version: 7.28.29.10
Show newest version
package zio.aws.amplifybackend.model
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import scala.jdk.CollectionConverters.*
final case class BackendStoragePermissions(
    authenticated: Iterable[zio.aws.amplifybackend.model.AuthenticatedElement],
    unAuthenticated: Optional[
      Iterable[zio.aws.amplifybackend.model.UnAuthenticatedElement]
    ] = Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.amplifybackend.model.BackendStoragePermissions = {
    import BackendStoragePermissions.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.amplifybackend.model.BackendStoragePermissions
      .builder()
      .authenticatedWithStrings(authenticated.map { item =>
        item.unwrap.toString
      }.asJavaCollection)
      .optionallyWith(
        unAuthenticated.map(value =>
          value.map { item =>
            item.unwrap.toString
          }.asJavaCollection
        )
      )(_.unAuthenticatedWithStrings)
      .build()
  }
  def asReadOnly
      : zio.aws.amplifybackend.model.BackendStoragePermissions.ReadOnly =
    zio.aws.amplifybackend.model.BackendStoragePermissions.wrap(buildAwsValue())
}
object BackendStoragePermissions {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.amplifybackend.model.BackendStoragePermissions
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.amplifybackend.model.BackendStoragePermissions =
      zio.aws.amplifybackend.model.BackendStoragePermissions(
        authenticated,
        unAuthenticated.map(value => value)
      )
    def authenticated: List[zio.aws.amplifybackend.model.AuthenticatedElement]
    def unAuthenticated
        : Optional[List[zio.aws.amplifybackend.model.UnAuthenticatedElement]]
    def getAuthenticated: ZIO[Any, Nothing, List[
      zio.aws.amplifybackend.model.AuthenticatedElement
    ]] = ZIO.succeed(authenticated)
    def getUnAuthenticated: ZIO[Any, AwsError, List[
      zio.aws.amplifybackend.model.UnAuthenticatedElement
    ]] = AwsError.unwrapOptionField("unAuthenticated", unAuthenticated)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.amplifybackend.model.BackendStoragePermissions
  ) extends zio.aws.amplifybackend.model.BackendStoragePermissions.ReadOnly {
    override val authenticated
        : List[zio.aws.amplifybackend.model.AuthenticatedElement] = impl
      .authenticated()
      .asScala
      .map { item =>
        zio.aws.amplifybackend.model.AuthenticatedElement.wrap(item)
      }
      .toList
    override val unAuthenticated
        : Optional[List[zio.aws.amplifybackend.model.UnAuthenticatedElement]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.unAuthenticated())
        .map(value =>
          value.asScala.map { item =>
            zio.aws.amplifybackend.model.UnAuthenticatedElement.wrap(item)
          }.toList
        )
  }
  def wrap(
      impl: software.amazon.awssdk.services.amplifybackend.model.BackendStoragePermissions
  ): zio.aws.amplifybackend.model.BackendStoragePermissions.ReadOnly =
    new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy