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