github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/inventory/inventory_models/libc_version.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 // LibcVersion Libc Version 17 // 18 // The full libc version data model 19 // 20 // swagger:model libcVersion 21 type LibcVersion struct { 22 LibcVersionAllOf0 23 24 LibcVersionCore 25 26 RevisionedResource 27 } 28 29 // UnmarshalJSON unmarshals this object from a JSON structure 30 func (m *LibcVersion) UnmarshalJSON(raw []byte) error { 31 // AO0 32 var aO0 LibcVersionAllOf0 33 if err := swag.ReadJSON(raw, &aO0); err != nil { 34 return err 35 } 36 m.LibcVersionAllOf0 = aO0 37 38 // AO1 39 var aO1 LibcVersionCore 40 if err := swag.ReadJSON(raw, &aO1); err != nil { 41 return err 42 } 43 m.LibcVersionCore = 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 LibcVersion) MarshalJSON() ([]byte, error) { 57 _parts := make([][]byte, 0, 3) 58 59 aO0, err := swag.WriteJSON(m.LibcVersionAllOf0) 60 if err != nil { 61 return nil, err 62 } 63 _parts = append(_parts, aO0) 64 65 aO1, err := swag.WriteJSON(m.LibcVersionCore) 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 libc version 80 func (m *LibcVersion) Validate(formats strfmt.Registry) error { 81 var res []error 82 83 // validation for a type composition with LibcVersionAllOf0 84 if err := m.LibcVersionAllOf0.Validate(formats); err != nil { 85 res = append(res, err) 86 } 87 // validation for a type composition with LibcVersionCore 88 if err := m.LibcVersionCore.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 libc version based on the context it is used 103 func (m *LibcVersion) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 104 var res []error 105 106 // validation for a type composition with LibcVersionAllOf0 107 if err := m.LibcVersionAllOf0.ContextValidate(ctx, formats); err != nil { 108 res = append(res, err) 109 } 110 // validation for a type composition with LibcVersionCore 111 if err := m.LibcVersionCore.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 *LibcVersion) 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 *LibcVersion) UnmarshalBinary(b []byte) error { 135 var res LibcVersion 136 if err := swag.ReadJSON(b, &res); err != nil { 137 return err 138 } 139 *m = res 140 return nil 141 }