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

io.k8s.api.flowcontrol.v1.FlowDistinguisherMethod.scala Maven / Gradle / Ivy

package io.k8s.api.flowcontrol.v1

import dev.hnaderi.k8s.utils._

/** FlowDistinguisherMethod specifies the method of a flow distinguisher. */
final case class FlowDistinguisherMethod(
  `type` : String
) {

  /** Returns a new data with `type` set to new value */
  def withType(value: String) : FlowDistinguisherMethod = copy(`type` = value)
  /** transforms `type` to result of function */
  def mapType(f: String => String) : FlowDistinguisherMethod = copy(`type` = f(`type`))
}

object FlowDistinguisherMethod {

    implicit val encoder : Encoder[io.k8s.api.flowcontrol.v1.FlowDistinguisherMethod] = new Encoder[io.k8s.api.flowcontrol.v1.FlowDistinguisherMethod] {
        def apply[T : Builder](o: io.k8s.api.flowcontrol.v1.FlowDistinguisherMethod) : T = {
          val obj = ObjectWriter[T]()
          obj
            .write("type", o.`type`)
            .build
        }
    }

    implicit val decoder: Decoder[FlowDistinguisherMethod] = new Decoder[FlowDistinguisherMethod] {
      def apply[T : Reader](t: T): Either[String, FlowDistinguisherMethod] = for {
          obj <- ObjectReader(t)
          `type` <- obj.read[String]("type")
      } yield FlowDistinguisherMethod (
          `type` = `type`
        )
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy