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 StndDefinedNamespace string `json:"stndDefinedNamespace"`
37 type StndDefinedFields struct {
38 StndDefinedFieldsVersion string `json:"stndDefinedFieldsVersion"`
39 SchemaReference string `json:"schemaReference"`
40 Data Data `json:"data"`
44 DataId string `json:"id"`
45 Measurements []Measurement `json:"measurements"`
48 type Measurement struct {
49 MeasurementTypeInstanceReference string `json:"measurement-type-instance-reference"`
50 Value int `json:"value"`
51 Unit string `json:"unit"`
54 func (message StdDefinedMessage) GetMeasurements() []Measurement {
55 return message.Event.StndDefinedFields.Data.Measurements