Update LAPI swagger (#1155)

This commit is contained in:
blotus 2022-01-11 16:45:34 +01:00 committed by GitHub
parent 3bca25fd6d
commit cc72800f50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 585 additions and 7 deletions

View file

@ -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"
@ -78,6 +79,8 @@ func (m *Metrics) validateBouncers(formats strfmt.Registry) error {
if err := m.Bouncers[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("bouncers" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("bouncers" + "." + strconv.Itoa(i))
}
return err
}
@ -103,6 +106,66 @@ func (m *Metrics) validateMachines(formats strfmt.Registry) error {
if err := m.Machines[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("machines" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("machines" + "." + strconv.Itoa(i))
}
return err
}
}
}
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))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.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))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("machines" + "." + strconv.Itoa(i))
}
return err
}