github.com/weaviate/weaviate@v1.24.6/entities/models/peer_update.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 22 "github.com/go-openapi/errors" 23 "github.com/go-openapi/strfmt" 24 "github.com/go-openapi/swag" 25 "github.com/go-openapi/validate" 26 ) 27 28 // PeerUpdate A single peer in the network. 29 // 30 // swagger:model PeerUpdate 31 type PeerUpdate struct { 32 33 // The session ID of the peer. 34 // Format: uuid 35 ID strfmt.UUID `json:"id,omitempty"` 36 37 // Human readable name. 38 Name string `json:"name,omitempty"` 39 40 // The latest known hash of the peer's schema. 41 SchemaHash string `json:"schemaHash,omitempty"` 42 43 // The location where the peer is exposed to the internet. 44 // Format: uri 45 URI strfmt.URI `json:"uri,omitempty"` 46 } 47 48 // Validate validates this peer update 49 func (m *PeerUpdate) Validate(formats strfmt.Registry) error { 50 var res []error 51 52 if err := m.validateID(formats); err != nil { 53 res = append(res, err) 54 } 55 56 if err := m.validateURI(formats); err != nil { 57 res = append(res, err) 58 } 59 60 if len(res) > 0 { 61 return errors.CompositeValidationError(res...) 62 } 63 return nil 64 } 65 66 func (m *PeerUpdate) validateID(formats strfmt.Registry) error { 67 if swag.IsZero(m.ID) { // not required 68 return nil 69 } 70 71 if err := validate.FormatOf("id", "body", "uuid", m.ID.String(), formats); err != nil { 72 return err 73 } 74 75 return nil 76 } 77 78 func (m *PeerUpdate) validateURI(formats strfmt.Registry) error { 79 if swag.IsZero(m.URI) { // not required 80 return nil 81 } 82 83 if err := validate.FormatOf("uri", "body", "uri", m.URI.String(), formats); err != nil { 84 return err 85 } 86 87 return nil 88 } 89 90 // ContextValidate validates this peer update based on context it is used 91 func (m *PeerUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 92 return nil 93 } 94 95 // MarshalBinary interface implementation 96 func (m *PeerUpdate) MarshalBinary() ([]byte, error) { 97 if m == nil { 98 return nil, nil 99 } 100 return swag.WriteJSON(m) 101 } 102 103 // UnmarshalBinary interface implementation 104 func (m *PeerUpdate) UnmarshalBinary(b []byte) error { 105 var res PeerUpdate 106 if err := swag.ReadJSON(b, &res); err != nil { 107 return err 108 } 109 *m = res 110 return nil 111 }