/
alert.go
824 lines (590 loc) · 21.2 KB
/
alert.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
// 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 (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// Alert alert
//
// swagger:model Alert
type Alert struct {
// The active SDT, if one exists
// Read Only: true
SDT interface{} `json:"SDT,omitempty"`
// The comment submitted with the acknowledgement
// Read Only: true
AckComment string `json:"ackComment,omitempty"`
// Whether or not the alert has been acknowledged
// Read Only: true
Acked *bool `json:"acked,omitempty"`
// The user that acknowledged the alert
// Read Only: true
AckedBy string `json:"ackedBy,omitempty"`
// The time (in epoch format) that the alert was acknowledged
// Read Only: true
AckedEpoch int64 `json:"ackedEpoch,omitempty"`
// Specifies whether alert is dynamic threshold based or not
// Read Only: true
AdAlert *bool `json:"adAlert,omitempty"`
// The description for dynamic threshold based alert
// Read Only: true
AdAlertDesc string `json:"adAlertDesc,omitempty"`
// The value that triggered the alert
// Read Only: true
AlertValue string `json:"alertValue,omitempty"`
// Indicates the anomaly alert, value can be true/false/null. If alert value lies within confidence band then false, otherwise true. If confidence band is not available then value will be null.
// Read Only: true
Anomaly *bool `json:"anomaly,omitempty"`
// The escalation chain the alert was routed to
// Read Only: true
Chain string `json:"chain,omitempty"`
// The id of the escalation chain the alert was routed to
// Read Only: true
ChainID int32 `json:"chainId,omitempty"`
// The value that cleared the alert
// Read Only: true
ClearValue string `json:"clearValue,omitempty"`
// Whether or not the alert has cleared
// Read Only: true
Cleared *bool `json:"cleared,omitempty"`
// The property or token values that should display with the alert details. Note that if referencing tokens, you'll need to URL encode the # symbol.
// Read Only: true
CustomColumns interface{} `json:"customColumns,omitempty"`
// The id of the datapoint in alert
// Read Only: true
DataPointID int32 `json:"dataPointId,omitempty"`
// The name of the datapoint in alert
// Read Only: true
DataPointName string `json:"dataPointName,omitempty"`
// The dependency role
// Read Only: true
DependencyRole string `json:"dependencyRole,omitempty"`
// The dependency routing state
// Read Only: true
DependencyRoutingState string `json:"dependencyRoutingState,omitempty"`
// The alert message, if needMessage=true is included in the query parameters
// Read Only: true
DetailMessage interface{} `json:"detailMessage,omitempty"`
// Indicates dynamic threshold alert generation setting. Expression is comma separated
// 0 denotes OFF, 1 denotes ON, -1 denotes INVALID
// 1,0,1 = warn : ON error: OFF critical: ON
// Empty value on this parameter means : 0,0,0
// Read Only: true
EnableAnomalyAlertGeneration string `json:"enableAnomalyAlertGeneration,omitempty"`
// Indicates anomaly detection alert suppression setting, expression is comma separated
// 0 denotes OFF, 1 denotes ON, -1 denotes INVALID
// 1,0,1 = warn : ON error: OFF critical: ON
// Empty value on this parameter means : 0,0,0
// Read Only: true
EnableAnomalyAlertSuppression string `json:"enableAnomalyAlertSuppression,omitempty"`
// The time (in epoch format) that the alert ended
// Read Only: true
EndEpoch int64 `json:"endEpoch,omitempty"`
// The alert id
// Read Only: true
ID string `json:"id,omitempty"`
// The description of the instance in alert
// Read Only: true
InstanceDescription string `json:"instanceDescription,omitempty"`
// The id of the instance in alert
// Read Only: true
InstanceID int32 `json:"instanceId,omitempty"`
// The name of the instance in alert
// Read Only: true
InstanceName string `json:"instanceName,omitempty"`
// The internal id for the alert
// Read Only: true
InternalID string `json:"internalId,omitempty"`
// Information about the groups the object is a member of
// Read Only: true
MonitorObjectGroups interface{} `json:"monitorObjectGroups,omitempty"`
// The id of the object that the alert is associated with
// Read Only: true
MonitorObjectID int32 `json:"monitorObjectId,omitempty"`
// The name of the object that the alert is associated with
// Read Only: true
MonitorObjectName string `json:"monitorObjectName,omitempty"`
// monitor object type
// Read Only: true
MonitorObjectType string `json:"monitorObjectType,omitempty"`
// The next recipient in the escalation chain for this alert
// Read Only: true
NextRecipient int32 `json:"nextRecipient,omitempty"`
// The recipients that have received the alert
// Read Only: true
ReceivedList string `json:"receivedList,omitempty"`
// The device specific LogicModule Id
// Read Only: true
ResourceID int32 `json:"resourceId,omitempty"`
// The id of the datasource in alert
// Read Only: true
ResourceTemplateID int32 `json:"resourceTemplateId,omitempty"`
// The name of the datasource in alert
// Read Only: true
ResourceTemplateName string `json:"resourceTemplateName,omitempty"`
// The type of the logicmodule in alert
// Read Only: true
ResourceTemplateType string `json:"resourceTemplateType,omitempty"`
// The rule the alert matches
// Read Only: true
Rule string `json:"rule,omitempty"`
// The id of the rule the alert matches
// Read Only: true
RuleID int32 `json:"ruleId,omitempty"`
// It specifies if the SDT is set for an active alert or not. However, the sdted is set to false for cleared alert as you cannot apply SDT to a cleared alert.
// Read Only: true
Sdted *bool `json:"sdted,omitempty"`
// The alert severity, where 2=warning, 3=error and 4=critical
// Read Only: true
Severity int32 `json:"severity,omitempty"`
// The time (in epoch format) that the alert started
// Read Only: true
StartEpoch int64 `json:"startEpoch,omitempty"`
// The id of the sub time based chain
// Read Only: true
SubChainID int32 `json:"subChainId,omitempty"`
// The description for suppressed alert
// Read Only: true
SuppressDesc string `json:"suppressDesc,omitempty"`
// The component (For example: SDT, HostClusterAlert) which suppressed the alert
// Read Only: true
Suppressor string `json:"suppressor,omitempty"`
// Tenant to which this alert belongs to.
// Read Only: true
Tenant string `json:"tenant,omitempty"`
// The threshold associated with the object in alert
// Read Only: true
Threshold string `json:"threshold,omitempty"`
// The type of alert
// Read Only: true
Type string `json:"type,omitempty"`
}
// Validate validates this alert
func (m *Alert) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validate this alert based on the context it is used
func (m *Alert) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateAckComment(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateAcked(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateAckedBy(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateAckedEpoch(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateAdAlert(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateAdAlertDesc(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateAlertValue(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateAnomaly(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateChain(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateChainID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateClearValue(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateCleared(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateDataPointID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateDataPointName(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateDependencyRole(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateDependencyRoutingState(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateEnableAnomalyAlertGeneration(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateEnableAnomalyAlertSuppression(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateEndEpoch(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateInstanceDescription(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateInstanceID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateInstanceName(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateInternalID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateMonitorObjectID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateMonitorObjectName(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateMonitorObjectType(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateNextRecipient(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateReceivedList(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateResourceID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateResourceTemplateID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateResourceTemplateName(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateResourceTemplateType(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateRule(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateRuleID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateSdted(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateSeverity(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateStartEpoch(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateSubChainID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateSuppressDesc(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateSuppressor(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateTenant(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateThreshold(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateType(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Alert) contextValidateAckComment(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "ackComment", "body", string(m.AckComment)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateAcked(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "acked", "body", m.Acked); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateAckedBy(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "ackedBy", "body", string(m.AckedBy)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateAckedEpoch(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "ackedEpoch", "body", int64(m.AckedEpoch)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateAdAlert(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "adAlert", "body", m.AdAlert); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateAdAlertDesc(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "adAlertDesc", "body", string(m.AdAlertDesc)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateAlertValue(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "alertValue", "body", string(m.AlertValue)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateAnomaly(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "anomaly", "body", m.Anomaly); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateChain(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "chain", "body", string(m.Chain)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateChainID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "chainId", "body", int32(m.ChainID)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateClearValue(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "clearValue", "body", string(m.ClearValue)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateCleared(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "cleared", "body", m.Cleared); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateDataPointID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "dataPointId", "body", int32(m.DataPointID)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateDataPointName(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "dataPointName", "body", string(m.DataPointName)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateDependencyRole(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "dependencyRole", "body", string(m.DependencyRole)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateDependencyRoutingState(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "dependencyRoutingState", "body", string(m.DependencyRoutingState)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateEnableAnomalyAlertGeneration(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "enableAnomalyAlertGeneration", "body", string(m.EnableAnomalyAlertGeneration)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateEnableAnomalyAlertSuppression(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "enableAnomalyAlertSuppression", "body", string(m.EnableAnomalyAlertSuppression)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateEndEpoch(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "endEpoch", "body", int64(m.EndEpoch)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "id", "body", string(m.ID)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateInstanceDescription(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "instanceDescription", "body", string(m.InstanceDescription)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateInstanceID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "instanceId", "body", int32(m.InstanceID)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateInstanceName(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "instanceName", "body", string(m.InstanceName)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateInternalID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "internalId", "body", string(m.InternalID)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateMonitorObjectID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "monitorObjectId", "body", int32(m.MonitorObjectID)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateMonitorObjectName(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "monitorObjectName", "body", string(m.MonitorObjectName)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateMonitorObjectType(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "monitorObjectType", "body", string(m.MonitorObjectType)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateNextRecipient(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "nextRecipient", "body", int32(m.NextRecipient)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateReceivedList(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "receivedList", "body", string(m.ReceivedList)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateResourceID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "resourceId", "body", int32(m.ResourceID)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateResourceTemplateID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "resourceTemplateId", "body", int32(m.ResourceTemplateID)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateResourceTemplateName(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "resourceTemplateName", "body", string(m.ResourceTemplateName)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateResourceTemplateType(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "resourceTemplateType", "body", string(m.ResourceTemplateType)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateRule(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "rule", "body", string(m.Rule)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateRuleID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "ruleId", "body", int32(m.RuleID)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateSdted(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "sdted", "body", m.Sdted); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateSeverity(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "severity", "body", int32(m.Severity)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateStartEpoch(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "startEpoch", "body", int64(m.StartEpoch)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateSubChainID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "subChainId", "body", int32(m.SubChainID)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateSuppressDesc(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "suppressDesc", "body", string(m.SuppressDesc)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateSuppressor(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "suppressor", "body", string(m.Suppressor)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateTenant(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "tenant", "body", string(m.Tenant)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateThreshold(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "threshold", "body", string(m.Threshold)); err != nil {
return err
}
return nil
}
func (m *Alert) contextValidateType(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "type", "body", string(m.Type)); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *Alert) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Alert) UnmarshalBinary(b []byte) error {
var res Alert
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}