zio.aws.verifiedpermissions.model.EntityReference.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 EntityReference(
unspecified: Optional[Boolean] = Optional.Absent,
identifier: Optional[zio.aws.verifiedpermissions.model.EntityIdentifier] =
Optional.Absent
) {
def buildAwsValue()
: software.amazon.awssdk.services.verifiedpermissions.model.EntityReference = {
import EntityReference.zioAwsBuilderHelper.BuilderOps
software.amazon.awssdk.services.verifiedpermissions.model.EntityReference
.builder()
.optionallyWith(unspecified.map(value => value: java.lang.Boolean))(
_.unspecified
)
.optionallyWith(identifier.map(value => value.buildAwsValue()))(
_.identifier
)
.build()
}
def asReadOnly: zio.aws.verifiedpermissions.model.EntityReference.ReadOnly =
zio.aws.verifiedpermissions.model.EntityReference.wrap(buildAwsValue())
}
object EntityReference {
private lazy val zioAwsBuilderHelper: BuilderHelper[
software.amazon.awssdk.services.verifiedpermissions.model.EntityReference
] = BuilderHelper.apply
trait ReadOnly {
def asEditable: zio.aws.verifiedpermissions.model.EntityReference =
zio.aws.verifiedpermissions.model.EntityReference(
unspecified.map(value => value),
identifier.map(value => value.asEditable)
)
def unspecified: Optional[Boolean]
def identifier
: Optional[zio.aws.verifiedpermissions.model.EntityIdentifier.ReadOnly]
def getUnspecified: ZIO[Any, AwsError, Boolean] =
AwsError.unwrapOptionField("unspecified", unspecified)
def getIdentifier: ZIO[
Any,
AwsError,
zio.aws.verifiedpermissions.model.EntityIdentifier.ReadOnly
] = AwsError.unwrapOptionField("identifier", identifier)
}
private final class Wrapper(
impl: software.amazon.awssdk.services.verifiedpermissions.model.EntityReference
) extends zio.aws.verifiedpermissions.model.EntityReference.ReadOnly {
override val unspecified: Optional[Boolean] = zio.aws.core.internal
.optionalFromNullable(impl.unspecified())
.map(value => value: Boolean)
override val identifier: Optional[
zio.aws.verifiedpermissions.model.EntityIdentifier.ReadOnly
] = zio.aws.core.internal
.optionalFromNullable(impl.identifier())
.map(value =>
zio.aws.verifiedpermissions.model.EntityIdentifier.wrap(value)
)
}
def wrap(
impl: software.amazon.awssdk.services.verifiedpermissions.model.EntityReference
): zio.aws.verifiedpermissions.model.EntityReference.ReadOnly = new Wrapper(
impl
)
}