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

zio.aws.tnb.model.ErrorInfo.scala Maven / Gradle / Ivy

There is a newer version: 7.28.29.10
Show newest version
package zio.aws.tnb.model
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import zio.aws.tnb.model.primitives.{ErrorDetails, ErrorCause}
import scala.jdk.CollectionConverters.*
final case class ErrorInfo(
    cause: Optional[ErrorCause] = Optional.Absent,
    details: Optional[ErrorDetails] = Optional.Absent
) {
  def buildAwsValue(): software.amazon.awssdk.services.tnb.model.ErrorInfo = {
    import ErrorInfo.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.tnb.model.ErrorInfo
      .builder()
      .optionallyWith(
        cause.map(value => ErrorCause.unwrap(value): java.lang.String)
      )(_.cause)
      .optionallyWith(
        details.map(value => ErrorDetails.unwrap(value): java.lang.String)
      )(_.details)
      .build()
  }
  def asReadOnly: zio.aws.tnb.model.ErrorInfo.ReadOnly =
    zio.aws.tnb.model.ErrorInfo.wrap(buildAwsValue())
}
object ErrorInfo {
  private lazy val zioAwsBuilderHelper
      : BuilderHelper[software.amazon.awssdk.services.tnb.model.ErrorInfo] =
    BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.tnb.model.ErrorInfo = zio.aws.tnb.model
      .ErrorInfo(cause.map(value => value), details.map(value => value))
    def cause: Optional[ErrorCause]
    def details: Optional[ErrorDetails]
    def getCause: ZIO[Any, AwsError, ErrorCause] =
      AwsError.unwrapOptionField("cause", cause)
    def getDetails: ZIO[Any, AwsError, ErrorDetails] =
      AwsError.unwrapOptionField("details", details)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.tnb.model.ErrorInfo
  ) extends zio.aws.tnb.model.ErrorInfo.ReadOnly {
    override val cause: Optional[ErrorCause] = zio.aws.core.internal
      .optionalFromNullable(impl.cause())
      .map(value => zio.aws.tnb.model.primitives.ErrorCause(value))
    override val details: Optional[ErrorDetails] = zio.aws.core.internal
      .optionalFromNullable(impl.details())
      .map(value => zio.aws.tnb.model.primitives.ErrorDetails(value))
  }
  def wrap(
      impl: software.amazon.awssdk.services.tnb.model.ErrorInfo
  ): zio.aws.tnb.model.ErrorInfo.ReadOnly = new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy