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

io.github.vigoo.zioaws.rdsdata.model.ExecuteStatementRequest.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.{
  Id,
  SqlStatement,
  Arn,
  DbName
}
import io.github.vigoo.zioaws.core.{AwsError, BuilderHelper}
import scala.jdk.CollectionConverters.*
final case class ExecuteStatementRequest(
    continueAfterTimeout: Option[Boolean] = None,
    database: Option[DbName] = None,
    includeResultMetadata: Option[Boolean] = None,
    parameters: Option[
      Iterable[io.github.vigoo.zioaws.rdsdata.model.SqlParameter]
    ] = None,
    resourceArn: Arn,
    resultSetOptions: Option[
      io.github.vigoo.zioaws.rdsdata.model.ResultSetOptions
    ] = None,
    schema: Option[DbName] = None,
    secretArn: Arn,
    sql: SqlStatement,
    transactionId: Option[Id] = None
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.rdsdata.model.ExecuteStatementRequest = {
    import ExecuteStatementRequest.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.rdsdata.model.ExecuteStatementRequest
      .builder()
      .optionallyWith(
        continueAfterTimeout.map(value => value: java.lang.Boolean)
      )(_.continueAfterTimeout)
      .optionallyWith(database.map(value => value: java.lang.String))(
        _.database
      )
      .optionallyWith(
        includeResultMetadata.map(value => value: java.lang.Boolean)
      )(_.includeResultMetadata)
      .optionallyWith(
        parameters.map(value =>
          value.map { item =>
            item.buildAwsValue()
          }.asJavaCollection
        )
      )(_.parameters)
      .resourceArn(resourceArn: java.lang.String)
      .optionallyWith(resultSetOptions.map(value => value.buildAwsValue()))(
        _.resultSetOptions
      )
      .optionallyWith(schema.map(value => value: java.lang.String))(_.schema)
      .secretArn(secretArn: java.lang.String)
      .sql(sql: java.lang.String)
      .optionallyWith(transactionId.map(value => value: java.lang.String))(
        _.transactionId
      )
      .build()
  }
  def asReadOnly
      : io.github.vigoo.zioaws.rdsdata.model.ExecuteStatementRequest.ReadOnly =
    io.github.vigoo.zioaws.rdsdata.model.ExecuteStatementRequest
      .wrap(buildAwsValue())
}
object ExecuteStatementRequest {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.rdsdata.model.ExecuteStatementRequest
  ] = BuilderHelper.apply
  trait ReadOnly {
    def editable: io.github.vigoo.zioaws.rdsdata.model.ExecuteStatementRequest =
      io.github.vigoo.zioaws.rdsdata.model.ExecuteStatementRequest(
        continueAfterTimeoutValue.map(value => value),
        databaseValue.map(value => value),
        includeResultMetadataValue.map(value => value),
        parametersValue.map(value =>
          value.map { item =>
            item.editable
          }
        ),
        resourceArnValue,
        resultSetOptionsValue.map(value => value.editable),
        schemaValue.map(value => value),
        secretArnValue,
        sqlValue,
        transactionIdValue.map(value => value)
      )
    def continueAfterTimeoutValue: Option[Boolean]
    def databaseValue: Option[DbName]
    def includeResultMetadataValue: Option[Boolean]
    def parametersValue: Option[
      List[io.github.vigoo.zioaws.rdsdata.model.SqlParameter.ReadOnly]
    ]
    def resourceArnValue: Arn
    def resultSetOptionsValue
        : Option[io.github.vigoo.zioaws.rdsdata.model.ResultSetOptions.ReadOnly]
    def schemaValue: Option[DbName]
    def secretArnValue: Arn
    def sqlValue: SqlStatement
    def transactionIdValue: Option[Id]
    def continueAfterTimeout: ZIO[Any, AwsError, Boolean] = AwsError
      .unwrapOptionField("continueAfterTimeout", continueAfterTimeoutValue)
    def database: ZIO[Any, AwsError, DbName] =
      AwsError.unwrapOptionField("database", databaseValue)
    def includeResultMetadata: ZIO[Any, AwsError, Boolean] = AwsError
      .unwrapOptionField("includeResultMetadata", includeResultMetadataValue)
    def parameters: ZIO[Any, AwsError, List[
      io.github.vigoo.zioaws.rdsdata.model.SqlParameter.ReadOnly
    ]] = AwsError.unwrapOptionField("parameters", parametersValue)
    def resourceArn: ZIO[Any, Nothing, Arn] = ZIO.succeed(resourceArnValue)
    def resultSetOptions: ZIO[
      Any,
      AwsError,
      io.github.vigoo.zioaws.rdsdata.model.ResultSetOptions.ReadOnly
    ] = AwsError.unwrapOptionField("resultSetOptions", resultSetOptionsValue)
    def schema: ZIO[Any, AwsError, DbName] =
      AwsError.unwrapOptionField("schema", schemaValue)
    def secretArn: ZIO[Any, Nothing, Arn] = ZIO.succeed(secretArnValue)
    def sql: ZIO[Any, Nothing, SqlStatement] = ZIO.succeed(sqlValue)
    def transactionId: ZIO[Any, AwsError, Id] =
      AwsError.unwrapOptionField("transactionId", transactionIdValue)
  }
  private class Wrapper(
      impl: software.amazon.awssdk.services.rdsdata.model.ExecuteStatementRequest
  ) extends io.github.vigoo.zioaws.rdsdata.model.ExecuteStatementRequest.ReadOnly {
    override def continueAfterTimeoutValue: Option[Boolean] =
      scala.Option(impl.continueAfterTimeout()).map(value => value: Boolean)
    override def databaseValue: Option[DbName] =
      scala.Option(impl.database()).map(value => value: DbName)
    override def includeResultMetadataValue: Option[Boolean] =
      scala.Option(impl.includeResultMetadata()).map(value => value: Boolean)
    override def parametersValue: Option[
      List[io.github.vigoo.zioaws.rdsdata.model.SqlParameter.ReadOnly]
    ] = scala
      .Option(impl.parameters())
      .map(value =>
        value.asScala.map { item =>
          io.github.vigoo.zioaws.rdsdata.model.SqlParameter.wrap(item)
        }.toList
      )
    override def resourceArnValue: Arn = impl.resourceArn(): Arn
    override def resultSetOptionsValue: Option[
      io.github.vigoo.zioaws.rdsdata.model.ResultSetOptions.ReadOnly
    ] = scala
      .Option(impl.resultSetOptions())
      .map(value =>
        io.github.vigoo.zioaws.rdsdata.model.ResultSetOptions.wrap(value)
      )
    override def schemaValue: Option[DbName] =
      scala.Option(impl.schema()).map(value => value: DbName)
    override def secretArnValue: Arn = impl.secretArn(): Arn
    override def sqlValue: SqlStatement = impl.sql(): SqlStatement
    override def transactionIdValue: Option[Id] =
      scala.Option(impl.transactionId()).map(value => value: Id)
  }
  def wrap(
      impl: software.amazon.awssdk.services.rdsdata.model.ExecuteStatementRequest
  ): io.github.vigoo.zioaws.rdsdata.model.ExecuteStatementRequest.ReadOnly =
    new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy