...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package models
18
19
20
21
22 import (
23 "context"
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
32
33
34 type PeerStatus struct {
35
36
37
38 Address *string `json:"address"`
39
40
41
42 Name *string `json:"name"`
43 }
44
45
46 func (m *PeerStatus) Validate(formats strfmt.Registry) error {
47 var res []error
48
49 if err := m.validateAddress(formats); err != nil {
50 res = append(res, err)
51 }
52
53 if err := m.validateName(formats); err != nil {
54 res = append(res, err)
55 }
56
57 if len(res) > 0 {
58 return errors.CompositeValidationError(res...)
59 }
60 return nil
61 }
62
63 func (m *PeerStatus) validateAddress(formats strfmt.Registry) error {
64
65 if err := validate.Required("address", "body", m.Address); err != nil {
66 return err
67 }
68
69 return nil
70 }
71
72 func (m *PeerStatus) validateName(formats strfmt.Registry) error {
73
74 if err := validate.Required("name", "body", m.Name); err != nil {
75 return err
76 }
77
78 return nil
79 }
80
81
82 func (m *PeerStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
83 return nil
84 }
85
86
87 func (m *PeerStatus) MarshalBinary() ([]byte, error) {
88 if m == nil {
89 return nil, nil
90 }
91 return swag.WriteJSON(m)
92 }
93
94
95 func (m *PeerStatus) UnmarshalBinary(b []byte) error {
96 var res PeerStatus
97 if err := swag.ReadJSON(b, &res); err != nil {
98 return err
99 }
100 *m = res
101 return nil
102 }
103
View as plain text