/** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.0.1 * User agent: apibuilder app.apibuilder.io/nccloud/reporting-api/0.0.1/scala_models */ package de.nccloud.reporting.api.v0.models { sealed trait ReportingEvent extends _root_.scala.Product with _root_.scala.Serializable { def reportingEventType: ReportingEventType } /** * Defines the valid type values for the type ReportingEvent */ sealed trait ReportingEventType extends _root_.scala.Product with _root_.scala.Serializable object ReportingEventType { case object UpdateEvent extends ReportingEventType { override def toString = "update_event" } case object DeleteEvent extends ReportingEventType { override def toString = "delete_event" } final case class UNDEFINED(override val toString: String) extends ReportingEventType val all: scala.List[ReportingEventType] = scala.List(UpdateEvent, DeleteEvent) private val byName: Map[String, ReportingEventType] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): ReportingEventType = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[ReportingEventType] = byName.get(value.toLowerCase) } /** * Deletes a reporting entity defined by its `tracking_id`. * * @param trackingId A unique id, which identifies the association of multiple events. This can i.e. * be a user guid, for events related to a user. It is important, that this id is * unique and immutable. * @param audit Audit information about this event. */ final case class DeleteEvent( trackingId: String, audit: de.nccloud.common.v0.models.Audit ) extends ReportingEvent { override val reportingEventType: ReportingEventType = ReportingEventType.DeleteEvent } /** * Single field of a topic schema. A field can be used for projecting, filtering * and sorting in reports. * * @param `type` The (scalar) type of the field. Fields can only be primitive types. * @param isArray Setting this to `true` means the field is an array of given type. * @param fields Nested fields for type `object`. When defining fields but not having set the * type to `object`, the fields will be ignored. When setting the type to `object`, * the fields need to be defined. * @param label A human-readable label for the field. * @param description A human-readable description of the field. */ final case class Field( `type`: de.nccloud.reporting.api.v0.models.ScalarType, isArray: Boolean, fields: _root_.scala.Option[Map[String, de.nccloud.reporting.api.v0.models.Field]] = None, label: _root_.scala.Option[String] = None, description: _root_.scala.Option[String] = None ) /** * Defines a condition for values. * * @param expression An SQL-like expression. * @param variables A map of values, which can be used in the expression. Variables can be access by * prepending them with `$`. */ final case class Filter( expression: _root_.scala.Option[String] = None, variables: _root_.scala.Option[Map[String, _root_.play.api.libs.json.JsValue]] = None ) /** * A single field of a projection schema. * * @param label A human-readable label for the field. * @param description A human-readable description for the field. * @param source The source of the field. Either `source` or `fields` must be set. * @param fields Defines nested fields for this projection. Either `source` or `fields` must be * set. */ final case class ProjectionField( label: _root_.scala.Option[String] = None, description: _root_.scala.Option[String] = None, source: _root_.scala.Option[de.nccloud.reporting.api.v0.models.ProjectionFieldSource] = None, fields: _root_.scala.Option[Map[String, de.nccloud.reporting.api.v0.models.ProjectionField]] = None ) /** * Represents the source for a single projection field from a topic's schema. * * @param topic Name of the originating topic. * @param path A slimmed down variant of [JSON * Path](https://gregsdennis.github.io/Manatee.Json/usage/path.html) to point to a * specific field in a topic's schema. * @param filter A conditional filter expression. The expression can contain variables, which * will be passed in when evaluating the projection. */ final case class ProjectionFieldSource( topic: String, path: String, filter: String ) /** * Form for querying and projecting data. * * @param view The name of a defined `view` used for projecting. If the view defines variables, * they must be provided as well. Either `view` or `projection` must be set. * @param projection Projected fields to return. Either `view` or `projection` must be set. * @param variables Variables to pass to the projection or the view. * @param sort The defined properties refer to the fields of the projection. */ final case class QueryForm( view: _root_.scala.Option[String] = None, projection: _root_.scala.Option[Map[String, de.nccloud.reporting.api.v0.models.ProjectionField]] = None, variables: Map[String, _root_.play.api.libs.json.JsValue], sort: _root_.scala.Option[Seq[de.nccloud.common.v0.models.Sort]] = None ) /** * The result of a query, returning data in a projected form. * * @param data The returned data in the projected form. */ final case class QueryResponse( page: de.nccloud.common.v0.models.PageResponse, data: _root_.play.api.libs.json.JsObject ) /** * Represents a single topic, which will be consumed by the reporting service. * * @param service Info about the producing service. * @param schema The schema of the topics' provided data. */ final case class Topic( name: String, service: de.nccloud.common.v0.models.ServiceInfo, schema: Map[String, de.nccloud.reporting.api.v0.models.Field] ) final case class TopicResponse( page: de.nccloud.common.v0.models.PageResponse, data: Seq[de.nccloud.reporting.api.v0.models.Topic] ) /** * Updates one or more data fields. * * @param trackingId A unique id, which identifies the association of multiple events. This can i.e. * be a user guid, for events related to a user. It is important, that this id is * unique and immutable. * @param payload One or more fields defined in the reporting schema, which will be updated. * @param audit Audit information about this event. */ final case class UpdateEvent( trackingId: String, payload: _root_.play.api.libs.json.JsObject, audit: de.nccloud.common.v0.models.Audit ) extends ReportingEvent { override val reportingEventType: ReportingEventType = ReportingEventType.UpdateEvent } /** * A stored view containing data from one or more topics. * * @param guid Globally unique identifier of the projection. * @param name Name of this projection used to reference it in a human-friendly way. The name * must be unique. * @param projection Projected fields of this view. * @param variables Definition of variables which can be passed to the view. All `scalar_type`s are * allowed, except `object`. */ final case class View( guid: _root_.java.util.UUID, name: String, projection: Map[String, de.nccloud.reporting.api.v0.models.ProjectionField], variables: Map[String, de.nccloud.reporting.api.v0.models.ScalarType] ) /** * Form for creating a new `view`. * * @param name Name of the view. * @param projection Projected fields of this view. * @param variables Definition of variables which can be passed to the view. All `scalar_type`s are * allowed, except `object`. */ final case class ViewForm( name: String, projection: Map[String, de.nccloud.reporting.api.v0.models.ProjectionField], variables: Map[String, de.nccloud.reporting.api.v0.models.ScalarType] ) final case class ViewResponse( page: de.nccloud.common.v0.models.PageResponse, data: Seq[de.nccloud.reporting.api.v0.models.View] ) /** * Provides future compatibility in clients - in the future, when a type is added * to the union ReportingEvent, 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 ReportingEventUndefinedType( description: String ) extends ReportingEvent { override val reportingEventType: ReportingEventType = ReportingEventType.UNDEFINED(description) } /** * A type for a topic's schema field. */ sealed trait ScalarType extends _root_.scala.Product with _root_.scala.Serializable object ScalarType { case object Boolean extends ScalarType { override def toString = "boolean" } case object DateIso8601 extends ScalarType { override def toString = "date-iso8601" } case object DateTimeIso8601 extends ScalarType { override def toString = "date-time-iso8601" } case object Decimal extends ScalarType { override def toString = "decimal" } case object Double extends ScalarType { override def toString = "double" } case object Integer extends ScalarType { override def toString = "integer" } case object Long extends ScalarType { override def toString = "long" } case object String extends ScalarType { override def toString = "string" } case object Uuid extends ScalarType { override def toString = "uuid" } /** * Note: when a type is set to `object`, the additional fields **must** be defined * in the schema. */ case object Object extends ScalarType { override def toString = "object" } /** * 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 ScalarType /** * 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[ScalarType] = scala.List(Boolean, DateIso8601, DateTimeIso8601, Decimal, Double, Integer, Long, String, Uuid, Object) private val byName: Map[String, ScalarType] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): ScalarType = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[ScalarType] = byName.get(value.toLowerCase) } }