/
update_node_request.go
865 lines (643 loc) · 24.7 KB
/
update_node_request.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"strconv"
"github.com/SKF/go-utility/v2/uuid"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// UpdateNodeRequest update node request
//
// swagger:model UpdateNodeRequest
type UpdateNodeRequest struct {
// Possible answers to a single choice or multi choice inspection.
Answers []*Answer `json:"answers"`
// Only valid for asset type nodes
AssetType *AssetType `json:"assetType,omitempty"`
// Which country the node is in. Only valid for site type node
Country string `json:"country,omitempty"`
// Timestamp of node creation
// Format: date-time
CreatedAt strfmt.DateTime `json:"createdAt,omitempty"`
// Only valid for asset type nodes
// Required: true
Criticality *string `json:"criticality"`
// Type of device used to take measurements on this point. Only valid for measurement point type nodes
DadType string `json:"dadType,omitempty"`
// Description of the node
Description string `json:"description,omitempty"`
// ID of node, as a UUID
ID uuid.UUID `json:"id,omitempty"`
// Industry segment of this node. Only valid for site type node
Industry *Industry `json:"industry,omitempty"`
// Type of value to record.
// Required: true
// Enum: [numeric single_choice multi_choice]
InspectionType *string `json:"inspectionType"`
// Descriptive name of the node
// Required: true
Label *string `json:"label"`
// Locked indicates if this node is locked for editing by someone
Locked *Lock `json:"locked,omitempty"`
// Type of lubricant used. Only valid for lubrication point type nodes
// Required: true
Lubricant *string `json:"lubricant"`
// Amount of lubricant to be used. Only valid for lubrication point type nodes
LubricantQuantity *NaturalQuantity `json:"lubricantQuantity,omitempty"`
// Instruction for lubrication activity. Only valid for lubrication point type nodes
LubricateInstructions string `json:"lubricateInstructions,omitempty"`
// ActivityAssetState the asset should be in during the lubrication activity. Only valid for lubrication point type nodes
// Enum: [must_be_on must_be_off]
LubricationActivityAssetState string `json:"lubricationActivityAssetState,omitempty"`
// Only valid for asset type nodes
Manufacturer string `json:"manufacturer,omitempty"`
// Type of measurement. Only valid for measurement point type nodes
// Required: true
// Enum: [displacement acceleration velocity temperature dc_gap ampl_phase box speed envelope_2 envelope_3 unknown]
MeasurementType *string `json:"measurementType"`
// Metadata with keys and optional values
Metadata NodeMetaData `json:"metadata,omitempty"`
// Only valid for asset type nodes
Model string `json:"model,omitempty"`
// Orientation of measurement. Only valid for measurement point type nodes
// Required: true
// Enum: [axial radial radial90 horizontal vertical unknown]
Orientation *string `json:"orientation"`
// Origin of node, if imported from another system
Origin *Origin `json:"origin,omitempty"`
// ID of parent node, as a UUID
// Required: true
ParentID *string `json:"parentId"`
// Relative position of node in the Enlight Centre UI
// Minimum: 0
Position *int64 `json:"position,omitempty"`
// Which postal code the site has. Only valid for site type node
PostalCode string `json:"postalCode,omitempty"`
// Only valid for asset type nodes
SerialNumber string `json:"serialNumber,omitempty"`
// Subtype of node
// Required: true
// Enum: [root company site plant ship system functional_location asset measurement_location measurement_point inspection_point lubrication_point]
Subtype *string `json:"subtype"`
// Type of node
// Required: true
// Enum: [root company site plant system functional_location asset measurement_location measurement_point inspection_point lubrication_point unknown]
Type *string `json:"type"`
// Unit of value recorded. Only valid for inspection points of type `numeric`.
Unit string `json:"unit,omitempty"`
// Timestamp of last node update
// Format: date-time
UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"`
// Maximum value used when visualizing the value of the point on a scale. Only valid for inspection points of type `numeric`.
VisualizationMaxValue float64 `json:"visualizationMaxValue,omitempty"`
// Minimum value used when visualizing the value of the point on a scale. Only valid for inspection points of type `numeric`.
VisualizationMinValue float64 `json:"visualizationMinValue,omitempty"`
// Type of visualization in Enlight Centre. Only valid for inspection points of type `numeric`.
// Enum: [visualization_none visualization_circular_gauge visualization_level_gauge]
VisualizationType string `json:"visualizationType,omitempty"`
}
// Validate validates this update node request
func (m *UpdateNodeRequest) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAnswers(formats); err != nil {
res = append(res, err)
}
if err := m.validateAssetType(formats); err != nil {
res = append(res, err)
}
if err := m.validateCreatedAt(formats); err != nil {
res = append(res, err)
}
if err := m.validateCriticality(formats); err != nil {
res = append(res, err)
}
if err := m.validateIndustry(formats); err != nil {
res = append(res, err)
}
if err := m.validateInspectionType(formats); err != nil {
res = append(res, err)
}
if err := m.validateLabel(formats); err != nil {
res = append(res, err)
}
if err := m.validateLocked(formats); err != nil {
res = append(res, err)
}
if err := m.validateLubricant(formats); err != nil {
res = append(res, err)
}
if err := m.validateLubricantQuantity(formats); err != nil {
res = append(res, err)
}
if err := m.validateLubricationActivityAssetState(formats); err != nil {
res = append(res, err)
}
if err := m.validateMeasurementType(formats); err != nil {
res = append(res, err)
}
if err := m.validateMetadata(formats); err != nil {
res = append(res, err)
}
if err := m.validateOrientation(formats); err != nil {
res = append(res, err)
}
if err := m.validateOrigin(formats); err != nil {
res = append(res, err)
}
if err := m.validateParentID(formats); err != nil {
res = append(res, err)
}
if err := m.validatePosition(formats); err != nil {
res = append(res, err)
}
if err := m.validateSubtype(formats); err != nil {
res = append(res, err)
}
if err := m.validateType(formats); err != nil {
res = append(res, err)
}
if err := m.validateUpdatedAt(formats); err != nil {
res = append(res, err)
}
if err := m.validateVisualizationType(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *UpdateNodeRequest) validateAnswers(formats strfmt.Registry) error {
if swag.IsZero(m.Answers) { // not required
return nil
}
for i := 0; i < len(m.Answers); i++ {
if swag.IsZero(m.Answers[i]) { // not required
continue
}
if m.Answers[i] != nil {
if err := m.Answers[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("answers" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *UpdateNodeRequest) validateAssetType(formats strfmt.Registry) error {
if swag.IsZero(m.AssetType) { // not required
return nil
}
if m.AssetType != nil {
if err := m.AssetType.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("assetType")
}
return err
}
}
return nil
}
func (m *UpdateNodeRequest) validateCreatedAt(formats strfmt.Registry) error {
if swag.IsZero(m.CreatedAt) { // not required
return nil
}
if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validateCriticality(formats strfmt.Registry) error {
if err := validate.Required("criticality", "body", m.Criticality); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validateIndustry(formats strfmt.Registry) error {
if swag.IsZero(m.Industry) { // not required
return nil
}
if m.Industry != nil {
if err := m.Industry.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("industry")
}
return err
}
}
return nil
}
var updateNodeRequestTypeInspectionTypePropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["numeric","single_choice","multi_choice"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
updateNodeRequestTypeInspectionTypePropEnum = append(updateNodeRequestTypeInspectionTypePropEnum, v)
}
}
const (
// UpdateNodeRequestInspectionTypeNumeric captures enum value "numeric"
UpdateNodeRequestInspectionTypeNumeric string = "numeric"
// UpdateNodeRequestInspectionTypeSingleChoice captures enum value "single_choice"
UpdateNodeRequestInspectionTypeSingleChoice string = "single_choice"
// UpdateNodeRequestInspectionTypeMultiChoice captures enum value "multi_choice"
UpdateNodeRequestInspectionTypeMultiChoice string = "multi_choice"
)
// prop value enum
func (m *UpdateNodeRequest) validateInspectionTypeEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, updateNodeRequestTypeInspectionTypePropEnum, true); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validateInspectionType(formats strfmt.Registry) error {
if err := validate.Required("inspectionType", "body", m.InspectionType); err != nil {
return err
}
// value enum
if err := m.validateInspectionTypeEnum("inspectionType", "body", *m.InspectionType); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validateLabel(formats strfmt.Registry) error {
if err := validate.Required("label", "body", m.Label); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validateLocked(formats strfmt.Registry) error {
if swag.IsZero(m.Locked) { // not required
return nil
}
if m.Locked != nil {
if err := m.Locked.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("locked")
}
return err
}
}
return nil
}
func (m *UpdateNodeRequest) validateLubricant(formats strfmt.Registry) error {
if err := validate.Required("lubricant", "body", m.Lubricant); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validateLubricantQuantity(formats strfmt.Registry) error {
if swag.IsZero(m.LubricantQuantity) { // not required
return nil
}
if m.LubricantQuantity != nil {
if err := m.LubricantQuantity.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("lubricantQuantity")
}
return err
}
}
return nil
}
var updateNodeRequestTypeLubricationActivityAssetStatePropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["must_be_on","must_be_off"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
updateNodeRequestTypeLubricationActivityAssetStatePropEnum = append(updateNodeRequestTypeLubricationActivityAssetStatePropEnum, v)
}
}
const (
// UpdateNodeRequestLubricationActivityAssetStateMustBeOn captures enum value "must_be_on"
UpdateNodeRequestLubricationActivityAssetStateMustBeOn string = "must_be_on"
// UpdateNodeRequestLubricationActivityAssetStateMustBeOff captures enum value "must_be_off"
UpdateNodeRequestLubricationActivityAssetStateMustBeOff string = "must_be_off"
)
// prop value enum
func (m *UpdateNodeRequest) validateLubricationActivityAssetStateEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, updateNodeRequestTypeLubricationActivityAssetStatePropEnum, true); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validateLubricationActivityAssetState(formats strfmt.Registry) error {
if swag.IsZero(m.LubricationActivityAssetState) { // not required
return nil
}
// value enum
if err := m.validateLubricationActivityAssetStateEnum("lubricationActivityAssetState", "body", m.LubricationActivityAssetState); err != nil {
return err
}
return nil
}
var updateNodeRequestTypeMeasurementTypePropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["displacement","acceleration","velocity","temperature","dc_gap","ampl_phase","box","speed","envelope_2","envelope_3","unknown"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
updateNodeRequestTypeMeasurementTypePropEnum = append(updateNodeRequestTypeMeasurementTypePropEnum, v)
}
}
const (
// UpdateNodeRequestMeasurementTypeDisplacement captures enum value "displacement"
UpdateNodeRequestMeasurementTypeDisplacement string = "displacement"
// UpdateNodeRequestMeasurementTypeAcceleration captures enum value "acceleration"
UpdateNodeRequestMeasurementTypeAcceleration string = "acceleration"
// UpdateNodeRequestMeasurementTypeVelocity captures enum value "velocity"
UpdateNodeRequestMeasurementTypeVelocity string = "velocity"
// UpdateNodeRequestMeasurementTypeTemperature captures enum value "temperature"
UpdateNodeRequestMeasurementTypeTemperature string = "temperature"
// UpdateNodeRequestMeasurementTypeDcGap captures enum value "dc_gap"
UpdateNodeRequestMeasurementTypeDcGap string = "dc_gap"
// UpdateNodeRequestMeasurementTypeAmplPhase captures enum value "ampl_phase"
UpdateNodeRequestMeasurementTypeAmplPhase string = "ampl_phase"
// UpdateNodeRequestMeasurementTypeBox captures enum value "box"
UpdateNodeRequestMeasurementTypeBox string = "box"
// UpdateNodeRequestMeasurementTypeSpeed captures enum value "speed"
UpdateNodeRequestMeasurementTypeSpeed string = "speed"
// UpdateNodeRequestMeasurementTypeEnvelope2 captures enum value "envelope_2"
UpdateNodeRequestMeasurementTypeEnvelope2 string = "envelope_2"
// UpdateNodeRequestMeasurementTypeEnvelope3 captures enum value "envelope_3"
UpdateNodeRequestMeasurementTypeEnvelope3 string = "envelope_3"
// UpdateNodeRequestMeasurementTypeUnknown captures enum value "unknown"
UpdateNodeRequestMeasurementTypeUnknown string = "unknown"
)
// prop value enum
func (m *UpdateNodeRequest) validateMeasurementTypeEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, updateNodeRequestTypeMeasurementTypePropEnum, true); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validateMeasurementType(formats strfmt.Registry) error {
if err := validate.Required("measurementType", "body", m.MeasurementType); err != nil {
return err
}
// value enum
if err := m.validateMeasurementTypeEnum("measurementType", "body", *m.MeasurementType); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validateMetadata(formats strfmt.Registry) error {
if swag.IsZero(m.Metadata) { // not required
return nil
}
if err := m.Metadata.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("metadata")
}
return err
}
return nil
}
var updateNodeRequestTypeOrientationPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["axial","radial","radial90","horizontal","vertical","unknown"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
updateNodeRequestTypeOrientationPropEnum = append(updateNodeRequestTypeOrientationPropEnum, v)
}
}
const (
// UpdateNodeRequestOrientationAxial captures enum value "axial"
UpdateNodeRequestOrientationAxial string = "axial"
// UpdateNodeRequestOrientationRadial captures enum value "radial"
UpdateNodeRequestOrientationRadial string = "radial"
// UpdateNodeRequestOrientationRadial90 captures enum value "radial90"
UpdateNodeRequestOrientationRadial90 string = "radial90"
// UpdateNodeRequestOrientationHorizontal captures enum value "horizontal"
UpdateNodeRequestOrientationHorizontal string = "horizontal"
// UpdateNodeRequestOrientationVertical captures enum value "vertical"
UpdateNodeRequestOrientationVertical string = "vertical"
// UpdateNodeRequestOrientationUnknown captures enum value "unknown"
UpdateNodeRequestOrientationUnknown string = "unknown"
)
// prop value enum
func (m *UpdateNodeRequest) validateOrientationEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, updateNodeRequestTypeOrientationPropEnum, true); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validateOrientation(formats strfmt.Registry) error {
if err := validate.Required("orientation", "body", m.Orientation); err != nil {
return err
}
// value enum
if err := m.validateOrientationEnum("orientation", "body", *m.Orientation); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validateOrigin(formats strfmt.Registry) error {
if swag.IsZero(m.Origin) { // not required
return nil
}
if m.Origin != nil {
if err := m.Origin.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("origin")
}
return err
}
}
return nil
}
func (m *UpdateNodeRequest) validateParentID(formats strfmt.Registry) error {
if err := validate.Required("parentId", "body", m.ParentID); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validatePosition(formats strfmt.Registry) error {
if swag.IsZero(m.Position) { // not required
return nil
}
if err := validate.MinimumInt("position", "body", int64(*m.Position), 0, false); err != nil {
return err
}
return nil
}
var updateNodeRequestTypeSubtypePropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["root","company","site","plant","ship","system","functional_location","asset","measurement_location","measurement_point","inspection_point","lubrication_point"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
updateNodeRequestTypeSubtypePropEnum = append(updateNodeRequestTypeSubtypePropEnum, v)
}
}
const (
// UpdateNodeRequestSubtypeRoot captures enum value "root"
UpdateNodeRequestSubtypeRoot string = "root"
// UpdateNodeRequestSubtypeCompany captures enum value "company"
UpdateNodeRequestSubtypeCompany string = "company"
// UpdateNodeRequestSubtypeSite captures enum value "site"
UpdateNodeRequestSubtypeSite string = "site"
// UpdateNodeRequestSubtypePlant captures enum value "plant"
UpdateNodeRequestSubtypePlant string = "plant"
// UpdateNodeRequestSubtypeShip captures enum value "ship"
UpdateNodeRequestSubtypeShip string = "ship"
// UpdateNodeRequestSubtypeSystem captures enum value "system"
UpdateNodeRequestSubtypeSystem string = "system"
// UpdateNodeRequestSubtypeFunctionalLocation captures enum value "functional_location"
UpdateNodeRequestSubtypeFunctionalLocation string = "functional_location"
// UpdateNodeRequestSubtypeAsset captures enum value "asset"
UpdateNodeRequestSubtypeAsset string = "asset"
// UpdateNodeRequestSubtypeMeasurementLocation captures enum value "measurement_location"
UpdateNodeRequestSubtypeMeasurementLocation string = "measurement_location"
// UpdateNodeRequestSubtypeMeasurementPoint captures enum value "measurement_point"
UpdateNodeRequestSubtypeMeasurementPoint string = "measurement_point"
// UpdateNodeRequestSubtypeInspectionPoint captures enum value "inspection_point"
UpdateNodeRequestSubtypeInspectionPoint string = "inspection_point"
// UpdateNodeRequestSubtypeLubricationPoint captures enum value "lubrication_point"
UpdateNodeRequestSubtypeLubricationPoint string = "lubrication_point"
)
// prop value enum
func (m *UpdateNodeRequest) validateSubtypeEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, updateNodeRequestTypeSubtypePropEnum, true); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validateSubtype(formats strfmt.Registry) error {
if err := validate.Required("subtype", "body", m.Subtype); err != nil {
return err
}
// value enum
if err := m.validateSubtypeEnum("subtype", "body", *m.Subtype); err != nil {
return err
}
return nil
}
var updateNodeRequestTypeTypePropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["root","company","site","plant","system","functional_location","asset","measurement_location","measurement_point","inspection_point","lubrication_point","unknown"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
updateNodeRequestTypeTypePropEnum = append(updateNodeRequestTypeTypePropEnum, v)
}
}
const (
// UpdateNodeRequestTypeRoot captures enum value "root"
UpdateNodeRequestTypeRoot string = "root"
// UpdateNodeRequestTypeCompany captures enum value "company"
UpdateNodeRequestTypeCompany string = "company"
// UpdateNodeRequestTypeSite captures enum value "site"
UpdateNodeRequestTypeSite string = "site"
// UpdateNodeRequestTypePlant captures enum value "plant"
UpdateNodeRequestTypePlant string = "plant"
// UpdateNodeRequestTypeSystem captures enum value "system"
UpdateNodeRequestTypeSystem string = "system"
// UpdateNodeRequestTypeFunctionalLocation captures enum value "functional_location"
UpdateNodeRequestTypeFunctionalLocation string = "functional_location"
// UpdateNodeRequestTypeAsset captures enum value "asset"
UpdateNodeRequestTypeAsset string = "asset"
// UpdateNodeRequestTypeMeasurementLocation captures enum value "measurement_location"
UpdateNodeRequestTypeMeasurementLocation string = "measurement_location"
// UpdateNodeRequestTypeMeasurementPoint captures enum value "measurement_point"
UpdateNodeRequestTypeMeasurementPoint string = "measurement_point"
// UpdateNodeRequestTypeInspectionPoint captures enum value "inspection_point"
UpdateNodeRequestTypeInspectionPoint string = "inspection_point"
// UpdateNodeRequestTypeLubricationPoint captures enum value "lubrication_point"
UpdateNodeRequestTypeLubricationPoint string = "lubrication_point"
// UpdateNodeRequestTypeUnknown captures enum value "unknown"
UpdateNodeRequestTypeUnknown string = "unknown"
)
// prop value enum
func (m *UpdateNodeRequest) validateTypeEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, updateNodeRequestTypeTypePropEnum, true); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validateType(formats strfmt.Registry) error {
if err := validate.Required("type", "body", m.Type); err != nil {
return err
}
// value enum
if err := m.validateTypeEnum("type", "body", *m.Type); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validateUpdatedAt(formats strfmt.Registry) error {
if swag.IsZero(m.UpdatedAt) { // not required
return nil
}
if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil {
return err
}
return nil
}
var updateNodeRequestTypeVisualizationTypePropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["visualization_none","visualization_circular_gauge","visualization_level_gauge"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
updateNodeRequestTypeVisualizationTypePropEnum = append(updateNodeRequestTypeVisualizationTypePropEnum, v)
}
}
const (
// UpdateNodeRequestVisualizationTypeVisualizationNone captures enum value "visualization_none"
UpdateNodeRequestVisualizationTypeVisualizationNone string = "visualization_none"
// UpdateNodeRequestVisualizationTypeVisualizationCircularGauge captures enum value "visualization_circular_gauge"
UpdateNodeRequestVisualizationTypeVisualizationCircularGauge string = "visualization_circular_gauge"
// UpdateNodeRequestVisualizationTypeVisualizationLevelGauge captures enum value "visualization_level_gauge"
UpdateNodeRequestVisualizationTypeVisualizationLevelGauge string = "visualization_level_gauge"
)
// prop value enum
func (m *UpdateNodeRequest) validateVisualizationTypeEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, updateNodeRequestTypeVisualizationTypePropEnum, true); err != nil {
return err
}
return nil
}
func (m *UpdateNodeRequest) validateVisualizationType(formats strfmt.Registry) error {
if swag.IsZero(m.VisualizationType) { // not required
return nil
}
// value enum
if err := m.validateVisualizationTypeEnum("visualizationType", "body", m.VisualizationType); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *UpdateNodeRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *UpdateNodeRequest) UnmarshalBinary(b []byte) error {
var res UpdateNodeRequest
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}