mirror of
https://github.com/openziti/ziti.git
synced 2026-10-14 08:10:17 +00:00
Merge pull request #238 from openziti/fix-isonline-common-routers
Ensure IsOnline is present in common routers. Fixes GH-237
This commit is contained in:
@@ -263,7 +263,7 @@ func MapAdvisorServiceReachabilityToRestEntity(entity *model.AdvisorServiceReach
|
||||
for _, router := range entity.CommonRouters {
|
||||
commonRouters = append(commonRouters, &rest_model.RouterEntityRef{
|
||||
EntityRef: *ToEntityRef(router.Router.Name, router.Router, EdgeRouterLinkFactory),
|
||||
IsOnline: router.IsOnline,
|
||||
IsOnline: &router.IsOnline,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import (
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// RouterEntityRef router entity ref
|
||||
@@ -42,7 +43,8 @@ type RouterEntityRef struct {
|
||||
EntityRef
|
||||
|
||||
// is online
|
||||
IsOnline bool `json:"isOnline,omitempty"`
|
||||
// Required: true
|
||||
IsOnline *bool `json:"isOnline"`
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals this object from a JSON structure
|
||||
@@ -56,7 +58,7 @@ func (m *RouterEntityRef) UnmarshalJSON(raw []byte) error {
|
||||
|
||||
// AO1
|
||||
var dataAO1 struct {
|
||||
IsOnline bool `json:"isOnline,omitempty"`
|
||||
IsOnline *bool `json:"isOnline"`
|
||||
}
|
||||
if err := swag.ReadJSON(raw, &dataAO1); err != nil {
|
||||
return err
|
||||
@@ -77,7 +79,7 @@ func (m RouterEntityRef) MarshalJSON() ([]byte, error) {
|
||||
}
|
||||
_parts = append(_parts, aO0)
|
||||
var dataAO1 struct {
|
||||
IsOnline bool `json:"isOnline,omitempty"`
|
||||
IsOnline *bool `json:"isOnline"`
|
||||
}
|
||||
|
||||
dataAO1.IsOnline = m.IsOnline
|
||||
@@ -99,12 +101,25 @@ func (m *RouterEntityRef) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateIsOnline(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *RouterEntityRef) validateIsOnline(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("isOnline", "body", m.IsOnline); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *RouterEntityRef) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
@@ -6818,6 +6818,9 @@ func init() {
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"isOnline"
|
||||
],
|
||||
"properties": {
|
||||
"isOnline": {
|
||||
"type": "boolean"
|
||||
@@ -22439,6 +22442,9 @@ func init() {
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"isOnline"
|
||||
],
|
||||
"properties": {
|
||||
"isOnline": {
|
||||
"type": "boolean"
|
||||
|
||||
@@ -5572,6 +5572,8 @@ definitions:
|
||||
allOf:
|
||||
- $ref: '#/definitions/entityRef'
|
||||
- type: object
|
||||
required:
|
||||
- isOnline
|
||||
properties:
|
||||
isOnline:
|
||||
type: boolean
|
||||
|
||||
Reference in New Issue
Block a user