All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.vigoo.zioaws.rdsdata.model.SqlParameter.scala Maven / Gradle / Ivy

There is a newer version: 4.17.280.4
Show newest version
package io.github.vigoo.zioaws.rdsdata.model
import zio.ZIO
import io.github.vigoo.zioaws.rdsdata.model.primitives.ParameterName
import io.github.vigoo.zioaws.core.{AwsError, BuilderHelper}
import scala.jdk.CollectionConverters.*
final case class SqlParameter(
    name: Option[ParameterName] = None,
    typeHint: Option[io.github.vigoo.zioaws.rdsdata.model.TypeHint] = None,
    value: Option[io.github.vigoo.zioaws.rdsdata.model.Field] = None
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.rdsdata.model.SqlParameter = {
    import SqlParameter.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.rdsdata.model.SqlParameter
      .builder()
      .optionallyWith(name.map(value => value: java.lang.String))(_.name)
      .optionallyWith(typeHint.map(value => value.unwrap))(_.typeHint)
      .optionallyWith(value.map(value => value.buildAwsValue()))(_.value)
      .build()
  }
  def asReadOnly: io.github.vigoo.zioaws.rdsdata.model.SqlParameter.ReadOnly =
    io.github.vigoo.zioaws.rdsdata.model.SqlParameter.wrap(buildAwsValue())
}
object SqlParameter {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.rdsdata.model.SqlParameter
  ] = BuilderHelper.apply
  trait ReadOnly {
    def editable: io.github.vigoo.zioaws.rdsdata.model.SqlParameter =
      io.github.vigoo.zioaws.rdsdata.model.SqlParameter(
        nameValue.map(value => value),
        typeHintValue.map(value => value),
        valueValue.map(value => value.editable)
      )
    def nameValue: Option[ParameterName]
    def typeHintValue: Option[io.github.vigoo.zioaws.rdsdata.model.TypeHint]
    def valueValue: Option[io.github.vigoo.zioaws.rdsdata.model.Field.ReadOnly]
    def name: ZIO[Any, AwsError, ParameterName] =
      AwsError.unwrapOptionField("name", nameValue)
    def typeHint
        : ZIO[Any, AwsError, io.github.vigoo.zioaws.rdsdata.model.TypeHint] =
      AwsError.unwrapOptionField("typeHint", typeHintValue)
    def value: ZIO[
      Any,
      AwsError,
      io.github.vigoo.zioaws.rdsdata.model.Field.ReadOnly
    ] = AwsError.unwrapOptionField("value", valueValue)
  }
  private class Wrapper(
      impl: software.amazon.awssdk.services.rdsdata.model.SqlParameter
  ) extends io.github.vigoo.zioaws.rdsdata.model.SqlParameter.ReadOnly {
    override def nameValue: Option[ParameterName] =
      scala.Option(impl.name()).map(value => value: ParameterName)
    override def typeHintValue
        : Option[io.github.vigoo.zioaws.rdsdata.model.TypeHint] = scala
      .Option(impl.typeHint())
      .map(value => io.github.vigoo.zioaws.rdsdata.model.TypeHint.wrap(value))
    override def valueValue
        : Option[io.github.vigoo.zioaws.rdsdata.model.Field.ReadOnly] = scala
      .Option(impl.value())
      .map(value => io.github.vigoo.zioaws.rdsdata.model.Field.wrap(value))
  }
  def wrap(
      impl: software.amazon.awssdk.services.rdsdata.model.SqlParameter
  ): io.github.vigoo.zioaws.rdsdata.model.SqlParameter.ReadOnly = new Wrapper(
    impl
  )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy