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

zio.aws.rdsdata.RdsDataMock.scala Maven / Gradle / Ivy

The newest version!
package zio.aws.rdsdata
import zio.aws.rdsdata.model.ExecuteStatementResponse.ReadOnly
import zio.mock.{Proxy, Mock}
import software.amazon.awssdk.services.rdsdata.RdsDataAsyncClient
import zio.aws.core.AwsError
import zio.aws.core.aspects.AwsCallAspect
import zio.{IO, ZEnvironment, URLayer}
import zio.aws.rdsdata.model.{
  ExecuteStatementRequest,
  BeginTransactionRequest,
  RollbackTransactionRequest,
  CommitTransactionRequest,
  BatchExecuteStatementRequest
}
object RdsDataMock extends Mock[RdsData] {
  object CommitTransaction
      extends Effect[
        CommitTransactionRequest,
        AwsError,
        zio.aws.rdsdata.model.CommitTransactionResponse.ReadOnly
      ]
  object RollbackTransaction
      extends Effect[
        RollbackTransactionRequest,
        AwsError,
        zio.aws.rdsdata.model.RollbackTransactionResponse.ReadOnly
      ]
  object BatchExecuteStatement
      extends Effect[
        BatchExecuteStatementRequest,
        AwsError,
        zio.aws.rdsdata.model.BatchExecuteStatementResponse.ReadOnly
      ]
  object ExecuteStatement
      extends Effect[ExecuteStatementRequest, AwsError, ReadOnly]
  object BeginTransaction
      extends Effect[
        BeginTransactionRequest,
        AwsError,
        zio.aws.rdsdata.model.BeginTransactionResponse.ReadOnly
      ]
  val compose: URLayer[Proxy, RdsData] = zio.ZLayer {
    zio.ZIO.service[Proxy].flatMap { proxy =>
      withRuntime[Proxy, RdsData] { rts =>
        zio.ZIO.succeed {
          new RdsData {
            val api: RdsDataAsyncClient = null
            def withAspect[R1](
                newAspect: AwsCallAspect[R1],
                r: ZEnvironment[R1]
            ): RdsData = this
            def commitTransaction(request: CommitTransactionRequest): IO[
              AwsError,
              zio.aws.rdsdata.model.CommitTransactionResponse.ReadOnly
            ] = proxy(CommitTransaction, request)
            def rollbackTransaction(request: RollbackTransactionRequest): IO[
              AwsError,
              zio.aws.rdsdata.model.RollbackTransactionResponse.ReadOnly
            ] = proxy(RollbackTransaction, request)
            def batchExecuteStatement(
                request: BatchExecuteStatementRequest
            ): IO[
              AwsError,
              zio.aws.rdsdata.model.BatchExecuteStatementResponse.ReadOnly
            ] = proxy(BatchExecuteStatement, request)
            def executeStatement(
                request: ExecuteStatementRequest
            ): IO[AwsError, ReadOnly] = proxy(ExecuteStatement, request)
            def beginTransaction(request: BeginTransactionRequest): IO[
              AwsError,
              zio.aws.rdsdata.model.BeginTransactionResponse.ReadOnly
            ] = proxy(BeginTransaction, request)
          }
        }
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy