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

zio.aws.codepipeline.model.TransitionState.scala Maven / Gradle / Ivy

The newest version!
package zio.aws.codepipeline.model
import java.time.Instant
import zio.prelude.data.Optional
import zio.aws.core.{AwsError, BuilderHelper}
import zio.ZIO
import zio.aws.codepipeline.model.primitives.{
  DisabledReason,
  LastChangedAt,
  LastChangedBy,
  Enabled
}
import scala.jdk.CollectionConverters._
final case class TransitionState(
    enabled: Optional[Enabled] = Optional.Absent,
    lastChangedBy: Optional[LastChangedBy] = Optional.Absent,
    lastChangedAt: Optional[LastChangedAt] = Optional.Absent,
    disabledReason: Optional[DisabledReason] = Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.codepipeline.model.TransitionState = {
    import TransitionState.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.codepipeline.model.TransitionState
      .builder()
      .optionallyWith(
        enabled.map(value => Enabled.unwrap(value): java.lang.Boolean)
      )(_.enabled)
      .optionallyWith(
        lastChangedBy.map(value =>
          LastChangedBy.unwrap(value): java.lang.String
        )
      )(_.lastChangedBy)
      .optionallyWith(
        lastChangedAt.map(value => LastChangedAt.unwrap(value): Instant)
      )(_.lastChangedAt)
      .optionallyWith(
        disabledReason.map(value =>
          DisabledReason.unwrap(value): java.lang.String
        )
      )(_.disabledReason)
      .build()
  }
  def asReadOnly: zio.aws.codepipeline.model.TransitionState.ReadOnly =
    zio.aws.codepipeline.model.TransitionState.wrap(buildAwsValue())
}
object TransitionState {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.codepipeline.model.TransitionState
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.codepipeline.model.TransitionState =
      zio.aws.codepipeline.model.TransitionState(
        enabled.map(value => value),
        lastChangedBy.map(value => value),
        lastChangedAt.map(value => value),
        disabledReason.map(value => value)
      )
    def enabled: Optional[Enabled]
    def lastChangedBy: Optional[LastChangedBy]
    def lastChangedAt: Optional[LastChangedAt]
    def disabledReason: Optional[DisabledReason]
    def getEnabled: ZIO[Any, AwsError, Enabled] =
      AwsError.unwrapOptionField("enabled", enabled)
    def getLastChangedBy: ZIO[Any, AwsError, LastChangedBy] =
      AwsError.unwrapOptionField("lastChangedBy", lastChangedBy)
    def getLastChangedAt: ZIO[Any, AwsError, LastChangedAt] =
      AwsError.unwrapOptionField("lastChangedAt", lastChangedAt)
    def getDisabledReason: ZIO[Any, AwsError, DisabledReason] =
      AwsError.unwrapOptionField("disabledReason", disabledReason)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.codepipeline.model.TransitionState
  ) extends zio.aws.codepipeline.model.TransitionState.ReadOnly {
    override val enabled: Optional[Enabled] = zio.aws.core.internal
      .optionalFromNullable(impl.enabled())
      .map(value => zio.aws.codepipeline.model.primitives.Enabled(value))
    override val lastChangedBy: Optional[LastChangedBy] = zio.aws.core.internal
      .optionalFromNullable(impl.lastChangedBy())
      .map(value => zio.aws.codepipeline.model.primitives.LastChangedBy(value))
    override val lastChangedAt: Optional[LastChangedAt] = zio.aws.core.internal
      .optionalFromNullable(impl.lastChangedAt())
      .map(value => zio.aws.codepipeline.model.primitives.LastChangedAt(value))
    override val disabledReason: Optional[DisabledReason] =
      zio.aws.core.internal
        .optionalFromNullable(impl.disabledReason())
        .map(value =>
          zio.aws.codepipeline.model.primitives.DisabledReason(value)
        )
  }
  def wrap(
      impl: software.amazon.awssdk.services.codepipeline.model.TransitionState
  ): zio.aws.codepipeline.model.TransitionState.ReadOnly = new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy