// Code generated by go-swagger; DO NOT EDIT. // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"). You may // not use this file except in compliance with the License. A copy of the // License is located at // // http://aws.amazon.com/apache2.0/ // // or in the "license" file accompanying this file. This file is distributed // on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either // express or implied. See the License for the specific language governing // permissions and limitations under the License. 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 ( "strconv" strfmt "github.com/go-openapi/strfmt" "github.com/go-openapi/errors" "github.com/go-openapi/swag" ) // FullVMConfiguration full Vm configuration // swagger:model FullVmConfiguration type FullVMConfiguration struct { // balloon Balloon *Balloon `json:"balloon,omitempty"` // boot source BootSource *BootSource `json:"boot-source,omitempty"` // Configurations for all block devices. Drives []*Drive `json:"drives"` // logger Logger *Logger `json:"logger,omitempty"` // machine config MachineConfig *MachineConfiguration `json:"machine-config,omitempty"` // metrics Metrics *Metrics `json:"metrics,omitempty"` // mmds config MmdsConfig *MmdsConfig `json:"mmds-config,omitempty"` // Configurations for all net devices. NetworkInterfaces []*NetworkInterface `json:"network-interfaces"` // vsock Vsock *Vsock `json:"vsock,omitempty"` } // Validate validates this full Vm configuration func (m *FullVMConfiguration) Validate(formats strfmt.Registry) error { var res []error if err := m.validateBalloon(formats); err != nil { res = append(res, err) } if err := m.validateBootSource(formats); err != nil { res = append(res, err) } if err := m.validateDrives(formats); err != nil { res = append(res, err) } if err := m.validateLogger(formats); err != nil { res = append(res, err) } if err := m.validateMachineConfig(formats); err != nil { res = append(res, err) } if err := m.validateMetrics(formats); err != nil { res = append(res, err) } if err := m.validateMmdsConfig(formats); err != nil { res = append(res, err) } if err := m.validateNetworkInterfaces(formats); err != nil { res = append(res, err) } if err := m.validateVsock(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *FullVMConfiguration) validateBalloon(formats strfmt.Registry) error { if swag.IsZero(m.Balloon) { // not required return nil } if m.Balloon != nil { if err := m.Balloon.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("balloon") } return err } } return nil } func (m *FullVMConfiguration) validateBootSource(formats strfmt.Registry) error { if swag.IsZero(m.BootSource) { // not required return nil } if m.BootSource != nil { if err := m.BootSource.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("boot-source") } return err } } return nil } func (m *FullVMConfiguration) validateDrives(formats strfmt.Registry) error { if swag.IsZero(m.Drives) { // not required return nil } for i := 0; i < len(m.Drives); i++ { if swag.IsZero(m.Drives[i]) { // not required continue } if m.Drives[i] != nil { if err := m.Drives[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("drives" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *FullVMConfiguration) validateLogger(formats strfmt.Registry) error { if swag.IsZero(m.Logger) { // not required return nil } if m.Logger != nil { if err := m.Logger.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("logger") } return err } } return nil } func (m *FullVMConfiguration) validateMachineConfig(formats strfmt.Registry) error { if swag.IsZero(m.MachineConfig) { // not required return nil } if m.MachineConfig != nil { if err := m.MachineConfig.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("machine-config") } return err } } return nil } func (m *FullVMConfiguration) validateMetrics(formats strfmt.Registry) error { if swag.IsZero(m.Metrics) { // not required return nil } if m.Metrics != nil { if err := m.Metrics.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("metrics") } return err } } return nil } func (m *FullVMConfiguration) validateMmdsConfig(formats strfmt.Registry) error { if swag.IsZero(m.MmdsConfig) { // not required return nil } if m.MmdsConfig != nil { if err := m.MmdsConfig.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("mmds-config") } return err } } return nil } func (m *FullVMConfiguration) validateNetworkInterfaces(formats strfmt.Registry) error { if swag.IsZero(m.NetworkInterfaces) { // not required return nil } for i := 0; i < len(m.NetworkInterfaces); i++ { if swag.IsZero(m.NetworkInterfaces[i]) { // not required continue } if m.NetworkInterfaces[i] != nil { if err := m.NetworkInterfaces[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("network-interfaces" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *FullVMConfiguration) validateVsock(formats strfmt.Registry) error { if swag.IsZero(m.Vsock) { // not required return nil } if m.Vsock != nil { if err := m.Vsock.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("vsock") } return err } } return nil } // MarshalBinary interface implementation func (m *FullVMConfiguration) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *FullVMConfiguration) UnmarshalBinary(b []byte) error { var res FullVMConfiguration if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }