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

io.github.vigoo.zioaws.rdsdata.model.BeginTransactionRequest.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.{Arn, DbName}
import io.github.vigoo.zioaws.core.{AwsError, BuilderHelper}
import scala.jdk.CollectionConverters.*
final case class BeginTransactionRequest(
    database: Option[DbName] = None,
    resourceArn: Arn,
    schema: Option[DbName] = None,
    secretArn: Arn
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.rdsdata.model.BeginTransactionRequest = {
    import BeginTransactionRequest.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.rdsdata.model.BeginTransactionRequest
      .builder()
      .optionallyWith(database.map(value => value: java.lang.String))(
        _.database
      )
      .resourceArn(resourceArn: java.lang.String)
      .optionallyWith(schema.map(value => value: java.lang.String))(_.schema)
      .secretArn(secretArn: java.lang.String)
      .build()
  }
  def asReadOnly
      : io.github.vigoo.zioaws.rdsdata.model.BeginTransactionRequest.ReadOnly =
    io.github.vigoo.zioaws.rdsdata.model.BeginTransactionRequest
      .wrap(buildAwsValue())
}
object BeginTransactionRequest {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.rdsdata.model.BeginTransactionRequest
  ] = BuilderHelper.apply
  trait ReadOnly {
    def editable: io.github.vigoo.zioaws.rdsdata.model.BeginTransactionRequest =
      io.github.vigoo.zioaws.rdsdata.model.BeginTransactionRequest(
        databaseValue.map(value => value),
        resourceArnValue,
        schemaValue.map(value => value),
        secretArnValue
      )
    def databaseValue: Option[DbName]
    def resourceArnValue: Arn
    def schemaValue: Option[DbName]
    def secretArnValue: Arn
    def database: ZIO[Any, AwsError, DbName] =
      AwsError.unwrapOptionField("database", databaseValue)
    def resourceArn: ZIO[Any, Nothing, Arn] = ZIO.succeed(resourceArnValue)
    def schema: ZIO[Any, AwsError, DbName] =
      AwsError.unwrapOptionField("schema", schemaValue)
    def secretArn: ZIO[Any, Nothing, Arn] = ZIO.succeed(secretArnValue)
  }
  private class Wrapper(
      impl: software.amazon.awssdk.services.rdsdata.model.BeginTransactionRequest
  ) extends io.github.vigoo.zioaws.rdsdata.model.BeginTransactionRequest.ReadOnly {
    override def databaseValue: Option[DbName] =
      scala.Option(impl.database()).map(value => value: DbName)
    override def resourceArnValue: Arn = impl.resourceArn(): Arn
    override def schemaValue: Option[DbName] =
      scala.Option(impl.schema()).map(value => value: DbName)
    override def secretArnValue: Arn = impl.secretArn(): Arn
  }
  def wrap(
      impl: software.amazon.awssdk.services.rdsdata.model.BeginTransactionRequest
  ): io.github.vigoo.zioaws.rdsdata.model.BeginTransactionRequest.ReadOnly =
    new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy