github.com/kubearmor/cilium@v1.6.12/api/v1/models/trace_selector.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 strfmt "github.com/go-openapi/strfmt" 10 11 "github.com/go-openapi/errors" 12 "github.com/go-openapi/swag" 13 ) 14 15 // TraceSelector Context describing a pair of source and destination identity 16 // swagger:model TraceSelector 17 type TraceSelector struct { 18 19 // from 20 From *TraceFrom `json:"from,omitempty"` 21 22 // to 23 To *TraceTo `json:"to,omitempty"` 24 25 // Enable verbose tracing. 26 // 27 Verbose bool `json:"verbose,omitempty"` 28 } 29 30 // Validate validates this trace selector 31 func (m *TraceSelector) Validate(formats strfmt.Registry) error { 32 var res []error 33 34 if err := m.validateFrom(formats); err != nil { 35 res = append(res, err) 36 } 37 38 if err := m.validateTo(formats); err != nil { 39 res = append(res, err) 40 } 41 42 if len(res) > 0 { 43 return errors.CompositeValidationError(res...) 44 } 45 return nil 46 } 47 48 func (m *TraceSelector) validateFrom(formats strfmt.Registry) error { 49 50 if swag.IsZero(m.From) { // not required 51 return nil 52 } 53 54 if m.From != nil { 55 if err := m.From.Validate(formats); err != nil { 56 if ve, ok := err.(*errors.Validation); ok { 57 return ve.ValidateName("from") 58 } 59 return err 60 } 61 } 62 63 return nil 64 } 65 66 func (m *TraceSelector) validateTo(formats strfmt.Registry) error { 67 68 if swag.IsZero(m.To) { // not required 69 return nil 70 } 71 72 if m.To != nil { 73 if err := m.To.Validate(formats); err != nil { 74 if ve, ok := err.(*errors.Validation); ok { 75 return ve.ValidateName("to") 76 } 77 return err 78 } 79 } 80 81 return nil 82 } 83 84 // MarshalBinary interface implementation 85 func (m *TraceSelector) MarshalBinary() ([]byte, error) { 86 if m == nil { 87 return nil, nil 88 } 89 return swag.WriteJSON(m) 90 } 91 92 // UnmarshalBinary interface implementation 93 func (m *TraceSelector) UnmarshalBinary(b []byte) error { 94 var res TraceSelector 95 if err := swag.ReadJSON(b, &res); err != nil { 96 return err 97 } 98 *m = res 99 return nil 100 }