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