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

zio.aws.workmail.model.Permission.scala Maven / Gradle / Ivy

There is a newer version: 7.28.29.5
Show newest version
package zio.aws.workmail.model
import zio.aws.workmail.model.primitives.WorkMailIdentifier
import zio.ZIO
import zio.aws.core.BuilderHelper
import scala.jdk.CollectionConverters._
final case class Permission(
    granteeId: WorkMailIdentifier,
    granteeType: zio.aws.workmail.model.MemberType,
    permissionValues: Iterable[zio.aws.workmail.model.PermissionType]
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.workmail.model.Permission = {
    import Permission.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.workmail.model.Permission
      .builder()
      .granteeId(WorkMailIdentifier.unwrap(granteeId): java.lang.String)
      .granteeType(granteeType.unwrap)
      .permissionValuesWithStrings(permissionValues.map { item =>
        item.unwrap.toString
      }.asJavaCollection)
      .build()
  }
  def asReadOnly: zio.aws.workmail.model.Permission.ReadOnly =
    zio.aws.workmail.model.Permission.wrap(buildAwsValue())
}
object Permission {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.workmail.model.Permission
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.workmail.model.Permission = zio.aws.workmail.model
      .Permission(granteeId, granteeType, permissionValues)
    def granteeId: WorkMailIdentifier
    def granteeType: zio.aws.workmail.model.MemberType
    def permissionValues: List[zio.aws.workmail.model.PermissionType]
    def getGranteeId: ZIO[Any, Nothing, WorkMailIdentifier] =
      ZIO.succeed(granteeId)
    def getGranteeType: ZIO[Any, Nothing, zio.aws.workmail.model.MemberType] =
      ZIO.succeed(granteeType)
    def getPermissionValues
        : ZIO[Any, Nothing, List[zio.aws.workmail.model.PermissionType]] =
      ZIO.succeed(permissionValues)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.workmail.model.Permission
  ) extends zio.aws.workmail.model.Permission.ReadOnly {
    override val granteeId: WorkMailIdentifier =
      zio.aws.workmail.model.primitives.WorkMailIdentifier(impl.granteeId())
    override val granteeType: zio.aws.workmail.model.MemberType =
      zio.aws.workmail.model.MemberType.wrap(impl.granteeType())
    override val permissionValues: List[zio.aws.workmail.model.PermissionType] =
      impl
        .permissionValues()
        .asScala
        .map { item =>
          zio.aws.workmail.model.PermissionType.wrap(item)
        }
        .toList
  }
  def wrap(
      impl: software.amazon.awssdk.services.workmail.model.Permission
  ): zio.aws.workmail.model.Permission.ReadOnly = new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy