zio.aws.verifiedpermissions.model.EntitiesDefinition.scala Maven / Gradle / Ivy
package zio.aws.verifiedpermissions.model
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import scala.jdk.CollectionConverters._
final case class EntitiesDefinition(
entityList: Optional[
Iterable[zio.aws.verifiedpermissions.model.EntityItem]
] = Optional.Absent
) {
def buildAwsValue()
: software.amazon.awssdk.services.verifiedpermissions.model.EntitiesDefinition = {
import EntitiesDefinition.zioAwsBuilderHelper.BuilderOps
software.amazon.awssdk.services.verifiedpermissions.model.EntitiesDefinition
.builder()
.optionallyWith(
entityList.map(value =>
value.map { item =>
item.buildAwsValue()
}.asJavaCollection
)
)(_.entityList)
.build()
}
def asReadOnly
: zio.aws.verifiedpermissions.model.EntitiesDefinition.ReadOnly =
zio.aws.verifiedpermissions.model.EntitiesDefinition.wrap(buildAwsValue())
}
object EntitiesDefinition {
private lazy val zioAwsBuilderHelper: BuilderHelper[
software.amazon.awssdk.services.verifiedpermissions.model.EntitiesDefinition
] = BuilderHelper.apply
trait ReadOnly {
def asEditable: zio.aws.verifiedpermissions.model.EntitiesDefinition =
zio.aws.verifiedpermissions.model.EntitiesDefinition(
entityList.map(value =>
value.map { item =>
item.asEditable
}
)
)
def entityList
: Optional[List[zio.aws.verifiedpermissions.model.EntityItem.ReadOnly]]
def getEntityList: ZIO[Any, AwsError, List[
zio.aws.verifiedpermissions.model.EntityItem.ReadOnly
]] = AwsError.unwrapOptionField("entityList", entityList)
}
private final class Wrapper(
impl: software.amazon.awssdk.services.verifiedpermissions.model.EntitiesDefinition
) extends zio.aws.verifiedpermissions.model.EntitiesDefinition.ReadOnly {
override val entityList: Optional[
List[zio.aws.verifiedpermissions.model.EntityItem.ReadOnly]
] = zio.aws.core.internal
.optionalFromNullable(impl.entityList())
.map(value =>
value.asScala.map { item =>
zio.aws.verifiedpermissions.model.EntityItem.wrap(item)
}.toList
)
}
def wrap(
impl: software.amazon.awssdk.services.verifiedpermissions.model.EntitiesDefinition
): zio.aws.verifiedpermissions.model.EntitiesDefinition.ReadOnly =
new Wrapper(impl)
}