github.com/weaviate/weaviate@v1.24.6/entities/models/nodes_status_response.go (about) 1 // _ _ 2 // __ _____ __ ___ ___ __ _| |_ ___ 3 // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ 4 // \ V V / __/ (_| |\ V /| | (_| | || __/ 5 // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| 6 // 7 // Copyright © 2016 - 2024 Weaviate B.V. All rights reserved. 8 // 9 // CONTACT: hello@weaviate.io 10 // 11 12 // Code generated by go-swagger; DO NOT EDIT. 13 14 package models 15 16 // This file was generated by the swagger tool. 17 // Editing this file might prove futile when you re-run the swagger generate command 18 19 import ( 20 "context" 21 "strconv" 22 23 "github.com/go-openapi/errors" 24 "github.com/go-openapi/strfmt" 25 "github.com/go-openapi/swag" 26 ) 27 28 // NodesStatusResponse The status of all of the Weaviate nodes 29 // 30 // swagger:model NodesStatusResponse 31 type NodesStatusResponse struct { 32 33 // nodes 34 Nodes []*NodeStatus `json:"nodes"` 35 } 36 37 // Validate validates this nodes status response 38 func (m *NodesStatusResponse) Validate(formats strfmt.Registry) error { 39 var res []error 40 41 if err := m.validateNodes(formats); err != nil { 42 res = append(res, err) 43 } 44 45 if len(res) > 0 { 46 return errors.CompositeValidationError(res...) 47 } 48 return nil 49 } 50 51 func (m *NodesStatusResponse) validateNodes(formats strfmt.Registry) error { 52 if swag.IsZero(m.Nodes) { // not required 53 return nil 54 } 55 56 for i := 0; i < len(m.Nodes); i++ { 57 if swag.IsZero(m.Nodes[i]) { // not required 58 continue 59 } 60 61 if m.Nodes[i] != nil { 62 if err := m.Nodes[i].Validate(formats); err != nil { 63 if ve, ok := err.(*errors.Validation); ok { 64 return ve.ValidateName("nodes" + "." + strconv.Itoa(i)) 65 } else if ce, ok := err.(*errors.CompositeError); ok { 66 return ce.ValidateName("nodes" + "." + strconv.Itoa(i)) 67 } 68 return err 69 } 70 } 71 72 } 73 74 return nil 75 } 76 77 // ContextValidate validate this nodes status response based on the context it is used 78 func (m *NodesStatusResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 79 var res []error 80 81 if err := m.contextValidateNodes(ctx, formats); err != nil { 82 res = append(res, err) 83 } 84 85 if len(res) > 0 { 86 return errors.CompositeValidationError(res...) 87 } 88 return nil 89 } 90 91 func (m *NodesStatusResponse) contextValidateNodes(ctx context.Context, formats strfmt.Registry) error { 92 93 for i := 0; i < len(m.Nodes); i++ { 94 95 if m.Nodes[i] != nil { 96 if err := m.Nodes[i].ContextValidate(ctx, formats); err != nil { 97 if ve, ok := err.(*errors.Validation); ok { 98 return ve.ValidateName("nodes" + "." + strconv.Itoa(i)) 99 } else if ce, ok := err.(*errors.CompositeError); ok { 100 return ce.ValidateName("nodes" + "." + strconv.Itoa(i)) 101 } 102 return err 103 } 104 } 105 106 } 107 108 return nil 109 } 110 111 // MarshalBinary interface implementation 112 func (m *NodesStatusResponse) MarshalBinary() ([]byte, error) { 113 if m == nil { 114 return nil, nil 115 } 116 return swag.WriteJSON(m) 117 } 118 119 // UnmarshalBinary interface implementation 120 func (m *NodesStatusResponse) UnmarshalBinary(b []byte) error { 121 var res NodesStatusResponse 122 if err := swag.ReadJSON(b, &res); err != nil { 123 return err 124 } 125 *m = res 126 return nil 127 }