/** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.0.1 * User agent: apibuilder app.apibuilder.io/nccloud/registry-api/0.0.1/http4s_0_15 */ package de.nccloud.registry.api.v0.models { sealed trait ServiceEvent extends _root_.scala.Product with _root_.scala.Serializable { def serviceEventType: ServiceEventType } /** * Defines the valid type values for the type ServiceEvent */ sealed trait ServiceEventType extends _root_.scala.Product with _root_.scala.Serializable object ServiceEventType { case object ServiceUpsertedEvent extends ServiceEventType { override def toString = "service_upserted_event" } case object ServiceDeletedEvent extends ServiceEventType { override def toString = "service_deleted_event" } final case class UNDEFINED(override val toString: String) extends ServiceEventType val all: scala.List[ServiceEventType] = scala.List(ServiceUpsertedEvent, ServiceDeletedEvent) private val byName: Map[String, ServiceEventType] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): ServiceEventType = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[ServiceEventType] = byName.get(value.toLowerCase) } /** * A single available service. * * @param uri URI under which this service is deployed. * @param title A human-readable title of the service. * @param description A human-readable description of the service. */ final case class Service( name: String, version: String, state: de.nccloud.registry.api.v0.models.ServiceState, `type`: de.nccloud.registry.api.v0.models.ServiceType = de.nccloud.registry.api.v0.models.ServiceType.Public, uri: String, title: _root_.scala.Option[String] = None, description: _root_.scala.Option[String] = None ) /** * A service has been undeployed is not reachable anymore. * * @param name Name of the service that has been undeployed. */ final case class ServiceDeletedEvent( name: String, timestamp: _root_.java.time.Instant ) extends ServiceEvent { override val serviceEventType: ServiceEventType = ServiceEventType.ServiceDeletedEvent } /** * A service has been newly deployed or updated. */ final case class ServiceUpsertedEvent( service: de.nccloud.registry.api.v0.models.Service, timestamp: _root_.java.time.Instant ) extends ServiceEvent { override val serviceEventType: ServiceEventType = ServiceEventType.ServiceUpsertedEvent } /** * Provides future compatibility in clients - in the future, when a type is added * to the union ServiceEvent, it will need to be handled in the client code. This * implementation will deserialize these future types as an instance of this class. * * @param description Information about the type that we received that is undefined in this version of * the client. */ final case class ServiceEventUndefinedType( description: String ) extends ServiceEvent { override val serviceEventType: ServiceEventType = ServiceEventType.UNDEFINED(description) } /** * The current state of a single service. */ sealed trait ServiceState extends _root_.scala.Product with _root_.scala.Serializable object ServiceState { /** * This service is currently not deployed. */ case object Unavailable extends ServiceState { override def toString = "unavailable" } /** * This service is deployed and reachable. */ case object Available extends ServiceState { override def toString = "available" } /** * This service is deployed but not reachable due to an error. */ case object Error extends ServiceState { override def toString = "error" } /** * UNDEFINED captures values that are sent either in error or * that were added by the server after this library was * generated. We want to make it easy and obvious to users of * this library to handle this case gracefully. * * We use all CAPS for the variable name to avoid collisions * with the camel cased values above. */ final case class UNDEFINED(override val toString: String) extends ServiceState /** * all returns a list of all the valid, known values. We use * lower case to avoid collisions with the camel cased values * above. */ val all: scala.List[ServiceState] = scala.List(Unavailable, Available, Error) private val byName: Map[String, ServiceState] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): ServiceState = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[ServiceState] = byName.get(value.toLowerCase) } /** * Indicates where a service is reachable. */ sealed trait ServiceType extends _root_.scala.Product with _root_.scala.Serializable object ServiceType { /** * This service is publicly reachable. */ case object Public extends ServiceType { override def toString = "public" } /** * This service only reachable internally in the cluster. */ case object Internal extends ServiceType { override def toString = "internal" } /** * UNDEFINED captures values that are sent either in error or * that were added by the server after this library was * generated. We want to make it easy and obvious to users of * this library to handle this case gracefully. * * We use all CAPS for the variable name to avoid collisions * with the camel cased values above. */ final case class UNDEFINED(override val toString: String) extends ServiceType /** * all returns a list of all the valid, known values. We use * lower case to avoid collisions with the camel cased values * above. */ val all: scala.List[ServiceType] = scala.List(Public, Internal) private val byName: Map[String, ServiceType] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): ServiceType = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[ServiceType] = byName.get(value.toLowerCase) } }