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

io.github.vigoo.zioaws.pi.model.DataPoint.scala Maven / Gradle / Ivy

package io.github.vigoo.zioaws.pi.model
import scala.jdk.CollectionConverters._
import java.time.Instant
import zio.{ Chunk, ZIO }
import software.amazon.awssdk.core.SdkBytes
final case class DataPoint(timestamp: primitives.ISOTimestamp, value: Double) {
  def buildAwsValue(): software.amazon.awssdk.services.pi.model.DataPoint = {
    import DataPoint.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.pi.model.DataPoint.builder().timestamp(timestamp: java.time.Instant).value(value: java.lang.Double).build()
  }
  def asReadOnly: DataPoint.ReadOnly = DataPoint.wrap(buildAwsValue())
}
object DataPoint {
  private lazy val zioAwsBuilderHelper: io.github.vigoo.zioaws.core.BuilderHelper[software.amazon.awssdk.services.pi.model.DataPoint] = io.github.vigoo.zioaws.core.BuilderHelper.apply
  trait ReadOnly {
    def editable: DataPoint = DataPoint(timestampValue, valueValue)
    def timestampValue: primitives.ISOTimestamp
    def valueValue: Double
    def timestamp: ZIO[Any, Nothing, primitives.ISOTimestamp] = ZIO.succeed(timestampValue)
    def value: ZIO[Any, Nothing, Double] = ZIO.succeed(valueValue)
  }
  private class Wrapper(impl: software.amazon.awssdk.services.pi.model.DataPoint) extends DataPoint.ReadOnly {
    override def timestampValue: primitives.ISOTimestamp = impl.timestamp(): primitives.ISOTimestamp
    override def valueValue: Double = impl.value(): Double
  }
  def wrap(impl: software.amazon.awssdk.services.pi.model.DataPoint): ReadOnly = new Wrapper(impl)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy