2 // ========================LICENSE_START=================================
5 // Copyright (C) 2021: Nordix Foundation
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 // ========================LICENSE_END===================================
23 type StdDefinedMessage struct {
24 Event Event `json:"event"`
28 CommonEventHeader CommonEventHeader `json:"commonEventHeader"`
29 StndDefinedFields StndDefinedFields `json:"stndDefinedFields"`
32 type CommonEventHeader struct {
33 Domain string `json:"domain"`
34 EventId string `json:"eventId"`
35 EventName string `json:"eventName"`
36 EventType string `json:"eventType"`
37 Sequence int `json:"sequence"`
38 Priority string `json:"priority"`
39 ReportingEntityId string `json:"reportingEntityId"`
40 ReportingEntityName string `json:"reportingEntityName"`
41 SourceId string `json:"sourceId"`
42 SourceName string `json:"sourceName"`
43 StartEpochMicrosec int64 `json:"startEpochMicrosec"`
44 LastEpochMicrosec int64 `json:"lastEpochMicrosec"`
45 NfNamingCode string `json:"nfNamingCode"`
46 NfVendorName string `json:"nfVendorName"`
47 StndDefinedNamespace string `json:"stndDefinedNamespace"`
48 TimeZoneOffset string `json:"timeZoneOffset"`
49 Version string `json:"version"`
50 VesEventListenerVersion string `json:"vesEventListenerVersion"`
53 type StndDefinedFields struct {
54 StndDefinedFieldsVersion string `json:"stndDefinedFieldsVersion"`
55 SchemaReference string `json:"schemaReference"`
56 Data Data `json:"data"`
60 DataId string `json:"id"`
61 StartTime string `json:"start-time"`
62 AdministrativeState string `json:"administrative-state"`
63 OperationalState string `json:"operational-state"`
64 UserLabel string `json:"user-label"`
65 JobTag string `json:"job-tag"`
66 GranularityPeriod int `json:"granularity-period"`
67 Measurements []Measurement `json:"measurements"`
70 type Measurement struct {
71 MeasurementTypeInstanceReference string `json:"measurement-type-instance-reference"`
72 Value int `json:"value"`
73 Unit string `json:"unit"`
76 func (message StdDefinedMessage) GetMeasurements() []Measurement {
77 return message.Event.StndDefinedFields.Data.Measurements