zio.aws.workmail.model.Permission.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zio-aws-workmail_2.12 Show documentation
Show all versions of zio-aws-workmail_2.12 Show documentation
Low-level AWS wrapper for ZIO
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)
}