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

zio.aws.rdsdata.model.ExecuteStatementResponse.scala Maven / Gradle / Ivy

The newest version!
package zio.aws.rdsdata.model
import zio.aws.rdsdata.model.primitives.{FormattedSqlRecords, RecordsUpdated}
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import scala.jdk.CollectionConverters.*
final case class ExecuteStatementResponse(
    records: Optional[Iterable[Iterable[zio.aws.rdsdata.model.Field]]] =
      Optional.Absent,
    columnMetadata: Optional[Iterable[zio.aws.rdsdata.model.ColumnMetadata]] =
      Optional.Absent,
    numberOfRecordsUpdated: Optional[RecordsUpdated] = Optional.Absent,
    generatedFields: Optional[Iterable[zio.aws.rdsdata.model.Field]] =
      Optional.Absent,
    formattedRecords: Optional[FormattedSqlRecords] = Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.rdsdata.model.ExecuteStatementResponse = {
    import ExecuteStatementResponse.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.rdsdata.model.ExecuteStatementResponse
      .builder()
      .optionallyWith(
        records.map(value =>
          value.map { item =>
            item.map { item =>
              item.buildAwsValue()
            }.asJavaCollection
          }.asJavaCollection
        )
      )(_.records)
      .optionallyWith(
        columnMetadata.map(value =>
          value.map { item =>
            item.buildAwsValue()
          }.asJavaCollection
        )
      )(_.columnMetadata)
      .optionallyWith(
        numberOfRecordsUpdated.map(value =>
          RecordsUpdated.unwrap(value): java.lang.Long
        )
      )(_.numberOfRecordsUpdated)
      .optionallyWith(
        generatedFields.map(value =>
          value.map { item =>
            item.buildAwsValue()
          }.asJavaCollection
        )
      )(_.generatedFields)
      .optionallyWith(
        formattedRecords.map(value =>
          FormattedSqlRecords.unwrap(value): java.lang.String
        )
      )(_.formattedRecords)
      .build()
  }
  def asReadOnly: zio.aws.rdsdata.model.ExecuteStatementResponse.ReadOnly =
    zio.aws.rdsdata.model.ExecuteStatementResponse.wrap(buildAwsValue())
}
object ExecuteStatementResponse {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.rdsdata.model.ExecuteStatementResponse
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.rdsdata.model.ExecuteStatementResponse =
      zio.aws.rdsdata.model.ExecuteStatementResponse(
        records.map(value =>
          value.map { item =>
            item.map { item =>
              item.asEditable
            }
          }
        ),
        columnMetadata.map(value =>
          value.map { item =>
            item.asEditable
          }
        ),
        numberOfRecordsUpdated.map(value => value),
        generatedFields.map(value =>
          value.map { item =>
            item.asEditable
          }
        ),
        formattedRecords.map(value => value)
      )
    def records: Optional[List[List[zio.aws.rdsdata.model.Field.ReadOnly]]]
    def columnMetadata
        : Optional[List[zio.aws.rdsdata.model.ColumnMetadata.ReadOnly]]
    def numberOfRecordsUpdated: Optional[RecordsUpdated]
    def generatedFields: Optional[List[zio.aws.rdsdata.model.Field.ReadOnly]]
    def formattedRecords: Optional[FormattedSqlRecords]
    def getRecords
        : ZIO[Any, AwsError, List[List[zio.aws.rdsdata.model.Field.ReadOnly]]] =
      AwsError.unwrapOptionField("records", records)
    def getColumnMetadata: ZIO[Any, AwsError, List[
      zio.aws.rdsdata.model.ColumnMetadata.ReadOnly
    ]] = AwsError.unwrapOptionField("columnMetadata", columnMetadata)
    def getNumberOfRecordsUpdated: ZIO[Any, AwsError, RecordsUpdated] = AwsError
      .unwrapOptionField("numberOfRecordsUpdated", numberOfRecordsUpdated)
    def getGeneratedFields
        : ZIO[Any, AwsError, List[zio.aws.rdsdata.model.Field.ReadOnly]] =
      AwsError.unwrapOptionField("generatedFields", generatedFields)
    def getFormattedRecords: ZIO[Any, AwsError, FormattedSqlRecords] =
      AwsError.unwrapOptionField("formattedRecords", formattedRecords)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.rdsdata.model.ExecuteStatementResponse
  ) extends zio.aws.rdsdata.model.ExecuteStatementResponse.ReadOnly {
    override val records
        : Optional[List[List[zio.aws.rdsdata.model.Field.ReadOnly]]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.records())
        .map(value =>
          value.asScala.map { item =>
            item.asScala.map { item =>
              zio.aws.rdsdata.model.Field.wrap(item)
            }.toList
          }.toList
        )
    override val columnMetadata
        : Optional[List[zio.aws.rdsdata.model.ColumnMetadata.ReadOnly]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.columnMetadata())
        .map(value =>
          value.asScala.map { item =>
            zio.aws.rdsdata.model.ColumnMetadata.wrap(item)
          }.toList
        )
    override val numberOfRecordsUpdated: Optional[RecordsUpdated] =
      zio.aws.core.internal
        .optionalFromNullable(impl.numberOfRecordsUpdated())
        .map(value => zio.aws.rdsdata.model.primitives.RecordsUpdated(value))
    override val generatedFields
        : Optional[List[zio.aws.rdsdata.model.Field.ReadOnly]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.generatedFields())
        .map(value =>
          value.asScala.map { item =>
            zio.aws.rdsdata.model.Field.wrap(item)
          }.toList
        )
    override val formattedRecords: Optional[FormattedSqlRecords] =
      zio.aws.core.internal
        .optionalFromNullable(impl.formattedRecords())
        .map(value =>
          zio.aws.rdsdata.model.primitives.FormattedSqlRecords(value)
        )
  }
  def wrap(
      impl: software.amazon.awssdk.services.rdsdata.model.ExecuteStatementResponse
  ): zio.aws.rdsdata.model.ExecuteStatementResponse.ReadOnly = new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy