Files
cloud-services/pkg/ota_api/models/common_create_update_manifest.go

196 lines
4.2 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"
)
// CommonCreateUpdateManifest common create update manifest
//
// swagger:model common.CreateUpdateManifest
type CommonCreateUpdateManifest struct {
// active
Active bool `json:"active,omitempty"`
// body type
BodyType string `json:"body_type,omitempty"`
// country
Country string `json:"country,omitempty"`
// description
// Max Length: 5120
Description string `json:"description,omitempty"`
// id
ID int64 `json:"id,omitempty"`
// max attempts
MaxAttempts int64 `json:"max_attempts,omitempty"`
// model
Model string `json:"model,omitempty"`
// name
// Required: true
// Max Length: 255
Name *string `json:"name"`
// notify sap
NotifySap bool `json:"notify_sap,omitempty"`
// powertrain
Powertrain string `json:"powertrain,omitempty"`
// release notes
// Max Length: 32768
ReleaseNotes string `json:"release_notes,omitempty"`
// restraint
Restraint string `json:"restraint,omitempty"`
// rollback
Rollback bool `json:"rollback,omitempty"`
// trim
Trim string `json:"trim,omitempty"`
// type
// Max Length: 100
Type string `json:"type,omitempty"`
// Duration of update in minutes
UpdateDuration int64 `json:"update_duration,omitempty"`
// version
// Max Length: 255
Version string `json:"version,omitempty"`
// year
Year int64 `json:"year,omitempty"`
}
// Validate validates this common create update manifest
func (m *CommonCreateUpdateManifest) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateDescription(formats); err != nil {
res = append(res, err)
}
if err := m.validateName(formats); err != nil {
res = append(res, err)
}
if err := m.validateReleaseNotes(formats); err != nil {
res = append(res, err)
}
if err := m.validateType(formats); err != nil {
res = append(res, err)
}
if err := m.validateVersion(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CommonCreateUpdateManifest) validateDescription(formats strfmt.Registry) error {
if swag.IsZero(m.Description) { // not required
return nil
}
if err := validate.MaxLength("description", "body", m.Description, 5120); err != nil {
return err
}
return nil
}
func (m *CommonCreateUpdateManifest) validateName(formats strfmt.Registry) error {
if err := validate.Required("name", "body", m.Name); err != nil {
return err
}
if err := validate.MaxLength("name", "body", *m.Name, 255); err != nil {
return err
}
return nil
}
func (m *CommonCreateUpdateManifest) validateReleaseNotes(formats strfmt.Registry) error {
if swag.IsZero(m.ReleaseNotes) { // not required
return nil
}
if err := validate.MaxLength("release_notes", "body", m.ReleaseNotes, 32768); err != nil {
return err
}
return nil
}
func (m *CommonCreateUpdateManifest) validateType(formats strfmt.Registry) error {
if swag.IsZero(m.Type) { // not required
return nil
}
if err := validate.MaxLength("type", "body", m.Type, 100); err != nil {
return err
}
return nil
}
func (m *CommonCreateUpdateManifest) validateVersion(formats strfmt.Registry) error {
if swag.IsZero(m.Version) { // not required
return nil
}
if err := validate.MaxLength("version", "body", m.Version, 255); err != nil {
return err
}
return nil
}
// ContextValidate validates this common create update manifest based on context it is used
func (m *CommonCreateUpdateManifest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *CommonCreateUpdateManifest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CommonCreateUpdateManifest) UnmarshalBinary(b []byte) error {
var res CommonCreateUpdateManifest
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}