zio.aws.costoptimizationhub.model.Usage.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 Usage(
usageType: Optional[String] = Optional.Absent,
usageAmount: Optional[Double] = Optional.Absent,
operation: Optional[String] = Optional.Absent,
productCode: Optional[String] = Optional.Absent,
unit: Optional[String] = Optional.Absent
) {
def buildAwsValue()
: software.amazon.awssdk.services.costoptimizationhub.model.Usage = {
import Usage.zioAwsBuilderHelper.BuilderOps
software.amazon.awssdk.services.costoptimizationhub.model.Usage
.builder()
.optionallyWith(usageType.map(value => value: java.lang.String))(
_.usageType
)
.optionallyWith(usageAmount.map(value => value: java.lang.Double))(
_.usageAmount
)
.optionallyWith(operation.map(value => value: java.lang.String))(
_.operation
)
.optionallyWith(productCode.map(value => value: java.lang.String))(
_.productCode
)
.optionallyWith(unit.map(value => value: java.lang.String))(_.unit)
.build()
}
def asReadOnly: zio.aws.costoptimizationhub.model.Usage.ReadOnly =
zio.aws.costoptimizationhub.model.Usage.wrap(buildAwsValue())
}
object Usage {
private lazy val zioAwsBuilderHelper: BuilderHelper[
software.amazon.awssdk.services.costoptimizationhub.model.Usage
] = BuilderHelper.apply
trait ReadOnly {
def asEditable: zio.aws.costoptimizationhub.model.Usage =
zio.aws.costoptimizationhub.model.Usage(
usageType.map(value => value),
usageAmount.map(value => value),
operation.map(value => value),
productCode.map(value => value),
unit.map(value => value)
)
def usageType: Optional[String]
def usageAmount: Optional[Double]
def operation: Optional[String]
def productCode: Optional[String]
def unit: Optional[String]
def getUsageType: ZIO[Any, AwsError, String] =
AwsError.unwrapOptionField("usageType", usageType)
def getUsageAmount: ZIO[Any, AwsError, Double] =
AwsError.unwrapOptionField("usageAmount", usageAmount)
def getOperation: ZIO[Any, AwsError, String] =
AwsError.unwrapOptionField("operation", operation)
def getProductCode: ZIO[Any, AwsError, String] =
AwsError.unwrapOptionField("productCode", productCode)
def getUnit: ZIO[Any, AwsError, String] =
AwsError.unwrapOptionField("unit", unit)
}
private final class Wrapper(
impl: software.amazon.awssdk.services.costoptimizationhub.model.Usage
) extends zio.aws.costoptimizationhub.model.Usage.ReadOnly {
override val usageType: Optional[String] = zio.aws.core.internal
.optionalFromNullable(impl.usageType())
.map(value => value: String)
override val usageAmount: Optional[Double] = zio.aws.core.internal
.optionalFromNullable(impl.usageAmount())
.map(value => value: Double)
override val operation: Optional[String] = zio.aws.core.internal
.optionalFromNullable(impl.operation())
.map(value => value: String)
override val productCode: Optional[String] = zio.aws.core.internal
.optionalFromNullable(impl.productCode())
.map(value => value: String)
override val unit: Optional[String] = zio.aws.core.internal
.optionalFromNullable(impl.unit())
.map(value => value: String)
}
def wrap(
impl: software.amazon.awssdk.services.costoptimizationhub.model.Usage
): zio.aws.costoptimizationhub.model.Usage.ReadOnly = new Wrapper(impl)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy