...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package models
18
19
20
21
22 import (
23 "context"
24 "encoding/json"
25
26 "github.com/go-openapi/errors"
27 "github.com/go-openapi/strfmt"
28 "github.com/go-openapi/swag"
29 "github.com/go-openapi/validate"
30 )
31
32
33
34
35 type AlertStatus struct {
36
37
38
39 InhibitedBy []string `json:"inhibitedBy"`
40
41
42
43 SilencedBy []string `json:"silencedBy"`
44
45
46
47
48 State *string `json:"state"`
49 }
50
51
52 func (m *AlertStatus) Validate(formats strfmt.Registry) error {
53 var res []error
54
55 if err := m.validateInhibitedBy(formats); err != nil {
56 res = append(res, err)
57 }
58
59 if err := m.validateSilencedBy(formats); err != nil {
60 res = append(res, err)
61 }
62
63 if err := m.validateState(formats); err != nil {
64 res = append(res, err)
65 }
66
67 if len(res) > 0 {
68 return errors.CompositeValidationError(res...)
69 }
70 return nil
71 }
72
73 func (m *AlertStatus) validateInhibitedBy(formats strfmt.Registry) error {
74
75 if err := validate.Required("inhibitedBy", "body", m.InhibitedBy); err != nil {
76 return err
77 }
78
79 return nil
80 }
81
82 func (m *AlertStatus) validateSilencedBy(formats strfmt.Registry) error {
83
84 if err := validate.Required("silencedBy", "body", m.SilencedBy); err != nil {
85 return err
86 }
87
88 return nil
89 }
90
91 var alertStatusTypeStatePropEnum []interface{}
92
93 func init() {
94 var res []string
95 if err := json.Unmarshal([]byte(`["unprocessed","active","suppressed"]`), &res); err != nil {
96 panic(err)
97 }
98 for _, v := range res {
99 alertStatusTypeStatePropEnum = append(alertStatusTypeStatePropEnum, v)
100 }
101 }
102
103 const (
104
105
106 AlertStatusStateUnprocessed string = "unprocessed"
107
108
109 AlertStatusStateActive string = "active"
110
111
112 AlertStatusStateSuppressed string = "suppressed"
113 )
114
115
116 func (m *AlertStatus) validateStateEnum(path, location string, value string) error {
117 if err := validate.EnumCase(path, location, value, alertStatusTypeStatePropEnum, true); err != nil {
118 return err
119 }
120 return nil
121 }
122
123 func (m *AlertStatus) validateState(formats strfmt.Registry) error {
124
125 if err := validate.Required("state", "body", m.State); err != nil {
126 return err
127 }
128
129
130 if err := m.validateStateEnum("state", "body", *m.State); err != nil {
131 return err
132 }
133
134 return nil
135 }
136
137
138 func (m *AlertStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
139 return nil
140 }
141
142
143 func (m *AlertStatus) MarshalBinary() ([]byte, error) {
144 if m == nil {
145 return nil, nil
146 }
147 return swag.WriteJSON(m)
148 }
149
150
151 func (m *AlertStatus) UnmarshalBinary(b []byte) error {
152 var res AlertStatus
153 if err := swag.ReadJSON(b, &res); err != nil {
154 return err
155 }
156 *m = res
157 return nil
158 }
159
View as plain text