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