com.ngrok.definitions.EndpointLoggingMutate.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ngrok-api-scala_2.13 Show documentation
Show all versions of ngrok-api-scala_2.13 Show documentation
ngrok API client for Scala applications
package com.ngrok.definitions
import io.circe.syntax._
/** A class encapsulating the [[EndpointLoggingMutate]] resource.
*
* @constructor create a new EndpointLoggingMutate.
* @param enabled true
if the module will be applied to traffic, false
to disable. default true
if unspecified
* @param eventStreamIds list of all EventStreams that will be used to configure and export this endpoint's logs
*/
final case class EndpointLoggingMutate(
enabled: Option[Boolean] = None,
eventStreamIds: List[String]
)
object EndpointLoggingMutate {
implicit val encodeEndpointLoggingMutate: io.circe.Encoder[EndpointLoggingMutate] =
io.circe.Encoder.encodeJsonObject.contramap(value =>
List(
value.enabled.map(_.asJson).map(("enabled", _)),
Option(("event_stream_ids", value.eventStreamIds.asJson))
).flatten.toMap.asJsonObject
)
implicit val decodeEndpointLoggingMutate: io.circe.Decoder[EndpointLoggingMutate] = (c: io.circe.HCursor) =>
for {
enabled <- c.downField("enabled").as[Option[Boolean]]
eventStreamIds <- c.downField("event_stream_ids").as[List[String]]
} yield EndpointLoggingMutate(
enabled,
eventStreamIds
)
}