1// Code generated by go-swagger; DO NOT EDIT. 2 3// Copyright Prometheus Team 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17package models 18 19// This file was generated by the swagger tool. 20// Editing this file might prove futile when you re-run the swagger generate command 21 22import ( 23 "encoding/json" 24 25 "github.com/go-openapi/errors" 26 "github.com/go-openapi/strfmt" 27 "github.com/go-openapi/swag" 28 "github.com/go-openapi/validate" 29) 30 31// AlertStatus alert status 32// 33// swagger:model alertStatus 34type AlertStatus struct { 35 36 // inhibited by 37 // Required: true 38 InhibitedBy []string `json:"inhibitedBy"` 39 40 // silenced by 41 // Required: true 42 SilencedBy []string `json:"silencedBy"` 43 44 // state 45 // Required: true 46 // Enum: [unprocessed active suppressed] 47 State *string `json:"state"` 48} 49 50// Validate validates this alert status 51func (m *AlertStatus) Validate(formats strfmt.Registry) error { 52 var res []error 53 54 if err := m.validateInhibitedBy(formats); err != nil { 55 res = append(res, err) 56 } 57 58 if err := m.validateSilencedBy(formats); err != nil { 59 res = append(res, err) 60 } 61 62 if err := m.validateState(formats); err != nil { 63 res = append(res, err) 64 } 65 66 if len(res) > 0 { 67 return errors.CompositeValidationError(res...) 68 } 69 return nil 70} 71 72func (m *AlertStatus) validateInhibitedBy(formats strfmt.Registry) error { 73 74 if err := validate.Required("inhibitedBy", "body", m.InhibitedBy); err != nil { 75 return err 76 } 77 78 return nil 79} 80 81func (m *AlertStatus) validateSilencedBy(formats strfmt.Registry) error { 82 83 if err := validate.Required("silencedBy", "body", m.SilencedBy); err != nil { 84 return err 85 } 86 87 return nil 88} 89 90var alertStatusTypeStatePropEnum []interface{} 91 92func init() { 93 var res []string 94 if err := json.Unmarshal([]byte(`["unprocessed","active","suppressed"]`), &res); err != nil { 95 panic(err) 96 } 97 for _, v := range res { 98 alertStatusTypeStatePropEnum = append(alertStatusTypeStatePropEnum, v) 99 } 100} 101 102const ( 103 104 // AlertStatusStateUnprocessed captures enum value "unprocessed" 105 AlertStatusStateUnprocessed string = "unprocessed" 106 107 // AlertStatusStateActive captures enum value "active" 108 AlertStatusStateActive string = "active" 109 110 // AlertStatusStateSuppressed captures enum value "suppressed" 111 AlertStatusStateSuppressed string = "suppressed" 112) 113 114// prop value enum 115func (m *AlertStatus) validateStateEnum(path, location string, value string) error { 116 if err := validate.EnumCase(path, location, value, alertStatusTypeStatePropEnum, true); err != nil { 117 return err 118 } 119 return nil 120} 121 122func (m *AlertStatus) validateState(formats strfmt.Registry) error { 123 124 if err := validate.Required("state", "body", m.State); err != nil { 125 return err 126 } 127 128 // value enum 129 if err := m.validateStateEnum("state", "body", *m.State); err != nil { 130 return err 131 } 132 133 return nil 134} 135 136// MarshalBinary interface implementation 137func (m *AlertStatus) MarshalBinary() ([]byte, error) { 138 if m == nil { 139 return nil, nil 140 } 141 return swag.WriteJSON(m) 142} 143 144// UnmarshalBinary interface implementation 145func (m *AlertStatus) UnmarshalBinary(b []byte) error { 146 var res AlertStatus 147 if err := swag.ReadJSON(b, &res); err != nil { 148 return err 149 } 150 *m = res 151 return nil 152} 153