Initial cloud-services repo - gateway service + pkg modules
This commit is contained in:
172
pkg/ota_api/models/handlers_manifest_migrate_body.go
Normal file
172
pkg/ota_api/models/handlers_manifest_migrate_body.go
Normal file
@@ -0,0 +1,172 @@
|
||||
// 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"
|
||||
)
|
||||
|
||||
// HandlersManifestMigrateBody handlers manifest migrate body
|
||||
//
|
||||
// swagger:model handlers.ManifestMigrateBody
|
||||
type HandlersManifestMigrateBody struct {
|
||||
|
||||
// file keys
|
||||
FileKeys []*CommonFileKeyResponse `json:"fileKeys"`
|
||||
|
||||
// migrated manifest
|
||||
MigratedManifest *CommonUpdateManifest `json:"migratedManifest,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this handlers manifest migrate body
|
||||
func (m *HandlersManifestMigrateBody) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateFileKeys(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateMigratedManifest(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *HandlersManifestMigrateBody) validateFileKeys(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.FileKeys) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.FileKeys); i++ {
|
||||
if swag.IsZero(m.FileKeys[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.FileKeys[i] != nil {
|
||||
if err := m.FileKeys[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("fileKeys" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("fileKeys" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *HandlersManifestMigrateBody) validateMigratedManifest(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.MigratedManifest) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.MigratedManifest != nil {
|
||||
if err := m.MigratedManifest.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("migratedManifest")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("migratedManifest")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this handlers manifest migrate body based on the context it is used
|
||||
func (m *HandlersManifestMigrateBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateFileKeys(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateMigratedManifest(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *HandlersManifestMigrateBody) contextValidateFileKeys(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.FileKeys); i++ {
|
||||
|
||||
if m.FileKeys[i] != nil {
|
||||
|
||||
if swag.IsZero(m.FileKeys[i]) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.FileKeys[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("fileKeys" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("fileKeys" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *HandlersManifestMigrateBody) contextValidateMigratedManifest(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.MigratedManifest != nil {
|
||||
|
||||
if swag.IsZero(m.MigratedManifest) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.MigratedManifest.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("migratedManifest")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("migratedManifest")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *HandlersManifestMigrateBody) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *HandlersManifestMigrateBody) UnmarshalBinary(b []byte) error {
|
||||
var res HandlersManifestMigrateBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user