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

zio.aws.elasticinference.model.KeyValuePair.scala Maven / Gradle / Ivy

The newest version!
package zio.aws.elasticinference.model
import zio.prelude.data.Optional
import zio.aws.core.{AwsError, BuilderHelper}
import zio.ZIO
import zio.aws.elasticinference.model.primitives.{Value, Key}
import java.lang.Integer
import scala.jdk.CollectionConverters._
final case class KeyValuePair(
    key: Optional[Key] = Optional.Absent,
    value: Optional[Value] = Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.elasticinference.model.KeyValuePair = {
    import KeyValuePair.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.elasticinference.model.KeyValuePair
      .builder()
      .optionallyWith(key.map(value => Key.unwrap(value): java.lang.String))(
        _.key
      )
      .optionallyWith(value.map(value => Value.unwrap(value): Integer))(_.value)
      .build()
  }
  def asReadOnly: zio.aws.elasticinference.model.KeyValuePair.ReadOnly =
    zio.aws.elasticinference.model.KeyValuePair.wrap(buildAwsValue())
}
object KeyValuePair {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.elasticinference.model.KeyValuePair
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.elasticinference.model.KeyValuePair =
      zio.aws.elasticinference.model
        .KeyValuePair(key.map(value => value), value.map(value => value))
    def key: Optional[Key]
    def value: Optional[Value]
    def getKey: ZIO[Any, AwsError, Key] = AwsError.unwrapOptionField("key", key)
    def getValue: ZIO[Any, AwsError, Value] =
      AwsError.unwrapOptionField("value", value)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.elasticinference.model.KeyValuePair
  ) extends zio.aws.elasticinference.model.KeyValuePair.ReadOnly {
    override val key: Optional[Key] = zio.aws.core.internal
      .optionalFromNullable(impl.key())
      .map(value => zio.aws.elasticinference.model.primitives.Key(value))
    override val value: Optional[Value] = zio.aws.core.internal
      .optionalFromNullable(impl.value())
      .map(value => zio.aws.elasticinference.model.primitives.Value(value))
  }
  def wrap(
      impl: software.amazon.awssdk.services.elasticinference.model.KeyValuePair
  ): zio.aws.elasticinference.model.KeyValuePair.ReadOnly = new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy