|
@@ -6,6 +6,7 @@ package models
|
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
|
|
import (
|
|
|
+ "context"
|
|
|
"strconv"
|
|
|
|
|
|
"github.com/go-openapi/errors"
|
|
@@ -25,11 +26,11 @@ type Metrics struct {
|
|
|
|
|
|
// bouncers
|
|
|
// Required: true
|
|
|
- Bouncers []*MetricsSoftInfo `json:"bouncers"`
|
|
|
+ Bouncers []*MetricsBouncerInfo `json:"bouncers"`
|
|
|
|
|
|
// machines
|
|
|
// Required: true
|
|
|
- Machines []*MetricsSoftInfo `json:"machines"`
|
|
|
+ Machines []*MetricsAgentInfo `json:"machines"`
|
|
|
}
|
|
|
|
|
|
// Validate validates this metrics
|
|
@@ -113,6 +114,60 @@ func (m *Metrics) validateMachines(formats strfmt.Registry) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+// ContextValidate validate this metrics based on the context it is used
|
|
|
+func (m *Metrics) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
|
+ var res []error
|
|
|
+
|
|
|
+ if err := m.contextValidateBouncers(ctx, formats); err != nil {
|
|
|
+ res = append(res, err)
|
|
|
+ }
|
|
|
+
|
|
|
+ if err := m.contextValidateMachines(ctx, formats); err != nil {
|
|
|
+ res = append(res, err)
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(res) > 0 {
|
|
|
+ return errors.CompositeValidationError(res...)
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+func (m *Metrics) contextValidateBouncers(ctx context.Context, formats strfmt.Registry) error {
|
|
|
+
|
|
|
+ for i := 0; i < len(m.Bouncers); i++ {
|
|
|
+
|
|
|
+ if m.Bouncers[i] != nil {
|
|
|
+ if err := m.Bouncers[i].ContextValidate(ctx, formats); err != nil {
|
|
|
+ if ve, ok := err.(*errors.Validation); ok {
|
|
|
+ return ve.ValidateName("bouncers" + "." + strconv.Itoa(i))
|
|
|
+ }
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+func (m *Metrics) contextValidateMachines(ctx context.Context, formats strfmt.Registry) error {
|
|
|
+
|
|
|
+ for i := 0; i < len(m.Machines); i++ {
|
|
|
+
|
|
|
+ if m.Machines[i] != nil {
|
|
|
+ if err := m.Machines[i].ContextValidate(ctx, formats); err != nil {
|
|
|
+ if ve, ok := err.(*errors.Validation); ok {
|
|
|
+ return ve.ValidateName("machines" + "." + strconv.Itoa(i))
|
|
|
+ }
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
// MarshalBinary interface implementation
|
|
|
func (m *Metrics) MarshalBinary() ([]byte, error) {
|
|
|
if m == nil {
|