github.com/kubearmor/cilium@v1.6.12/api/v1/models/dns_lookup.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 "github.com/go-openapi/validate" 14 ) 15 16 // DNSLookup An IP -> DNS mapping, with metadata 17 // swagger:model DNSLookup 18 type DNSLookup struct { 19 20 // The endpoint that made this lookup, or 0 for the agent itself. 21 EndpointID int64 `json:"endpoint-id,omitempty"` 22 23 // The absolute time when this data will expire in this cache 24 // Format: date-time 25 ExpirationTime strfmt.DateTime `json:"expiration-time,omitempty"` 26 27 // DNS name 28 Fqdn string `json:"fqdn,omitempty"` 29 30 // IP addresses returned in this lookup 31 Ips []string `json:"ips"` 32 33 // The absolute time when this data was recieved 34 // Format: date-time 35 LookupTime strfmt.DateTime `json:"lookup-time,omitempty"` 36 37 // The TTL in the DNS response 38 TTL int64 `json:"ttl,omitempty"` 39 } 40 41 // Validate validates this DNS lookup 42 func (m *DNSLookup) Validate(formats strfmt.Registry) error { 43 var res []error 44 45 if err := m.validateExpirationTime(formats); err != nil { 46 res = append(res, err) 47 } 48 49 if err := m.validateLookupTime(formats); err != nil { 50 res = append(res, err) 51 } 52 53 if len(res) > 0 { 54 return errors.CompositeValidationError(res...) 55 } 56 return nil 57 } 58 59 func (m *DNSLookup) validateExpirationTime(formats strfmt.Registry) error { 60 61 if swag.IsZero(m.ExpirationTime) { // not required 62 return nil 63 } 64 65 if err := validate.FormatOf("expiration-time", "body", "date-time", m.ExpirationTime.String(), formats); err != nil { 66 return err 67 } 68 69 return nil 70 } 71 72 func (m *DNSLookup) validateLookupTime(formats strfmt.Registry) error { 73 74 if swag.IsZero(m.LookupTime) { // not required 75 return nil 76 } 77 78 if err := validate.FormatOf("lookup-time", "body", "date-time", m.LookupTime.String(), formats); err != nil { 79 return err 80 } 81 82 return nil 83 } 84 85 // MarshalBinary interface implementation 86 func (m *DNSLookup) MarshalBinary() ([]byte, error) { 87 if m == nil { 88 return nil, nil 89 } 90 return swag.WriteJSON(m) 91 } 92 93 // UnmarshalBinary interface implementation 94 func (m *DNSLookup) UnmarshalBinary(b []byte) error { 95 var res DNSLookup 96 if err := swag.ReadJSON(b, &res); err != nil { 97 return err 98 } 99 *m = res 100 return nil 101 }