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// PeerStatus peer status 30// 31// swagger:model peerStatus 32type PeerStatus struct { 33 34 // address 35 // Required: true 36 Address *string `json:"address"` 37 38 // name 39 // Required: true 40 Name *string `json:"name"` 41} 42 43// Validate validates this peer status 44func (m *PeerStatus) Validate(formats strfmt.Registry) error { 45 var res []error 46 47 if err := m.validateAddress(formats); err != nil { 48 res = append(res, err) 49 } 50 51 if err := m.validateName(formats); err != nil { 52 res = append(res, err) 53 } 54 55 if len(res) > 0 { 56 return errors.CompositeValidationError(res...) 57 } 58 return nil 59} 60 61func (m *PeerStatus) validateAddress(formats strfmt.Registry) error { 62 63 if err := validate.Required("address", "body", m.Address); err != nil { 64 return err 65 } 66 67 return nil 68} 69 70func (m *PeerStatus) validateName(formats strfmt.Registry) error { 71 72 if err := validate.Required("name", "body", m.Name); err != nil { 73 return err 74 } 75 76 return nil 77} 78 79// MarshalBinary interface implementation 80func (m *PeerStatus) MarshalBinary() ([]byte, error) { 81 if m == nil { 82 return nil, nil 83 } 84 return swag.WriteJSON(m) 85} 86 87// UnmarshalBinary interface implementation 88func (m *PeerStatus) UnmarshalBinary(b []byte) error { 89 var res PeerStatus 90 if err := swag.ReadJSON(b, &res); err != nil { 91 return err 92 } 93 *m = res 94 return nil 95} 96