mirror of
https://github.com/openziti/zrok.git
synced 2024-11-29 11:34:07 +01:00
147 lines
3.5 KiB
Go
147 lines
3.5 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"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
)
|
|
|
|
// EnvironmentServices environment services
|
|
//
|
|
// swagger:model environmentServices
|
|
type EnvironmentServices struct {
|
|
|
|
// environment
|
|
Environment *Environment `json:"environment,omitempty"`
|
|
|
|
// services
|
|
Services Services `json:"services,omitempty"`
|
|
}
|
|
|
|
// Validate validates this environment services
|
|
func (m *EnvironmentServices) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateEnvironment(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateServices(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *EnvironmentServices) validateEnvironment(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Environment) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.Environment != nil {
|
|
if err := m.Environment.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("environment")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("environment")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *EnvironmentServices) validateServices(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Services) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.Services.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("services")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("services")
|
|
}
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this environment services based on the context it is used
|
|
func (m *EnvironmentServices) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateEnvironment(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateServices(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *EnvironmentServices) contextValidateEnvironment(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.Environment != nil {
|
|
if err := m.Environment.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("environment")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("environment")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *EnvironmentServices) contextValidateServices(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if err := m.Services.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("services")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("services")
|
|
}
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *EnvironmentServices) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *EnvironmentServices) UnmarshalBinary(b []byte) error {
|
|
var res EnvironmentServices
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|