zio.aws.costoptimizationhub.model.ResourceCostCalculation.scala Maven / Gradle / Ivy
package zio.aws.costoptimizationhub.model
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import scala.jdk.CollectionConverters.*
final case class ResourceCostCalculation(
usages: Optional[Iterable[zio.aws.costoptimizationhub.model.Usage]] =
Optional.Absent,
pricing: Optional[zio.aws.costoptimizationhub.model.ResourcePricing] =
Optional.Absent
) {
def buildAwsValue()
: software.amazon.awssdk.services.costoptimizationhub.model.ResourceCostCalculation = {
import ResourceCostCalculation.zioAwsBuilderHelper.BuilderOps
software.amazon.awssdk.services.costoptimizationhub.model.ResourceCostCalculation
.builder()
.optionallyWith(
usages.map(value =>
value.map { item =>
item.buildAwsValue()
}.asJavaCollection
)
)(_.usages)
.optionallyWith(pricing.map(value => value.buildAwsValue()))(_.pricing)
.build()
}
def asReadOnly
: zio.aws.costoptimizationhub.model.ResourceCostCalculation.ReadOnly =
zio.aws.costoptimizationhub.model.ResourceCostCalculation
.wrap(buildAwsValue())
}
object ResourceCostCalculation {
private lazy val zioAwsBuilderHelper: BuilderHelper[
software.amazon.awssdk.services.costoptimizationhub.model.ResourceCostCalculation
] = BuilderHelper.apply
trait ReadOnly {
def asEditable: zio.aws.costoptimizationhub.model.ResourceCostCalculation =
zio.aws.costoptimizationhub.model.ResourceCostCalculation(
usages.map(value =>
value.map { item =>
item.asEditable
}
),
pricing.map(value => value.asEditable)
)
def usages: Optional[List[zio.aws.costoptimizationhub.model.Usage.ReadOnly]]
def pricing
: Optional[zio.aws.costoptimizationhub.model.ResourcePricing.ReadOnly]
def getUsages: ZIO[Any, AwsError, List[
zio.aws.costoptimizationhub.model.Usage.ReadOnly
]] = AwsError.unwrapOptionField("usages", usages)
def getPricing: ZIO[
Any,
AwsError,
zio.aws.costoptimizationhub.model.ResourcePricing.ReadOnly
] = AwsError.unwrapOptionField("pricing", pricing)
}
private final class Wrapper(
impl: software.amazon.awssdk.services.costoptimizationhub.model.ResourceCostCalculation
) extends zio.aws.costoptimizationhub.model.ResourceCostCalculation.ReadOnly {
override val usages
: Optional[List[zio.aws.costoptimizationhub.model.Usage.ReadOnly]] =
zio.aws.core.internal
.optionalFromNullable(impl.usages())
.map(value =>
value.asScala.map { item =>
zio.aws.costoptimizationhub.model.Usage.wrap(item)
}.toList
)
override val pricing
: Optional[zio.aws.costoptimizationhub.model.ResourcePricing.ReadOnly] =
zio.aws.core.internal
.optionalFromNullable(impl.pricing())
.map(value =>
zio.aws.costoptimizationhub.model.ResourcePricing.wrap(value)
)
}
def wrap(
impl: software.amazon.awssdk.services.costoptimizationhub.model.ResourceCostCalculation
): zio.aws.costoptimizationhub.model.ResourceCostCalculation.ReadOnly =
new Wrapper(impl)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy