// 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" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CommonUpdateManifestUpdateRequest common update manifest update request // // swagger:model common.UpdateManifestUpdateRequest type CommonUpdateManifestUpdateRequest struct { // active Active bool `json:"active,omitempty"` // body type BodyType string `json:"body_type,omitempty"` // country Country string `json:"country,omitempty"` // env Env string `json:"env,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"` // 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"` // sums Sums string `json:"sums,omitempty"` // trim Trim string `json:"trim,omitempty"` // type // Required: true // Enum: ["standard","forced"] Type *string `json:"type"` // update duration UpdateDuration int64 `json:"update_duration,omitempty"` // year Year int64 `json:"year,omitempty"` } // Validate validates this common update manifest update request func (m *CommonUpdateManifestUpdateRequest) Validate(formats strfmt.Registry) error { var res []error 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 len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *CommonUpdateManifestUpdateRequest) 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 *CommonUpdateManifestUpdateRequest) 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 } var commonUpdateManifestUpdateRequestTypeTypePropEnum []interface{} func init() { var res []string if err := json.Unmarshal([]byte(`["standard","forced"]`), &res); err != nil { panic(err) } for _, v := range res { commonUpdateManifestUpdateRequestTypeTypePropEnum = append(commonUpdateManifestUpdateRequestTypeTypePropEnum, v) } } const ( // CommonUpdateManifestUpdateRequestTypeStandard captures enum value "standard" CommonUpdateManifestUpdateRequestTypeStandard string = "standard" // CommonUpdateManifestUpdateRequestTypeForced captures enum value "forced" CommonUpdateManifestUpdateRequestTypeForced string = "forced" ) // prop value enum func (m *CommonUpdateManifestUpdateRequest) validateTypeEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, commonUpdateManifestUpdateRequestTypeTypePropEnum, true); err != nil { return err } return nil } func (m *CommonUpdateManifestUpdateRequest) validateType(formats strfmt.Registry) error { if err := validate.Required("type", "body", m.Type); err != nil { return err } // value enum if err := m.validateTypeEnum("type", "body", *m.Type); err != nil { return err } return nil } // ContextValidate validates this common update manifest update request based on context it is used func (m *CommonUpdateManifestUpdateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *CommonUpdateManifestUpdateRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *CommonUpdateManifestUpdateRequest) UnmarshalBinary(b []byte) error { var res CommonUpdateManifestUpdateRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }