package de.nccloud.registry.api.v0.models import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonSubTypes import com.fasterxml.jackson.annotation.JsonTypeInfo import java.io.Serializable import kotlin.String import org.threeten.bp.Instant /** * This code was generated by [models.generator.kotlin.KotlinGenerator] */ @JsonIgnoreProperties(ignoreUnknown=true) @JsonTypeInfo( use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, include = com.fasterxml.jackson.annotation.JsonTypeInfo.As.PROPERTY, property = "type", defaultImpl = de.nccloud.registry.api.v0.models.ServiceEvent.ServiceEventUndefined::class ) @JsonSubTypes( JsonSubTypes.Type(value = de.nccloud.registry.api.v0.models.ServiceEvent.ServiceUpsertedEvent::class, name = "service_upserted_event"), JsonSubTypes.Type(value = de.nccloud.registry.api.v0.models.ServiceEvent.ServiceDeletedEvent::class, name = "service_deleted_event"), JsonSubTypes.Type(value = de.nccloud.registry.api.v0.models.ServiceEvent.ServiceEventUndefined::class) ) sealed class ServiceEvent { /** * This code was generated by [models.generator.kotlin.KotlinGenerator] * A service has been undeployed is not reachable anymore. */ @JsonIgnoreProperties(ignoreUnknown=true) @JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NONE) data class ServiceDeletedEvent( @JsonProperty("name") @get:JsonProperty("name") val name: String, @JsonProperty("timestamp") @get:JsonProperty("timestamp") val timestamp: Instant ) : ServiceEvent(), Serializable { fun toJsonString(): String = de.nccloud.registry.api.v0.models.JacksonObjectMapperFactory.create().writeValueAsString(this) companion object { fun parseJson(json: String): ServiceDeletedEvent = de.nccloud.registry.api.v0.models.JacksonObjectMapperFactory.create().readValue( json, ServiceDeletedEvent::class.java) } } /** * This code was generated by [models.generator.kotlin.KotlinGenerator] * A service has been newly deployed or updated. */ @JsonIgnoreProperties(ignoreUnknown=true) @JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NONE) data class ServiceUpsertedEvent( @JsonProperty("service") @get:JsonProperty("service") val service: Service, @JsonProperty("timestamp") @get:JsonProperty("timestamp") val timestamp: Instant ) : ServiceEvent(), Serializable { fun toJsonString(): String = de.nccloud.registry.api.v0.models.JacksonObjectMapperFactory.create().writeValueAsString(this) companion object { fun parseJson(json: String): ServiceUpsertedEvent = de.nccloud.registry.api.v0.models.JacksonObjectMapperFactory.create().readValue( json, ServiceUpsertedEvent::class.java) } } @JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NONE) object ServiceEventUndefined : ServiceEvent() companion object { fun parseJson(json: String): ServiceEvent = de.nccloud.registry.api.v0.models.JacksonObjectMapperFactory.create().readValue( json, ServiceEvent::class.java) } }