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

zio.aws.costoptimizationhub.model.Recommendation.scala Maven / Gradle / Ivy

package zio.aws.costoptimizationhub.model
import java.time.Instant
import zio.prelude.data.Optional
import zio.aws.costoptimizationhub.model.primitives.{Integer, Datetime}
import zio.aws.core.{AwsError, BuilderHelper}
import zio.ZIO
import scala.jdk.CollectionConverters.*
final case class Recommendation(
    recommendationId: Optional[String] = Optional.Absent,
    accountId: Optional[String] = Optional.Absent,
    region: Optional[String] = Optional.Absent,
    resourceId: Optional[String] = Optional.Absent,
    resourceArn: Optional[String] = Optional.Absent,
    currentResourceType: Optional[String] = Optional.Absent,
    recommendedResourceType: Optional[String] = Optional.Absent,
    estimatedMonthlySavings: Optional[Double] = Optional.Absent,
    estimatedSavingsPercentage: Optional[Double] = Optional.Absent,
    estimatedMonthlyCost: Optional[Double] = Optional.Absent,
    currencyCode: Optional[String] = Optional.Absent,
    implementationEffort: Optional[String] = Optional.Absent,
    restartNeeded: Optional[Boolean] = Optional.Absent,
    actionType: Optional[String] = Optional.Absent,
    rollbackPossible: Optional[Boolean] = Optional.Absent,
    currentResourceSummary: Optional[String] = Optional.Absent,
    recommendedResourceSummary: Optional[String] = Optional.Absent,
    lastRefreshTimestamp: Optional[Datetime] = Optional.Absent,
    recommendationLookbackPeriodInDays: Optional[Integer] = Optional.Absent,
    source: Optional[zio.aws.costoptimizationhub.model.Source] =
      Optional.Absent,
    tags: Optional[Iterable[zio.aws.costoptimizationhub.model.Tag]] =
      Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.costoptimizationhub.model.Recommendation = {
    import Recommendation.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.costoptimizationhub.model.Recommendation
      .builder()
      .optionallyWith(recommendationId.map(value => value: java.lang.String))(
        _.recommendationId
      )
      .optionallyWith(accountId.map(value => value: java.lang.String))(
        _.accountId
      )
      .optionallyWith(region.map(value => value: java.lang.String))(_.region)
      .optionallyWith(resourceId.map(value => value: java.lang.String))(
        _.resourceId
      )
      .optionallyWith(resourceArn.map(value => value: java.lang.String))(
        _.resourceArn
      )
      .optionallyWith(
        currentResourceType.map(value => value: java.lang.String)
      )(_.currentResourceType)
      .optionallyWith(
        recommendedResourceType.map(value => value: java.lang.String)
      )(_.recommendedResourceType)
      .optionallyWith(
        estimatedMonthlySavings.map(value => value: java.lang.Double)
      )(_.estimatedMonthlySavings)
      .optionallyWith(
        estimatedSavingsPercentage.map(value => value: java.lang.Double)
      )(_.estimatedSavingsPercentage)
      .optionallyWith(
        estimatedMonthlyCost.map(value => value: java.lang.Double)
      )(_.estimatedMonthlyCost)
      .optionallyWith(currencyCode.map(value => value: java.lang.String))(
        _.currencyCode
      )
      .optionallyWith(
        implementationEffort.map(value => value: java.lang.String)
      )(_.implementationEffort)
      .optionallyWith(restartNeeded.map(value => value: java.lang.Boolean))(
        _.restartNeeded
      )
      .optionallyWith(actionType.map(value => value: java.lang.String))(
        _.actionType
      )
      .optionallyWith(rollbackPossible.map(value => value: java.lang.Boolean))(
        _.rollbackPossible
      )
      .optionallyWith(
        currentResourceSummary.map(value => value: java.lang.String)
      )(_.currentResourceSummary)
      .optionallyWith(
        recommendedResourceSummary.map(value => value: java.lang.String)
      )(_.recommendedResourceSummary)
      .optionallyWith(
        lastRefreshTimestamp.map(value => Datetime.unwrap(value): Instant)
      )(_.lastRefreshTimestamp)
      .optionallyWith(
        recommendationLookbackPeriodInDays.map(value =>
          value: java.lang.Integer
        )
      )(_.recommendationLookbackPeriodInDays)
      .optionallyWith(source.map(value => value.unwrap))(_.source)
      .optionallyWith(
        tags.map(value =>
          value.map { item =>
            item.buildAwsValue()
          }.asJavaCollection
        )
      )(_.tags)
      .build()
  }
  def asReadOnly: zio.aws.costoptimizationhub.model.Recommendation.ReadOnly =
    zio.aws.costoptimizationhub.model.Recommendation.wrap(buildAwsValue())
}
object Recommendation {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.costoptimizationhub.model.Recommendation
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.costoptimizationhub.model.Recommendation =
      zio.aws.costoptimizationhub.model.Recommendation(
        recommendationId.map(value => value),
        accountId.map(value => value),
        region.map(value => value),
        resourceId.map(value => value),
        resourceArn.map(value => value),
        currentResourceType.map(value => value),
        recommendedResourceType.map(value => value),
        estimatedMonthlySavings.map(value => value),
        estimatedSavingsPercentage.map(value => value),
        estimatedMonthlyCost.map(value => value),
        currencyCode.map(value => value),
        implementationEffort.map(value => value),
        restartNeeded.map(value => value),
        actionType.map(value => value),
        rollbackPossible.map(value => value),
        currentResourceSummary.map(value => value),
        recommendedResourceSummary.map(value => value),
        lastRefreshTimestamp.map(value => value),
        recommendationLookbackPeriodInDays.map(value => value),
        source.map(value => value),
        tags.map(value =>
          value.map { item =>
            item.asEditable
          }
        )
      )
    def recommendationId: Optional[String]
    def accountId: Optional[String]
    def region: Optional[String]
    def resourceId: Optional[String]
    def resourceArn: Optional[String]
    def currentResourceType: Optional[String]
    def recommendedResourceType: Optional[String]
    def estimatedMonthlySavings: Optional[Double]
    def estimatedSavingsPercentage: Optional[Double]
    def estimatedMonthlyCost: Optional[Double]
    def currencyCode: Optional[String]
    def implementationEffort: Optional[String]
    def restartNeeded: Optional[Boolean]
    def actionType: Optional[String]
    def rollbackPossible: Optional[Boolean]
    def currentResourceSummary: Optional[String]
    def recommendedResourceSummary: Optional[String]
    def lastRefreshTimestamp: Optional[Datetime]
    def recommendationLookbackPeriodInDays: Optional[Integer]
    def source: Optional[zio.aws.costoptimizationhub.model.Source]
    def tags: Optional[List[zio.aws.costoptimizationhub.model.Tag.ReadOnly]]
    def getRecommendationId: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("recommendationId", recommendationId)
    def getAccountId: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("accountId", accountId)
    def getRegion: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("region", region)
    def getResourceId: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("resourceId", resourceId)
    def getResourceArn: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("resourceArn", resourceArn)
    def getCurrentResourceType: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("currentResourceType", currentResourceType)
    def getRecommendedResourceType: ZIO[Any, AwsError, String] = AwsError
      .unwrapOptionField("recommendedResourceType", recommendedResourceType)
    def getEstimatedMonthlySavings: ZIO[Any, AwsError, Double] = AwsError
      .unwrapOptionField("estimatedMonthlySavings", estimatedMonthlySavings)
    def getEstimatedSavingsPercentage: ZIO[Any, AwsError, Double] =
      AwsError.unwrapOptionField(
        "estimatedSavingsPercentage",
        estimatedSavingsPercentage
      )
    def getEstimatedMonthlyCost: ZIO[Any, AwsError, Double] =
      AwsError.unwrapOptionField("estimatedMonthlyCost", estimatedMonthlyCost)
    def getCurrencyCode: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("currencyCode", currencyCode)
    def getImplementationEffort: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("implementationEffort", implementationEffort)
    def getRestartNeeded: ZIO[Any, AwsError, Boolean] =
      AwsError.unwrapOptionField("restartNeeded", restartNeeded)
    def getActionType: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("actionType", actionType)
    def getRollbackPossible: ZIO[Any, AwsError, Boolean] =
      AwsError.unwrapOptionField("rollbackPossible", rollbackPossible)
    def getCurrentResourceSummary: ZIO[Any, AwsError, String] = AwsError
      .unwrapOptionField("currentResourceSummary", currentResourceSummary)
    def getRecommendedResourceSummary: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField(
        "recommendedResourceSummary",
        recommendedResourceSummary
      )
    def getLastRefreshTimestamp: ZIO[Any, AwsError, Datetime] =
      AwsError.unwrapOptionField("lastRefreshTimestamp", lastRefreshTimestamp)
    def getRecommendationLookbackPeriodInDays: ZIO[Any, AwsError, Integer] =
      AwsError.unwrapOptionField(
        "recommendationLookbackPeriodInDays",
        recommendationLookbackPeriodInDays
      )
    def getSource
        : ZIO[Any, AwsError, zio.aws.costoptimizationhub.model.Source] =
      AwsError.unwrapOptionField("source", source)
    def getTags: ZIO[Any, AwsError, List[
      zio.aws.costoptimizationhub.model.Tag.ReadOnly
    ]] = AwsError.unwrapOptionField("tags", tags)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.costoptimizationhub.model.Recommendation
  ) extends zio.aws.costoptimizationhub.model.Recommendation.ReadOnly {
    override val recommendationId: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.recommendationId())
      .map(value => value: String)
    override val accountId: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.accountId())
      .map(value => value: String)
    override val region: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.region())
      .map(value => value: String)
    override val resourceId: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.resourceId())
      .map(value => value: String)
    override val resourceArn: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.resourceArn())
      .map(value => value: String)
    override val currentResourceType: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.currentResourceType())
      .map(value => value: String)
    override val recommendedResourceType: Optional[String] =
      zio.aws.core.internal
        .optionalFromNullable(impl.recommendedResourceType())
        .map(value => value: String)
    override val estimatedMonthlySavings: Optional[Double] =
      zio.aws.core.internal
        .optionalFromNullable(impl.estimatedMonthlySavings())
        .map(value => value: Double)
    override val estimatedSavingsPercentage: Optional[Double] =
      zio.aws.core.internal
        .optionalFromNullable(impl.estimatedSavingsPercentage())
        .map(value => value: Double)
    override val estimatedMonthlyCost: Optional[Double] = zio.aws.core.internal
      .optionalFromNullable(impl.estimatedMonthlyCost())
      .map(value => value: Double)
    override val currencyCode: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.currencyCode())
      .map(value => value: String)
    override val implementationEffort: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.implementationEffort())
      .map(value => value: String)
    override val restartNeeded: Optional[Boolean] = zio.aws.core.internal
      .optionalFromNullable(impl.restartNeeded())
      .map(value => value: Boolean)
    override val actionType: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.actionType())
      .map(value => value: String)
    override val rollbackPossible: Optional[Boolean] = zio.aws.core.internal
      .optionalFromNullable(impl.rollbackPossible())
      .map(value => value: Boolean)
    override val currentResourceSummary: Optional[String] =
      zio.aws.core.internal
        .optionalFromNullable(impl.currentResourceSummary())
        .map(value => value: String)
    override val recommendedResourceSummary: Optional[String] =
      zio.aws.core.internal
        .optionalFromNullable(impl.recommendedResourceSummary())
        .map(value => value: String)
    override val lastRefreshTimestamp: Optional[Datetime] =
      zio.aws.core.internal
        .optionalFromNullable(impl.lastRefreshTimestamp())
        .map(value =>
          zio.aws.costoptimizationhub.model.primitives.Datetime(value)
        )
    override val recommendationLookbackPeriodInDays: Optional[Integer] =
      zio.aws.core.internal
        .optionalFromNullable(impl.recommendationLookbackPeriodInDays())
        .map(value => value: Integer)
    override val source: Optional[zio.aws.costoptimizationhub.model.Source] =
      zio.aws.core.internal
        .optionalFromNullable(impl.source())
        .map(value => zio.aws.costoptimizationhub.model.Source.wrap(value))
    override val tags
        : Optional[List[zio.aws.costoptimizationhub.model.Tag.ReadOnly]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.tags())
        .map(value =>
          value.asScala.map { item =>
            zio.aws.costoptimizationhub.model.Tag.wrap(item)
          }.toList
        )
  }
  def wrap(
      impl: software.amazon.awssdk.services.costoptimizationhub.model.Recommendation
  ): zio.aws.costoptimizationhub.model.Recommendation.ReadOnly = new Wrapper(
    impl
  )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy