github.com/kubearmor/cilium@v1.6.12/api/v1/models/controller_status.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 strfmt "github.com/go-openapi/strfmt" 10 11 "github.com/go-openapi/errors" 12 "github.com/go-openapi/swag" 13 "github.com/go-openapi/validate" 14 ) 15 16 // ControllerStatus Status of a controller 17 // swagger:model ControllerStatus 18 // +k8s:deepcopy-gen=true 19 type ControllerStatus struct { 20 21 // configuration 22 Configuration *ControllerStatusConfiguration `json:"configuration,omitempty"` 23 24 // Name of controller 25 Name string `json:"name,omitempty"` 26 27 // status 28 Status *ControllerStatusStatus `json:"status,omitempty"` 29 30 // UUID of controller 31 // Format: uuid 32 UUID strfmt.UUID `json:"uuid,omitempty"` 33 } 34 35 // Validate validates this controller status 36 func (m *ControllerStatus) Validate(formats strfmt.Registry) error { 37 var res []error 38 39 if err := m.validateConfiguration(formats); err != nil { 40 res = append(res, err) 41 } 42 43 if err := m.validateStatus(formats); err != nil { 44 res = append(res, err) 45 } 46 47 if err := m.validateUUID(formats); err != nil { 48 res = append(res, err) 49 } 50 51 if len(res) > 0 { 52 return errors.CompositeValidationError(res...) 53 } 54 return nil 55 } 56 57 func (m *ControllerStatus) validateConfiguration(formats strfmt.Registry) error { 58 59 if swag.IsZero(m.Configuration) { // not required 60 return nil 61 } 62 63 if m.Configuration != nil { 64 if err := m.Configuration.Validate(formats); err != nil { 65 if ve, ok := err.(*errors.Validation); ok { 66 return ve.ValidateName("configuration") 67 } 68 return err 69 } 70 } 71 72 return nil 73 } 74 75 func (m *ControllerStatus) validateStatus(formats strfmt.Registry) error { 76 77 if swag.IsZero(m.Status) { // not required 78 return nil 79 } 80 81 if m.Status != nil { 82 if err := m.Status.Validate(formats); err != nil { 83 if ve, ok := err.(*errors.Validation); ok { 84 return ve.ValidateName("status") 85 } 86 return err 87 } 88 } 89 90 return nil 91 } 92 93 func (m *ControllerStatus) validateUUID(formats strfmt.Registry) error { 94 95 if swag.IsZero(m.UUID) { // not required 96 return nil 97 } 98 99 if err := validate.FormatOf("uuid", "body", "uuid", m.UUID.String(), formats); err != nil { 100 return err 101 } 102 103 return nil 104 } 105 106 // MarshalBinary interface implementation 107 func (m *ControllerStatus) MarshalBinary() ([]byte, error) { 108 if m == nil { 109 return nil, nil 110 } 111 return swag.WriteJSON(m) 112 } 113 114 // UnmarshalBinary interface implementation 115 func (m *ControllerStatus) UnmarshalBinary(b []byte) error { 116 var res ControllerStatus 117 if err := swag.ReadJSON(b, &res); err != nil { 118 return err 119 } 120 *m = res 121 return nil 122 } 123 124 // ControllerStatusConfiguration Configuration of controller 125 // swagger:model ControllerStatusConfiguration 126 type ControllerStatusConfiguration struct { 127 128 // Retry on error 129 ErrorRetry bool `json:"error-retry,omitempty"` 130 131 // Base error retry back-off time 132 // Format: duration 133 ErrorRetryBase strfmt.Duration `json:"error-retry-base,omitempty"` 134 135 // Regular synchronization interval 136 // Format: duration 137 Interval strfmt.Duration `json:"interval,omitempty"` 138 } 139 140 // Validate validates this controller status configuration 141 func (m *ControllerStatusConfiguration) Validate(formats strfmt.Registry) error { 142 var res []error 143 144 if err := m.validateErrorRetryBase(formats); err != nil { 145 res = append(res, err) 146 } 147 148 if err := m.validateInterval(formats); err != nil { 149 res = append(res, err) 150 } 151 152 if len(res) > 0 { 153 return errors.CompositeValidationError(res...) 154 } 155 return nil 156 } 157 158 func (m *ControllerStatusConfiguration) validateErrorRetryBase(formats strfmt.Registry) error { 159 160 if swag.IsZero(m.ErrorRetryBase) { // not required 161 return nil 162 } 163 164 if err := validate.FormatOf("configuration"+"."+"error-retry-base", "body", "duration", m.ErrorRetryBase.String(), formats); err != nil { 165 return err 166 } 167 168 return nil 169 } 170 171 func (m *ControllerStatusConfiguration) validateInterval(formats strfmt.Registry) error { 172 173 if swag.IsZero(m.Interval) { // not required 174 return nil 175 } 176 177 if err := validate.FormatOf("configuration"+"."+"interval", "body", "duration", m.Interval.String(), formats); err != nil { 178 return err 179 } 180 181 return nil 182 } 183 184 // MarshalBinary interface implementation 185 func (m *ControllerStatusConfiguration) MarshalBinary() ([]byte, error) { 186 if m == nil { 187 return nil, nil 188 } 189 return swag.WriteJSON(m) 190 } 191 192 // UnmarshalBinary interface implementation 193 func (m *ControllerStatusConfiguration) UnmarshalBinary(b []byte) error { 194 var res ControllerStatusConfiguration 195 if err := swag.ReadJSON(b, &res); err != nil { 196 return err 197 } 198 *m = res 199 return nil 200 } 201 202 // ControllerStatusStatus Current status of controller 203 // swagger:model ControllerStatusStatus 204 // +k8s:deepcopy-gen=true 205 type ControllerStatusStatus struct { 206 207 // Number of consecutive errors since last success 208 ConsecutiveFailureCount int64 `json:"consecutive-failure-count,omitempty"` 209 210 // Total number of failed runs 211 FailureCount int64 `json:"failure-count,omitempty"` 212 213 // Error message of last failed run 214 LastFailureMsg string `json:"last-failure-msg,omitempty"` 215 216 // Timestamp of last error 217 // Format: date-time 218 LastFailureTimestamp strfmt.DateTime `json:"last-failure-timestamp,omitempty"` 219 220 // Timestamp of last success 221 // Format: date-time 222 LastSuccessTimestamp strfmt.DateTime `json:"last-success-timestamp,omitempty"` 223 224 // Total number of successful runs 225 SuccessCount int64 `json:"success-count,omitempty"` 226 } 227 228 // Validate validates this controller status status 229 func (m *ControllerStatusStatus) Validate(formats strfmt.Registry) error { 230 var res []error 231 232 if err := m.validateLastFailureTimestamp(formats); err != nil { 233 res = append(res, err) 234 } 235 236 if err := m.validateLastSuccessTimestamp(formats); err != nil { 237 res = append(res, err) 238 } 239 240 if len(res) > 0 { 241 return errors.CompositeValidationError(res...) 242 } 243 return nil 244 } 245 246 func (m *ControllerStatusStatus) validateLastFailureTimestamp(formats strfmt.Registry) error { 247 248 if swag.IsZero(m.LastFailureTimestamp) { // not required 249 return nil 250 } 251 252 if err := validate.FormatOf("status"+"."+"last-failure-timestamp", "body", "date-time", m.LastFailureTimestamp.String(), formats); err != nil { 253 return err 254 } 255 256 return nil 257 } 258 259 func (m *ControllerStatusStatus) validateLastSuccessTimestamp(formats strfmt.Registry) error { 260 261 if swag.IsZero(m.LastSuccessTimestamp) { // not required 262 return nil 263 } 264 265 if err := validate.FormatOf("status"+"."+"last-success-timestamp", "body", "date-time", m.LastSuccessTimestamp.String(), formats); err != nil { 266 return err 267 } 268 269 return nil 270 } 271 272 // MarshalBinary interface implementation 273 func (m *ControllerStatusStatus) MarshalBinary() ([]byte, error) { 274 if m == nil { 275 return nil, nil 276 } 277 return swag.WriteJSON(m) 278 } 279 280 // UnmarshalBinary interface implementation 281 func (m *ControllerStatusStatus) UnmarshalBinary(b []byte) error { 282 var res ControllerStatusStatus 283 if err := swag.ReadJSON(b, &res); err != nil { 284 return err 285 } 286 *m = res 287 return nil 288 }