mirror of
https://github.com/openziti/zrok.git
synced 2025-08-19 12:24:37 +02:00
new overview response for '/overview' endpoint (#320)
This commit is contained in:
103
rest_model_zrok/overview.go
Normal file
103
rest_model_zrok/overview.go
Normal file
@@ -0,0 +1,103 @@
|
||||
// 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"
|
||||
|
||||
"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 EnvironmentSharesList `json:"environments,omitempty"`
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
if err := m.Environments.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("environments")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("environments")
|
||||
}
|
||||
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 {
|
||||
|
||||
if err := m.Environments.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("environments")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("environments")
|
||||
}
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user