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

zio.aws.health.model.EntityAggregate.scala Maven / Gradle / Ivy

The newest version!
package zio.aws.health.model
import zio.prelude.data.Optional
import zio.aws.core.{AwsError, BuilderHelper}
import zio.ZIO
import zio.aws.health.model.primitives.{Count, EventArn}
import java.lang.Integer
import scala.jdk.CollectionConverters.*
final case class EntityAggregate(
    eventArn: Optional[EventArn] = Optional.Absent,
    count: Optional[Count] = Optional.Absent,
    statuses: Optional[Map[zio.aws.health.model.EntityStatusCode, Count]] =
      Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.health.model.EntityAggregate = {
    import EntityAggregate.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.health.model.EntityAggregate
      .builder()
      .optionallyWith(
        eventArn.map(value => EventArn.unwrap(value): java.lang.String)
      )(_.eventArn)
      .optionallyWith(count.map(value => Count.unwrap(value): Integer))(_.count)
      .optionallyWith(
        statuses.map(value =>
          value
            .map({ case (key, value) =>
              key.unwrap.toString -> (Count.unwrap(value): Integer)
            })
            .asJava
        )
      )(_.statusesWithStrings)
      .build()
  }
  def asReadOnly: zio.aws.health.model.EntityAggregate.ReadOnly =
    zio.aws.health.model.EntityAggregate.wrap(buildAwsValue())
}
object EntityAggregate {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.health.model.EntityAggregate
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.health.model.EntityAggregate =
      zio.aws.health.model.EntityAggregate(
        eventArn.map(value => value),
        count.map(value => value),
        statuses.map(value => value)
      )
    def eventArn: Optional[EventArn]
    def count: Optional[Count]
    def statuses: Optional[Map[zio.aws.health.model.EntityStatusCode, Count]]
    def getEventArn: ZIO[Any, AwsError, EventArn] =
      AwsError.unwrapOptionField("eventArn", eventArn)
    def getCount: ZIO[Any, AwsError, Count] =
      AwsError.unwrapOptionField("count", count)
    def getStatuses: ZIO[Any, AwsError, Map[
      zio.aws.health.model.EntityStatusCode,
      Count
    ]] = AwsError.unwrapOptionField("statuses", statuses)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.health.model.EntityAggregate
  ) extends zio.aws.health.model.EntityAggregate.ReadOnly {
    override val eventArn: Optional[EventArn] = zio.aws.core.internal
      .optionalFromNullable(impl.eventArn())
      .map(value => zio.aws.health.model.primitives.EventArn(value))
    override val count: Optional[Count] = zio.aws.core.internal
      .optionalFromNullable(impl.count())
      .map(value => zio.aws.health.model.primitives.Count(value))
    override val statuses
        : Optional[Map[zio.aws.health.model.EntityStatusCode, Count]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.statuses())
        .map(value =>
          value.asScala
            .map({ case (key, value) =>
              zio.aws.health.model.EntityStatusCode
                .wrap(key) -> zio.aws.health.model.primitives.Count(value)
            })
            .toMap
        )
  }
  def wrap(
      impl: software.amazon.awssdk.services.health.model.EntityAggregate
  ): zio.aws.health.model.EntityAggregate.ReadOnly = new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy