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 "github.com/go-openapi/errors" 24 "github.com/go-openapi/strfmt" 25 "github.com/go-openapi/swag" 26 "github.com/go-openapi/validate" 27) 28 29// AlertmanagerStatus alertmanager status 30// 31// swagger:model alertmanagerStatus 32type AlertmanagerStatus struct { 33 34 // cluster 35 // Required: true 36 Cluster *ClusterStatus `json:"cluster"` 37 38 // config 39 // Required: true 40 Config *AlertmanagerConfig `json:"config"` 41 42 // uptime 43 // Required: true 44 // Format: date-time 45 Uptime *strfmt.DateTime `json:"uptime"` 46 47 // version info 48 // Required: true 49 VersionInfo *VersionInfo `json:"versionInfo"` 50} 51 52// Validate validates this alertmanager status 53func (m *AlertmanagerStatus) Validate(formats strfmt.Registry) error { 54 var res []error 55 56 if err := m.validateCluster(formats); err != nil { 57 res = append(res, err) 58 } 59 60 if err := m.validateConfig(formats); err != nil { 61 res = append(res, err) 62 } 63 64 if err := m.validateUptime(formats); err != nil { 65 res = append(res, err) 66 } 67 68 if err := m.validateVersionInfo(formats); err != nil { 69 res = append(res, err) 70 } 71 72 if len(res) > 0 { 73 return errors.CompositeValidationError(res...) 74 } 75 return nil 76} 77 78func (m *AlertmanagerStatus) validateCluster(formats strfmt.Registry) error { 79 80 if err := validate.Required("cluster", "body", m.Cluster); err != nil { 81 return err 82 } 83 84 if m.Cluster != nil { 85 if err := m.Cluster.Validate(formats); err != nil { 86 if ve, ok := err.(*errors.Validation); ok { 87 return ve.ValidateName("cluster") 88 } 89 return err 90 } 91 } 92 93 return nil 94} 95 96func (m *AlertmanagerStatus) validateConfig(formats strfmt.Registry) error { 97 98 if err := validate.Required("config", "body", m.Config); err != nil { 99 return err 100 } 101 102 if m.Config != nil { 103 if err := m.Config.Validate(formats); err != nil { 104 if ve, ok := err.(*errors.Validation); ok { 105 return ve.ValidateName("config") 106 } 107 return err 108 } 109 } 110 111 return nil 112} 113 114func (m *AlertmanagerStatus) validateUptime(formats strfmt.Registry) error { 115 116 if err := validate.Required("uptime", "body", m.Uptime); err != nil { 117 return err 118 } 119 120 if err := validate.FormatOf("uptime", "body", "date-time", m.Uptime.String(), formats); err != nil { 121 return err 122 } 123 124 return nil 125} 126 127func (m *AlertmanagerStatus) validateVersionInfo(formats strfmt.Registry) error { 128 129 if err := validate.Required("versionInfo", "body", m.VersionInfo); err != nil { 130 return err 131 } 132 133 if m.VersionInfo != nil { 134 if err := m.VersionInfo.Validate(formats); err != nil { 135 if ve, ok := err.(*errors.Validation); ok { 136 return ve.ValidateName("versionInfo") 137 } 138 return err 139 } 140 } 141 142 return nil 143} 144 145// MarshalBinary interface implementation 146func (m *AlertmanagerStatus) MarshalBinary() ([]byte, error) { 147 if m == nil { 148 return nil, nil 149 } 150 return swag.WriteJSON(m) 151} 152 153// UnmarshalBinary interface implementation 154func (m *AlertmanagerStatus) UnmarshalBinary(b []byte) error { 155 var res AlertmanagerStatus 156 if err := swag.ReadJSON(b, &res); err != nil { 157 return err 158 } 159 *m = res 160 return nil 161} 162