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

io.github.vigoo.zioaws.rdsdata.model.ExecuteStatementResponse.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.RecordsUpdated
import io.github.vigoo.zioaws.core.{AwsError, BuilderHelper}
import scala.jdk.CollectionConverters.*
final case class ExecuteStatementResponse(
    columnMetadata: Option[
      Iterable[io.github.vigoo.zioaws.rdsdata.model.ColumnMetadata]
    ] = None,
    generatedFields: Option[
      Iterable[io.github.vigoo.zioaws.rdsdata.model.Field]
    ] = None,
    numberOfRecordsUpdated: Option[RecordsUpdated] = None,
    records: Option[
      Iterable[Iterable[io.github.vigoo.zioaws.rdsdata.model.Field]]
    ] = None
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.rdsdata.model.ExecuteStatementResponse = {
    import ExecuteStatementResponse.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.rdsdata.model.ExecuteStatementResponse
      .builder()
      .optionallyWith(
        columnMetadata.map(value =>
          value.map { item =>
            item.buildAwsValue()
          }.asJavaCollection
        )
      )(_.columnMetadata)
      .optionallyWith(
        generatedFields.map(value =>
          value.map { item =>
            item.buildAwsValue()
          }.asJavaCollection
        )
      )(_.generatedFields)
      .optionallyWith(
        numberOfRecordsUpdated.map(value => value: java.lang.Long)
      )(_.numberOfRecordsUpdated)
      .optionallyWith(
        records.map(value =>
          value.map { item =>
            item.map { item =>
              item.buildAwsValue()
            }.asJavaCollection
          }.asJavaCollection
        )
      )(_.records)
      .build()
  }
  def asReadOnly
      : io.github.vigoo.zioaws.rdsdata.model.ExecuteStatementResponse.ReadOnly =
    io.github.vigoo.zioaws.rdsdata.model.ExecuteStatementResponse
      .wrap(buildAwsValue())
}
object ExecuteStatementResponse {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.rdsdata.model.ExecuteStatementResponse
  ] = BuilderHelper.apply
  trait ReadOnly {
    def editable
        : io.github.vigoo.zioaws.rdsdata.model.ExecuteStatementResponse =
      io.github.vigoo.zioaws.rdsdata.model.ExecuteStatementResponse(
        columnMetadataValue.map(value =>
          value.map { item =>
            item.editable
          }
        ),
        generatedFieldsValue.map(value =>
          value.map { item =>
            item.editable
          }
        ),
        numberOfRecordsUpdatedValue.map(value => value),
        recordsValue.map(value =>
          value.map { item =>
            item.map { item =>
              item.editable
            }
          }
        )
      )
    def columnMetadataValue: Option[
      List[io.github.vigoo.zioaws.rdsdata.model.ColumnMetadata.ReadOnly]
    ]
    def generatedFieldsValue
        : Option[List[io.github.vigoo.zioaws.rdsdata.model.Field.ReadOnly]]
    def numberOfRecordsUpdatedValue: Option[RecordsUpdated]
    def recordsValue: Option[
      List[List[io.github.vigoo.zioaws.rdsdata.model.Field.ReadOnly]]
    ]
    def columnMetadata: ZIO[Any, AwsError, List[
      io.github.vigoo.zioaws.rdsdata.model.ColumnMetadata.ReadOnly
    ]] = AwsError.unwrapOptionField("columnMetadata", columnMetadataValue)
    def generatedFields: ZIO[Any, AwsError, List[
      io.github.vigoo.zioaws.rdsdata.model.Field.ReadOnly
    ]] = AwsError.unwrapOptionField("generatedFields", generatedFieldsValue)
    def numberOfRecordsUpdated: ZIO[Any, AwsError, RecordsUpdated] = AwsError
      .unwrapOptionField("numberOfRecordsUpdated", numberOfRecordsUpdatedValue)
    def records: ZIO[Any, AwsError, List[
      List[io.github.vigoo.zioaws.rdsdata.model.Field.ReadOnly]
    ]] = AwsError.unwrapOptionField("records", recordsValue)
  }
  private class Wrapper(
      impl: software.amazon.awssdk.services.rdsdata.model.ExecuteStatementResponse
  ) extends io.github.vigoo.zioaws.rdsdata.model.ExecuteStatementResponse.ReadOnly {
    override def columnMetadataValue: Option[
      List[io.github.vigoo.zioaws.rdsdata.model.ColumnMetadata.ReadOnly]
    ] = scala
      .Option(impl.columnMetadata())
      .map(value =>
        value.asScala.map { item =>
          io.github.vigoo.zioaws.rdsdata.model.ColumnMetadata.wrap(item)
        }.toList
      )
    override def generatedFieldsValue
        : Option[List[io.github.vigoo.zioaws.rdsdata.model.Field.ReadOnly]] =
      scala
        .Option(impl.generatedFields())
        .map(value =>
          value.asScala.map { item =>
            io.github.vigoo.zioaws.rdsdata.model.Field.wrap(item)
          }.toList
        )
    override def numberOfRecordsUpdatedValue: Option[RecordsUpdated] = scala
      .Option(impl.numberOfRecordsUpdated())
      .map(value => value: RecordsUpdated)
    override def recordsValue: Option[
      List[List[io.github.vigoo.zioaws.rdsdata.model.Field.ReadOnly]]
    ] = scala
      .Option(impl.records())
      .map(value =>
        value.asScala.map { item =>
          item.asScala.map { item =>
            io.github.vigoo.zioaws.rdsdata.model.Field.wrap(item)
          }.toList
        }.toList
      )
  }
  def wrap(
      impl: software.amazon.awssdk.services.rdsdata.model.ExecuteStatementResponse
  ): io.github.vigoo.zioaws.rdsdata.model.ExecuteStatementResponse.ReadOnly =
    new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy