mirror of
https://github.com/openziti/zrok.git
synced 2024-12-23 15:18:52 +01:00
125 lines
2.8 KiB
Go
125 lines
2.8 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package rest_model_zrok
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"context"
|
|
"strconv"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
)
|
|
|
|
// Overview overview
|
|
//
|
|
// swagger:model overview
|
|
type Overview struct {
|
|
|
|
// account limited
|
|
AccountLimited bool `json:"accountLimited,omitempty"`
|
|
|
|
// environments
|
|
Environments []*EnvironmentAndResources `json:"environments"`
|
|
}
|
|
|
|
// Validate validates this overview
|
|
func (m *Overview) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateEnvironments(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *Overview) validateEnvironments(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Environments) { // not required
|
|
return nil
|
|
}
|
|
|
|
for i := 0; i < len(m.Environments); i++ {
|
|
if swag.IsZero(m.Environments[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.Environments[i] != nil {
|
|
if err := m.Environments[i].Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("environments" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("environments" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this overview based on the context it is used
|
|
func (m *Overview) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateEnvironments(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *Overview) contextValidateEnvironments(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.Environments); i++ {
|
|
|
|
if m.Environments[i] != nil {
|
|
|
|
if swag.IsZero(m.Environments[i]) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.Environments[i].ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("environments" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("environments" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *Overview) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *Overview) UnmarshalBinary(b []byte) error {
|
|
var res Overview
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|