github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/inventory/inventory_models/cpu_extension.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package inventory_models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "context" 10 11 "github.com/go-openapi/errors" 12 "github.com/go-openapi/strfmt" 13 "github.com/go-openapi/swag" 14 ) 15 16 // CPUExtension CPU Extension 17 // 18 // The full CPU extension data model 19 // 20 // swagger:model cpuExtension 21 type CPUExtension struct { 22 CPUExtensionAllOf0 23 24 CPUExtensionCore 25 26 RevisionedResource 27 } 28 29 // UnmarshalJSON unmarshals this object from a JSON structure 30 func (m *CPUExtension) UnmarshalJSON(raw []byte) error { 31 // AO0 32 var aO0 CPUExtensionAllOf0 33 if err := swag.ReadJSON(raw, &aO0); err != nil { 34 return err 35 } 36 m.CPUExtensionAllOf0 = aO0 37 38 // AO1 39 var aO1 CPUExtensionCore 40 if err := swag.ReadJSON(raw, &aO1); err != nil { 41 return err 42 } 43 m.CPUExtensionCore = aO1 44 45 // AO2 46 var aO2 RevisionedResource 47 if err := swag.ReadJSON(raw, &aO2); err != nil { 48 return err 49 } 50 m.RevisionedResource = aO2 51 52 return nil 53 } 54 55 // MarshalJSON marshals this object to a JSON structure 56 func (m CPUExtension) MarshalJSON() ([]byte, error) { 57 _parts := make([][]byte, 0, 3) 58 59 aO0, err := swag.WriteJSON(m.CPUExtensionAllOf0) 60 if err != nil { 61 return nil, err 62 } 63 _parts = append(_parts, aO0) 64 65 aO1, err := swag.WriteJSON(m.CPUExtensionCore) 66 if err != nil { 67 return nil, err 68 } 69 _parts = append(_parts, aO1) 70 71 aO2, err := swag.WriteJSON(m.RevisionedResource) 72 if err != nil { 73 return nil, err 74 } 75 _parts = append(_parts, aO2) 76 return swag.ConcatJSON(_parts...), nil 77 } 78 79 // Validate validates this cpu extension 80 func (m *CPUExtension) Validate(formats strfmt.Registry) error { 81 var res []error 82 83 // validation for a type composition with CPUExtensionAllOf0 84 if err := m.CPUExtensionAllOf0.Validate(formats); err != nil { 85 res = append(res, err) 86 } 87 // validation for a type composition with CPUExtensionCore 88 if err := m.CPUExtensionCore.Validate(formats); err != nil { 89 res = append(res, err) 90 } 91 // validation for a type composition with RevisionedResource 92 if err := m.RevisionedResource.Validate(formats); err != nil { 93 res = append(res, err) 94 } 95 96 if len(res) > 0 { 97 return errors.CompositeValidationError(res...) 98 } 99 return nil 100 } 101 102 // ContextValidate validate this cpu extension based on the context it is used 103 func (m *CPUExtension) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 104 var res []error 105 106 // validation for a type composition with CPUExtensionAllOf0 107 if err := m.CPUExtensionAllOf0.ContextValidate(ctx, formats); err != nil { 108 res = append(res, err) 109 } 110 // validation for a type composition with CPUExtensionCore 111 if err := m.CPUExtensionCore.ContextValidate(ctx, formats); err != nil { 112 res = append(res, err) 113 } 114 // validation for a type composition with RevisionedResource 115 if err := m.RevisionedResource.ContextValidate(ctx, formats); err != nil { 116 res = append(res, err) 117 } 118 119 if len(res) > 0 { 120 return errors.CompositeValidationError(res...) 121 } 122 return nil 123 } 124 125 // MarshalBinary interface implementation 126 func (m *CPUExtension) MarshalBinary() ([]byte, error) { 127 if m == nil { 128 return nil, nil 129 } 130 return swag.WriteJSON(m) 131 } 132 133 // UnmarshalBinary interface implementation 134 func (m *CPUExtension) UnmarshalBinary(b []byte) error { 135 var res CPUExtension 136 if err := swag.ReadJSON(b, &res); err != nil { 137 return err 138 } 139 *m = res 140 return nil 141 }