Initial cloud-services repo - gateway service + pkg modules
This commit is contained in:
121
pkg/ota_api/models/handlers_car_update_statuses.go
Normal file
121
pkg/ota_api/models/handlers_car_update_statuses.go
Normal file
@@ -0,0 +1,121 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// HandlersCarUpdateStatuses handlers car update statuses
|
||||
//
|
||||
// swagger:model handlers.CarUpdateStatuses
|
||||
type HandlersCarUpdateStatuses struct {
|
||||
|
||||
// statuses
|
||||
Statuses []*CommonCarUpdateProgress `json:"statuses"`
|
||||
}
|
||||
|
||||
// Validate validates this handlers car update statuses
|
||||
func (m *HandlersCarUpdateStatuses) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateStatuses(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *HandlersCarUpdateStatuses) validateStatuses(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Statuses) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Statuses); i++ {
|
||||
if swag.IsZero(m.Statuses[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Statuses[i] != nil {
|
||||
if err := m.Statuses[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("statuses" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("statuses" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this handlers car update statuses based on the context it is used
|
||||
func (m *HandlersCarUpdateStatuses) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateStatuses(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *HandlersCarUpdateStatuses) contextValidateStatuses(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Statuses); i++ {
|
||||
|
||||
if m.Statuses[i] != nil {
|
||||
|
||||
if swag.IsZero(m.Statuses[i]) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.Statuses[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("statuses" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("statuses" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *HandlersCarUpdateStatuses) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *HandlersCarUpdateStatuses) UnmarshalBinary(b []byte) error {
|
||||
var res HandlersCarUpdateStatuses
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user