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// SilenceStatus silence status 32// 33// swagger:model silenceStatus 34type SilenceStatus struct { 35 36 // state 37 // Required: true 38 // Enum: [expired active pending] 39 State *string `json:"state"` 40} 41 42// Validate validates this silence status 43func (m *SilenceStatus) Validate(formats strfmt.Registry) error { 44 var res []error 45 46 if err := m.validateState(formats); err != nil { 47 res = append(res, err) 48 } 49 50 if len(res) > 0 { 51 return errors.CompositeValidationError(res...) 52 } 53 return nil 54} 55 56var silenceStatusTypeStatePropEnum []interface{} 57 58func init() { 59 var res []string 60 if err := json.Unmarshal([]byte(`["expired","active","pending"]`), &res); err != nil { 61 panic(err) 62 } 63 for _, v := range res { 64 silenceStatusTypeStatePropEnum = append(silenceStatusTypeStatePropEnum, v) 65 } 66} 67 68const ( 69 70 // SilenceStatusStateExpired captures enum value "expired" 71 SilenceStatusStateExpired string = "expired" 72 73 // SilenceStatusStateActive captures enum value "active" 74 SilenceStatusStateActive string = "active" 75 76 // SilenceStatusStatePending captures enum value "pending" 77 SilenceStatusStatePending string = "pending" 78) 79 80// prop value enum 81func (m *SilenceStatus) validateStateEnum(path, location string, value string) error { 82 if err := validate.EnumCase(path, location, value, silenceStatusTypeStatePropEnum, true); err != nil { 83 return err 84 } 85 return nil 86} 87 88func (m *SilenceStatus) validateState(formats strfmt.Registry) error { 89 90 if err := validate.Required("state", "body", m.State); err != nil { 91 return err 92 } 93 94 // value enum 95 if err := m.validateStateEnum("state", "body", *m.State); err != nil { 96 return err 97 } 98 99 return nil 100} 101 102// MarshalBinary interface implementation 103func (m *SilenceStatus) MarshalBinary() ([]byte, error) { 104 if m == nil { 105 return nil, nil 106 } 107 return swag.WriteJSON(m) 108} 109 110// UnmarshalBinary interface implementation 111func (m *SilenceStatus) UnmarshalBinary(b []byte) error { 112 var res SilenceStatus 113 if err := swag.ReadJSON(b, &res); err != nil { 114 return err 115 } 116 *m = res 117 return nil 118} 119