351 lines
7.9 KiB
Go
351 lines
7.9 KiB
Go
// 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"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// CommonUpdateManifestFile common update manifest file
|
|
//
|
|
// swagger:model common.UpdateManifestFile
|
|
type CommonUpdateManifestFile struct {
|
|
|
|
// checksum
|
|
// Max Length: 8
|
|
Checksum string `json:"checksum,omitempty"`
|
|
|
|
// compatible drive sides
|
|
CompatibleDriveSides []string `json:"compatible_drive_sides"`
|
|
|
|
// compatible trims
|
|
CompatibleTrims []string `json:"compatible_trims"`
|
|
|
|
// erase region
|
|
EraseRegion *CommonMemoryRegion `json:"erase_region,omitempty"`
|
|
|
|
// file id
|
|
FileID string `json:"file_id,omitempty"`
|
|
|
|
// file key
|
|
FileKey *CommonFileKeyResponse `json:"file_key,omitempty"`
|
|
|
|
// file size
|
|
FileSize int64 `json:"file_size,omitempty"`
|
|
|
|
// filename
|
|
// Max Length: 512
|
|
Filename string `json:"filename,omitempty"`
|
|
|
|
// manifest ecu id
|
|
// Minimum: 0
|
|
ManifestEcuID *int64 `json:"manifest_ecu_id,omitempty"`
|
|
|
|
// order
|
|
Order int64 `json:"order,omitempty"`
|
|
|
|
// parsed file
|
|
ParsedFile bool `json:"parsed_file,omitempty"`
|
|
|
|
// signature
|
|
// Max Length: 129
|
|
Signature string `json:"signature,omitempty"`
|
|
|
|
// type
|
|
// Max Length: 255
|
|
Type string `json:"type,omitempty"`
|
|
|
|
// url
|
|
// Max Length: 32768
|
|
URL string `json:"url,omitempty"`
|
|
|
|
// write region
|
|
WriteRegion *CommonMemoryRegion `json:"write_region,omitempty"`
|
|
}
|
|
|
|
// Validate validates this common update manifest file
|
|
func (m *CommonUpdateManifestFile) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateChecksum(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateEraseRegion(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateFileKey(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateFilename(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateManifestEcuID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateSignature(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateType(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateURL(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateWriteRegion(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *CommonUpdateManifestFile) validateChecksum(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Checksum) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.MaxLength("checksum", "body", m.Checksum, 8); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *CommonUpdateManifestFile) validateEraseRegion(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.EraseRegion) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.EraseRegion != nil {
|
|
if err := m.EraseRegion.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("erase_region")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("erase_region")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *CommonUpdateManifestFile) validateFileKey(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.FileKey) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.FileKey != nil {
|
|
if err := m.FileKey.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("file_key")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("file_key")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *CommonUpdateManifestFile) validateFilename(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Filename) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.MaxLength("filename", "body", m.Filename, 512); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *CommonUpdateManifestFile) validateManifestEcuID(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.ManifestEcuID) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.MinimumInt("manifest_ecu_id", "body", *m.ManifestEcuID, 0, false); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *CommonUpdateManifestFile) validateSignature(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Signature) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.MaxLength("signature", "body", m.Signature, 129); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *CommonUpdateManifestFile) validateType(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Type) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.MaxLength("type", "body", m.Type, 255); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *CommonUpdateManifestFile) validateURL(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.URL) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.MaxLength("url", "body", m.URL, 32768); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *CommonUpdateManifestFile) validateWriteRegion(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.WriteRegion) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.WriteRegion != nil {
|
|
if err := m.WriteRegion.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("write_region")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("write_region")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this common update manifest file based on the context it is used
|
|
func (m *CommonUpdateManifestFile) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateEraseRegion(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateFileKey(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateWriteRegion(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *CommonUpdateManifestFile) contextValidateEraseRegion(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.EraseRegion != nil {
|
|
|
|
if swag.IsZero(m.EraseRegion) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.EraseRegion.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("erase_region")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("erase_region")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *CommonUpdateManifestFile) contextValidateFileKey(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.FileKey != nil {
|
|
|
|
if swag.IsZero(m.FileKey) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.FileKey.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("file_key")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("file_key")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *CommonUpdateManifestFile) contextValidateWriteRegion(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.WriteRegion != nil {
|
|
|
|
if swag.IsZero(m.WriteRegion) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.WriteRegion.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("write_region")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("write_region")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *CommonUpdateManifestFile) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *CommonUpdateManifestFile) UnmarshalBinary(b []byte) error {
|
|
var res CommonUpdateManifestFile
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|