Documentation
¶
Overview ¶
El paquete deployer define los modelos de datos básicos de urbo-deployer. El principal modelo es el de Vertical, que es el punto de entrada a partir del cual se accede al conjunto de datos de la vertical. El resto de tipos corresponden a sub-atributos dentro de la vertical.
Index ¶
- Constants
- type Attribute
- type AttributeMapping
- type Device
- type DeviceAttribute
- type DeviceCommand
- type DeviceStatus
- type Entity
- type EntityMapping
- type EntityType
- type GroupStatus
- type LongtermKind
- type Notification
- type NotificationCustom
- type NotificationHTTP
- type NotificationStatus
- type Project
- type ProjectStatus
- type Rule
- type RuleStatus
- type Service
- type ServiceMapping
- type ServicePathMapping
- type Subject
- type SubjectCondition
- type SubjectEntity
- type SubjectExpression
- type Suscription
- type SuscriptionStatus
- type Table
- type TableColumn
- type TableIndex
- type UrboPanel
- type UrboVertical
- type Vertical
- type View
- type ViewColumn
Constants ¶
const ( LongtermNone LongtermKind = "" LongtermCounter = "counter" LongtermGauge = "gauge" LongtermEnum = "enum" LongtermModal = "modal" LongtermDimension = "dimension" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute struct { Name string `json:"name"` Type string `json:"type"` Description []string `json:"description,omitempty"` Value json.RawMessage `json:"value,omitempty" compact:"true"` Metadatas json.RawMessage `json:"metadatas,omitempty" compact:"true"` // Si la entidad es Singleton, este atributo se puede marcar // como parte de la identidad del singleton, y se añadirá a la // primary key de la tabla. SingletonKey bool `json:"singletonKey,omitempty"` // Indica si este atributo forma parte d ela simulación Simulated bool `json:"simulated,omitempty"` // Indica si este atributo debe conservarse de alguna forma en longterm Longterm LongtermKind `json:"longterm,omitempty"` // Si longterm == LongtermEnum, estas serían las opciones LongtermOptions []string `json:"longtermOptions,omitempty"` }
Attribute representa un atributo de una entidad
func (Attribute) MarshalJSON ¶ added in v0.1.8
func (Attribute) Serialize ¶ added in v0.1.5
func (x Attribute) Serialize(s serialize.Serializer)
type AttributeMapping ¶
type AttributeMapping struct { OriginalAttributeName string `json:"originalAttributeName,omitempty"` OriginalAttributeType string `json:"originalAttributeType,omitempty"` NewAttributeName string `json:"newAttributeName,omitempty"` NewAttributeType string `json:"newAttributeType,omitempty"` }
AttributeMapping es cada uno de los AttributeMappings de un EntityMapping
func (AttributeMapping) MarshalJSON ¶ added in v0.1.8
func (x AttributeMapping) MarshalJSON() ([]byte, error)
func (AttributeMapping) Serialize ¶ added in v0.1.5
func (x AttributeMapping) Serialize(s serialize.Serializer)
type Device ¶
type Device struct { DeviceId string `json:"device_id"` APIKey string `json:"apikey,omitempty"` EntityName string `json:"entity_name,omitempty"` EntityType string `json:"entity_type"` Polling bool `json:"polling,omitempty"` Transport string `json:"transport"` Timestamp bool `json:"timestamp,omitempty"` Endpoint string `json:"endpoint,omitempty"` Attributes []DeviceAttribute `json:"attributes,omitempty"` Lazy []DeviceAttribute `json:"lazy,omitempty"` Commands []DeviceCommand `json:"commands,omitempty"` StaticAttributes []DeviceAttribute `json:"static_attributes,omitempty"` Protocol string `json:"protocol"` ExpressionLanguage string `json:"expressionLanguage,omitempty"` ExplicitAttrs json.RawMessage `json:"explicitAttrs,omitempty"` DeviceStatus }
Device representa un dispositivo
func (Device) MarshalJSON ¶ added in v0.1.8
func (Device) Serialize ¶ added in v0.1.5
func (x Device) Serialize(s serialize.Serializer)
type DeviceAttribute ¶
type DeviceAttribute struct { ObjectId string `json:"object_id"` Name string `json:"name"` Type string `json:"type,omitempty"` Value json.RawMessage `json:"value,omitempty"` // para los staticAttribs Expression string `json:"expression,omitempty"` EntityName string `json:"entity_name,omitempty"` EntityType string `json:"entity_type,omitempty"` }
DeviceAttribute describe un atributo de dispositivo
func (DeviceAttribute) MarshalJSON ¶ added in v0.1.8
func (x DeviceAttribute) MarshalJSON() ([]byte, error)
func (DeviceAttribute) Serialize ¶ added in v0.1.5
func (x DeviceAttribute) Serialize(s serialize.Serializer)
type DeviceCommand ¶
type DeviceCommand struct { ObjectId string `json:"object_id,omitempty"` Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` Value string `json:"value,omitempty"` MQTT json.RawMessage `json:"mqtt,omitempty"` }
DeviceCommand describe un comando de dispositivo
func (DeviceCommand) MarshalJSON ¶ added in v0.1.8
func (x DeviceCommand) MarshalJSON() ([]byte, error)
func (DeviceCommand) Serialize ¶ added in v0.1.5
func (x DeviceCommand) Serialize(s serialize.Serializer)
type DeviceStatus ¶
type DeviceStatus struct { Service string `json:"service,omitempty"` ServicePath string `json:"service_path,omitempty"` }
GroupStatus agrupa atributos de estado que no se usan al crear un Device
func (DeviceStatus) MarshalJSON ¶ added in v0.1.8
func (x DeviceStatus) MarshalJSON() ([]byte, error)
func (DeviceStatus) Serialize ¶ added in v0.1.5
func (x DeviceStatus) Serialize(s serialize.Serializer)
type Entity ¶
type Entity struct { ID string `json:"entityID"` Type string `json:"entityType"` // Aquí no hace falta mantener el orden, // porque el orden correcto de los atributos ya // está en el EntityType. // Los Metadatas se sacan aparte porque generalmente // el json generado es más tratable de esta forma Attrs map[string]json.RawMessage `json:"attrs" compact:"true"` MetaDatas map[string]json.RawMessage `json:"metadatas,omitempty" compact:"true"` }
Entity representa una instancia de EntityType
func (Entity) MarshalJSON ¶ added in v0.1.8
func (Entity) Serialize ¶ added in v0.1.5
func (x Entity) Serialize(s serialize.Serializer)
type EntityMapping ¶
type EntityMapping struct { OriginalEntityId string `json:"originalEntityId,omitempty"` NewEntityId string `json:"newEntityId,omitempty"` OriginalEntityType string `json:"originalEntityType,omitempty"` NewEntityType string `json:"newEntityType,omitempty"` AttributeMappings []AttributeMapping `json:"attributeMappings"` }
EntityMaping es cada uno de los EntityMappings de un servicePathMapping
func (EntityMapping) MarshalJSON ¶ added in v0.1.8
func (x EntityMapping) MarshalJSON() ([]byte, error)
func (EntityMapping) Serialize ¶ added in v0.1.5
func (x EntityMapping) Serialize(s serialize.Serializer)
type EntityType ¶ added in v0.1.2
type EntityType struct { ID string `json:"entityID"` Type string `json:"entityType"` // Usamos una lista en vez de un map para poder // establecer un orden específico, por si nos interesa // conservar el orden de atributos para algo. Attrs []Attribute `json:"attrs"` }
EntityType representa un tipo de entidad
func (EntityType) MarshalJSON ¶ added in v0.1.8
func (x EntityType) MarshalJSON() ([]byte, error)
func (EntityType) Serialize ¶ added in v0.1.5
func (x EntityType) Serialize(s serialize.Serializer)
type GroupStatus ¶
type GroupStatus struct { ID string `json:"_id,omitempty"` V int `json:"__v,omitempty"` IOTAgent string `json:"iotagent,omitempty"` ServicePath string `json:"service_path,omitempty"` Service string `json:"service,omitempty"` CBHost string `json:"cbHost,omitempty"` }
GroupStatus agrupa atributos de estado que no se usan al crear un Service
func (GroupStatus) MarshalJSON ¶ added in v0.1.8
func (x GroupStatus) MarshalJSON() ([]byte, error)
func (GroupStatus) Serialize ¶ added in v0.1.5
func (x GroupStatus) Serialize(s serialize.Serializer)
type LongtermKind ¶ added in v0.2.9
type LongtermKind string
type Notification ¶
type Notification struct { Attrs []string `json:"attrs,omitempty"` ExceptAttrs []string `json:"exceptAttrs,omitempty"` AttrsFormat string `json:"attrsFormat"` HTTP NotificationHTTP `json:"http,omitempty"` HTTPCustom NotificationCustom `json:"httpCustom,omitempty"` OnlyChangedAttrs bool `json:"onlyChangedAttrs,omitempty"` Covered bool `json:"covered,omitempty"` NotificationStatus }
Notification es la configuración de notificación de la suscripción
func (Notification) MarshalJSON ¶ added in v0.1.8
func (x Notification) MarshalJSON() ([]byte, error)
func (Notification) Serialize ¶ added in v0.1.5
func (x Notification) Serialize(s serialize.Serializer)
type NotificationCustom ¶
type NotificationCustom struct { URL string `json:"url"` Headers map[string]string `json:"headers,omitempty"` Payload json.RawMessage `json:"payload,omitempty"` Method string `json:"method,omitempty"` }
NotificationHTTP son los datos de una notificacion
func (NotificationCustom) IsEmpty ¶ added in v0.1.5
func (n NotificationCustom) IsEmpty() bool
func (NotificationCustom) MarshalJSON ¶ added in v0.1.8
func (x NotificationCustom) MarshalJSON() ([]byte, error)
func (NotificationCustom) Serialize ¶ added in v0.1.5
func (x NotificationCustom) Serialize(s serialize.Serializer)
type NotificationHTTP ¶
type NotificationHTTP struct {
URL string `json:"url"`
}
NotificationHTTP son los datos de una notificacion
func (NotificationHTTP) IsEmpty ¶ added in v0.1.5
func (n NotificationHTTP) IsEmpty() bool
func (NotificationHTTP) MarshalJSON ¶ added in v0.1.8
func (x NotificationHTTP) MarshalJSON() ([]byte, error)
func (NotificationHTTP) Serialize ¶ added in v0.1.5
func (x NotificationHTTP) Serialize(s serialize.Serializer)
type NotificationStatus ¶
type NotificationStatus struct { LastFailure string `json:"lastFailure,omitempty"` LastFailureReason string `json:"lastFailureReason,omitempty"` LastNotification string `json:"lastNotification,omitempty"` LastSuccess string `json:"lastSuccess,omitempty"` LastSuccessCode int `json:"lastSuccessCode,omitempty"` FailsCounter int `json:"failsCounter,omitempty"` TimesSent int `json:"timesSent,omitempty"` }
NotificationStatus agrupa los datos de estado de la suscripción
func (NotificationStatus) MarshalJSON ¶ added in v0.1.8
func (x NotificationStatus) MarshalJSON() ([]byte, error)
func (NotificationStatus) Serialize ¶ added in v0.1.5
func (x NotificationStatus) Serialize(s serialize.Serializer)
type Project ¶ added in v0.2.6
type Project struct { IsDomain bool `json:"is_domain"` Description string `json:"description,omitempty"` Tags json.RawMessage `json:"tags,omitempty"` Enabled bool `json:"enabled"` ID string `json:"id"` ParentId string `json:"parent_id,omitempty"` DomainId string `json:"domain_id,omitempty"` Name string `json:"name"` ProjectStatus }
func (Project) MarshalJSON ¶ added in v0.2.6
func (Project) Serialize ¶ added in v0.2.6
func (x Project) Serialize(s serialize.Serializer)
type ProjectStatus ¶ added in v0.2.6
type ProjectStatus struct {
Links json.RawMessage `json:"links,omitempty"`
}
func (ProjectStatus) MarshalJSON ¶ added in v0.2.6
func (x ProjectStatus) MarshalJSON() ([]byte, error)
func (ProjectStatus) Serialize ¶ added in v0.2.6
func (x ProjectStatus) Serialize(s serialize.Serializer)
type Rule ¶
type Rule struct { Name string `json:"name"` Description string `json:"description,omitempty"` Misc string `json:"misc,omitempty"` Text string `json:"text,omitempty"` VR string `json:"VR,omitempty"` Action json.RawMessage `json:"action,omitempty"` // TODO: estructurar de alguna forma? NoSignal json.RawMessage `json:"nosignal,omitempty"` // TODO: estructurar de alguna forma? RuleStatus }
func (Rule) MarshalJSON ¶ added in v0.1.8
func (Rule) Serialize ¶ added in v0.1.5
func (x Rule) Serialize(s serialize.Serializer)
type RuleStatus ¶
type RuleStatus struct { Subservice string `json:"subservice,omitempty"` Service string `json:"service,omitempty"` ID string `json:"_id,omitempty"` }
RuleStatus agrupa atributos de estado que no se usan al crear una Rule
func (RuleStatus) MarshalJSON ¶ added in v0.1.8
func (x RuleStatus) MarshalJSON() ([]byte, error)
func (RuleStatus) Serialize ¶ added in v0.1.5
func (x RuleStatus) Serialize(s serialize.Serializer)
type Service ¶
type Service struct { Resource string `json:"resource"` APIKey string `json:"apikey"` EntityType string `json:"entity_type"` Description string `json:"description,omitempty"` Protocol string `json:"protocol"` Transport string `json:"transport,omitempty"` Timestamp bool `json:"timestamp,omitempty"` ExplicitAttrs json.RawMessage `json:"explicitAttrs,omitempty"` InternalAttributes []DeviceAttribute `json:"internal_attributes,omitempty"` Attributes []DeviceAttribute `json:"attributes"` Lazy []DeviceAttribute `json:"lazy,omitempty"` StaticAttributes []DeviceAttribute `json:"static_attributes,omitempty"` Commands []DeviceCommand `json:"commands,omitempty"` ExpressionLanguage string `json:"expressionLanguage,omitempty"` GroupStatus }
Service describe la provisión de un grupo de dispositivos
func (Service) MarshalJSON ¶ added in v0.1.8
func (Service) Serialize ¶ added in v0.1.5
func (x Service) Serialize(s serialize.Serializer)
type ServiceMapping ¶
type ServiceMapping struct { OriginalService string `json:"originalService,omitempty"` NewService string `json:"newService,omitempty"` ServicePathMappings []ServicePathMapping `json:"servicePathMappings"` }
ServiceMapping es cada uno de los serviceMappings de cygnus
func (ServiceMapping) MarshalJSON ¶ added in v0.1.8
func (x ServiceMapping) MarshalJSON() ([]byte, error)
func (ServiceMapping) Serialize ¶ added in v0.1.5
func (x ServiceMapping) Serialize(s serialize.Serializer)
type ServicePathMapping ¶
type ServicePathMapping struct { OriginalServicePath string `json:"originalServicePath,omitempty"` NewServicePath string `json:"newServicePath,omitempty"` EntityMappings []EntityMapping `json:"entityMappings"` }
ServicePathMapping es cada uno de los servicePathMappings de un serviceMapping
func (ServicePathMapping) MarshalJSON ¶ added in v0.1.8
func (x ServicePathMapping) MarshalJSON() ([]byte, error)
func (ServicePathMapping) Serialize ¶ added in v0.1.5
func (x ServicePathMapping) Serialize(s serialize.Serializer)
type Subject ¶
type Subject struct { Condition SubjectCondition `json:"condition"` Entities []SubjectEntity `json:"entities"` }
Subject es el sujeto de la suscripcion
func (Subject) MarshalJSON ¶ added in v0.1.8
func (Subject) Serialize ¶ added in v0.1.5
func (x Subject) Serialize(s serialize.Serializer)
type SubjectCondition ¶
type SubjectCondition struct { Attrs []string `json:"attrs,omitempty"` Expression SubjectExpression `json:"expression,omitempty"` }
SubjectCondition es la condicion del sujeto de la suscripcion
func (SubjectCondition) MarshalJSON ¶ added in v0.1.8
func (x SubjectCondition) MarshalJSON() ([]byte, error)
func (SubjectCondition) Serialize ¶ added in v0.1.5
func (x SubjectCondition) Serialize(s serialize.Serializer)
type SubjectEntity ¶
type SubjectEntity struct { IdPattern string `json:"idPattern,omitempty"` Type string `json:"type"` }
SubjectEntity es la entidad sujeto de la suscripcion
func (SubjectEntity) MarshalJSON ¶ added in v0.1.8
func (x SubjectEntity) MarshalJSON() ([]byte, error)
func (SubjectEntity) Serialize ¶ added in v0.1.5
func (x SubjectEntity) Serialize(s serialize.Serializer)
type SubjectExpression ¶
type SubjectExpression struct {
Q string `json:"q,omitempty"`
}
SubjectExpression es la expresion en la condicion
func (SubjectExpression) IsEmpty ¶ added in v0.1.5
func (s SubjectExpression) IsEmpty() bool
func (SubjectExpression) MarshalJSON ¶ added in v0.1.8
func (x SubjectExpression) MarshalJSON() ([]byte, error)
func (SubjectExpression) Serialize ¶ added in v0.1.5
func (x SubjectExpression) Serialize(s serialize.Serializer)
type Suscription ¶
type Suscription struct { Description string `json:"description"` Status string `json:"status,omitempty"` Expires string `json:"expires,omitempty"` Notification Notification `json:"notification"` Subject Subject `json:"subject"` SuscriptionStatus }
Suscription representa una suscripcion
func (Suscription) MarshalJSON ¶ added in v0.1.8
func (x Suscription) MarshalJSON() ([]byte, error)
func (Suscription) Serialize ¶ added in v0.1.5
func (x Suscription) Serialize(s serialize.Serializer)
type SuscriptionStatus ¶
type SuscriptionStatus struct {
ID string `json:"id,omitempty"`
}
SuscriptionStatus agrupa los datos de estado de la suscripción
func (SuscriptionStatus) MarshalJSON ¶ added in v0.1.8
func (x SuscriptionStatus) MarshalJSON() ([]byte, error)
func (SuscriptionStatus) Serialize ¶ added in v0.1.5
func (x SuscriptionStatus) Serialize(s serialize.Serializer)
type Table ¶
type Table struct { Name string `json:"name"` Columns []TableColumn `json:"columns"` PrimaryKey []string `json:"primaryKey"` Indexes []TableIndex `json:"indexes"` LastData bool `json:"lastdata"` // True si queremos crear una vista lastdata adicional Singleton []string `json:"singleton,omitempty"` // Lista de campos únicos, si la entidad es un singleton. }
Table define algunos parámetros básicos de tablas a crear
func (Table) MarshalJSON ¶ added in v0.1.8
func (Table) Serialize ¶ added in v0.1.5
func (x Table) Serialize(s serialize.Serializer)
type TableColumn ¶
type TableColumn struct { Name string `json:"name"` Type string `json:"type"` NotNull bool `json:"notNull,omitempty"` Default string `json:"default,omitempty"` }
TableColumn describe una columna de una tabla
func (TableColumn) MarshalJSON ¶ added in v0.1.8
func (x TableColumn) MarshalJSON() ([]byte, error)
func (TableColumn) Serialize ¶ added in v0.1.5
func (x TableColumn) Serialize(s serialize.Serializer)
type TableIndex ¶
type TableIndex struct { Name string `json:"name"` Columns []string `json:"columns"` Geometry bool `json:"geometry,omitempty"` }
TableIndex describe un indice
func (TableIndex) MarshalJSON ¶ added in v0.1.8
func (x TableIndex) MarshalJSON() ([]byte, error)
func (TableIndex) Serialize ¶ added in v0.1.5
func (x TableIndex) Serialize(s serialize.Serializer)
type UrboPanel ¶ added in v0.2.9
type UrboPanel struct { Name string `json:"name"` Description string `json:"description,omitempty"` Slug string `json:"slug"` LowercaseSlug string `json:"lowercaseSlug,omitempty"` WidgetCount int `json:"widgetCount,omitempty"` IsShadow bool `json:"isShadow,omitempty"` Section string `json:"section,omitempty"` }
UrboPanel representa un panel de Urbo
func (UrboPanel) MarshalJSON ¶ added in v0.2.9
func (UrboPanel) Serialize ¶ added in v0.2.9
func (x UrboPanel) Serialize(s serialize.Serializer)
type UrboVertical ¶ added in v0.2.9
type UrboVertical struct { Panels []UrboPanel `json:"panels,omitempty"` ShadowPanels []UrboPanel `json:"shadowPanels,omitempty"` I18n json.RawMessage `json:"i18n,omitempty"` Name string `json:"name"` Slug string `json:"slug"` }
URboVertical representauna vertical de Urbo
func (UrboVertical) MarshalJSON ¶ added in v0.2.9
func (x UrboVertical) MarshalJSON() ([]byte, error)
func (UrboVertical) Serialize ¶ added in v0.2.9
func (x UrboVertical) Serialize(s serialize.Serializer)
type Vertical ¶
type Vertical struct { Name string `json:"name"` // `tourism`, `wifi`, `watermeter`, etc Subservice string `json:"subservice"` // `turismo`, `wifi`, `contadores`, etc. // Tipos de entidad definidos en la vertical. // El ID y los valores de los atributos son opcionales. EntityTypes []EntityType `json:"entityTypes,omitempty"` // Entidades específicas de alguno de los tipos anteriores Entities []Entity `json:"entities,omitempty"` // ServiceMappings para cygnus ServiceMappings []ServiceMapping `json:"serviceMappings,omitempty"` // Suscripciones al context broker Suscriptions []Suscription `json:"suscriptions,omitempty"` // Tablas *sencillas* relacionadas con entidades Tables []Table `json:"tables,omitempty"` Views []View `json:"views,omitempty"` // Grupos de dispositivos Services []Service `json:"services,omitempty"` Devices []Device `json:"devices,omitempty"` // CEP rules Rules []Rule `json:"rules,omitempty"` // Lista de proyectos, paneles y verticals de urbo. // Esto no pertenece a la vertical, sino al entorno, // pero me facilita meterlo aqui... Projects []Project `json:"projects,omitempty"` Panels map[string]UrboPanel `json:"panels,omitempty"` Verticals map[string]UrboVertical `json:"verticals,omitempty"` }
Vertical representa una vertical
func (Vertical) MarshalJSON ¶ added in v0.1.8
func (Vertical) Serialize ¶ added in v0.1.5
func (x Vertical) Serialize(s serialize.Serializer)
type View ¶ added in v0.2.9
type View struct { Materialized bool `json:"materialized,omitempty"` Name string `json:"name"` From string `json:"from"` Group []string `json:"group"` Columns []ViewColumn `json:"columns"` }
MaterializedView define los parámetros de las vistas materializadas
func (View) MarshalJSON ¶ added in v0.2.9
func (View) Serialize ¶ added in v0.2.9
func (x View) Serialize(s serialize.Serializer)
type ViewColumn ¶ added in v0.2.9
ViewColumn define las columnas de la vista
func (ViewColumn) MarshalJSON ¶ added in v0.2.9
func (x ViewColumn) MarshalJSON() ([]byte, error)
func (ViewColumn) Serialize ¶ added in v0.2.9
func (x ViewColumn) Serialize(s serialize.Serializer)