diff --git a/pkg/models/check_all_results.go b/pkg/models/check_all_results.go index e113c96..f84b0f0 100644 --- a/pkg/models/check_all_results.go +++ b/pkg/models/check_all_results.go @@ -22,6 +22,9 @@ type CheckAllResults struct { // o k OK *bool `json:"OK,omitempty"` + // dns results + DNSResults map[string]DNSResults `json:"dnsResults,omitempty"` + // hosts Hosts []*CheckAllResultsHostsItems0 `json:"hosts"` @@ -39,6 +42,10 @@ type CheckAllResults struct { func (m *CheckAllResults) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateDNSResults(formats); err != nil { + res = append(res, err) + } + if err := m.validateHosts(formats); err != nil { res = append(res, err) } @@ -53,6 +60,25 @@ func (m *CheckAllResults) Validate(formats strfmt.Registry) error { return nil } +func (m *CheckAllResults) validateDNSResults(formats strfmt.Registry) error { + + if swag.IsZero(m.DNSResults) { // not required + return nil + } + + for k := range m.DNSResults { + + if val, ok := m.DNSResults[k]; ok { + if err := val.Validate(formats); err != nil { + return err + } + } + + } + + return nil +} + func (m *CheckAllResults) validateHosts(formats strfmt.Registry) error { if swag.IsZero(m.Hosts) { // not required diff --git a/pkg/models/ping_results.go b/pkg/models/ping_results.go index 3754efd..da7ab27 100644 --- a/pkg/models/ping_results.go +++ b/pkg/models/ping_results.go @@ -21,9 +21,6 @@ type PingResults struct { // Format: date-time BootTime strfmt.DateTime `json:"boot_time,omitempty"` - // dns results - DNSResults DNSResults `json:"dnsResults,omitempty"` - // received Received *CallStats `json:"received,omitempty"` } @@ -36,10 +33,6 @@ func (m *PingResults) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateDNSResults(formats); err != nil { - res = append(res, err) - } - if err := m.validateReceived(formats); err != nil { res = append(res, err) } @@ -63,22 +56,6 @@ func (m *PingResults) validateBootTime(formats strfmt.Registry) error { return nil } -func (m *PingResults) validateDNSResults(formats strfmt.Registry) error { - - if swag.IsZero(m.DNSResults) { // not required - return nil - } - - if err := m.DNSResults.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("dnsResults") - } - return err - } - - return nil -} - func (m *PingResults) validateReceived(formats strfmt.Registry) error { if swag.IsZero(m.Received) { // not required diff --git a/pkg/models/pod_result.go b/pkg/models/pod_result.go index 7d33ea2..5447331 100644 --- a/pkg/models/pod_result.go +++ b/pkg/models/pod_result.go @@ -24,6 +24,9 @@ type PodResult struct { // o k OK *bool `json:"OK,omitempty"` + // dns results + DNSResults DNSResults `json:"dnsResults,omitempty"` + // error Error string `json:"error,omitempty"` @@ -45,6 +48,10 @@ func (m *PodResult) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateDNSResults(formats); err != nil { + res = append(res, err) + } + if err := m.validateResponse(formats); err != nil { res = append(res, err) } @@ -68,6 +75,22 @@ func (m *PodResult) validateHostIP(formats strfmt.Registry) error { return nil } +func (m *PodResult) validateDNSResults(formats strfmt.Registry) error { + + if swag.IsZero(m.DNSResults) { // not required + return nil + } + + if err := m.DNSResults.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dnsResults") + } + return err + } + + return nil +} + func (m *PodResult) validateResponse(formats strfmt.Registry) error { if swag.IsZero(m.Response) { // not required diff --git a/pkg/restapi/embedded_spec.go b/pkg/restapi/embedded_spec.go index fb91e2a..786c664 100644 --- a/pkg/restapi/embedded_spec.go +++ b/pkg/restapi/embedded_spec.go @@ -143,6 +143,12 @@ func init() { "type": "boolean", "default": false }, + "dnsResults": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/DnsResults" + } + }, "hosts": { "type": "array", "items": { @@ -222,9 +228,6 @@ func init() { "type": "string", "format": "date-time" }, - "dnsResults": { - "$ref": "#/definitions/DnsResults" - }, "received": { "$ref": "#/definitions/CallStats" } @@ -241,6 +244,9 @@ func init() { "type": "boolean", "default": false }, + "dnsResults": { + "$ref": "#/definitions/DnsResults" + }, "error": { "type": "string" }, @@ -386,6 +392,12 @@ func init() { "type": "boolean", "default": false }, + "dnsResults": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/DnsResults" + } + }, "hosts": { "type": "array", "items": { @@ -465,9 +477,6 @@ func init() { "type": "string", "format": "date-time" }, - "dnsResults": { - "$ref": "#/definitions/DnsResults" - }, "received": { "$ref": "#/definitions/CallStats" } @@ -484,6 +493,9 @@ func init() { "type": "boolean", "default": false }, + "dnsResults": { + "$ref": "#/definitions/DnsResults" + }, "error": { "type": "string" }, diff --git a/swagger.yml b/swagger.yml index 09984ad..1443ca9 100644 --- a/swagger.yml +++ b/swagger.yml @@ -31,8 +31,6 @@ definitions: type: string received: $ref: '#/definitions/CallStats' - dnsResults: - $ref: '#/definitions/DnsResults' PodResult: type: object properties: @@ -44,6 +42,8 @@ definitions: format: ipv4 response: $ref: '#/definitions/PingResults' + dnsResults: + $ref: '#/definitions/DnsResults' error: type: string status-code: @@ -96,6 +96,10 @@ definitions: podIP: type: string format: ipv4 + dnsResults: + type: object + additionalProperties: + $ref: '#/definitions/DnsResults' responses: type: object additionalProperties: