zio.aws.verifiedpermissions.model.StaticPolicyDefinitionItem.scala Maven / Gradle / Ivy
package zio.aws.verifiedpermissions.model
import zio.aws.verifiedpermissions.model.primitives.StaticPolicyDescription
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import scala.jdk.CollectionConverters._
final case class StaticPolicyDefinitionItem(
description: Optional[StaticPolicyDescription] = Optional.Absent
) {
def buildAwsValue()
: software.amazon.awssdk.services.verifiedpermissions.model.StaticPolicyDefinitionItem = {
import StaticPolicyDefinitionItem.zioAwsBuilderHelper.BuilderOps
software.amazon.awssdk.services.verifiedpermissions.model.StaticPolicyDefinitionItem
.builder()
.optionallyWith(
description.map(value =>
StaticPolicyDescription.unwrap(value): java.lang.String
)
)(_.description)
.build()
}
def asReadOnly
: zio.aws.verifiedpermissions.model.StaticPolicyDefinitionItem.ReadOnly =
zio.aws.verifiedpermissions.model.StaticPolicyDefinitionItem
.wrap(buildAwsValue())
}
object StaticPolicyDefinitionItem {
private lazy val zioAwsBuilderHelper: BuilderHelper[
software.amazon.awssdk.services.verifiedpermissions.model.StaticPolicyDefinitionItem
] = BuilderHelper.apply
trait ReadOnly {
def asEditable
: zio.aws.verifiedpermissions.model.StaticPolicyDefinitionItem =
zio.aws.verifiedpermissions.model
.StaticPolicyDefinitionItem(description.map(value => value))
def description: Optional[StaticPolicyDescription]
def getDescription: ZIO[Any, AwsError, StaticPolicyDescription] =
AwsError.unwrapOptionField("description", description)
}
private final class Wrapper(
impl: software.amazon.awssdk.services.verifiedpermissions.model.StaticPolicyDefinitionItem
) extends zio.aws.verifiedpermissions.model.StaticPolicyDefinitionItem.ReadOnly {
override val description: Optional[StaticPolicyDescription] =
zio.aws.core.internal
.optionalFromNullable(impl.description())
.map(value =>
zio.aws.verifiedpermissions.model.primitives
.StaticPolicyDescription(value)
)
}
def wrap(
impl: software.amazon.awssdk.services.verifiedpermissions.model.StaticPolicyDefinitionItem
): zio.aws.verifiedpermissions.model.StaticPolicyDefinitionItem.ReadOnly =
new Wrapper(impl)
}