github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/inventory/inventory_models/libc.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 // Libc Libc 17 // 18 // The full libc data model 19 // 20 // swagger:model libc 21 type Libc struct { 22 LibcAllOf0 23 24 LibcCore 25 } 26 27 // UnmarshalJSON unmarshals this object from a JSON structure 28 func (m *Libc) UnmarshalJSON(raw []byte) error { 29 // AO0 30 var aO0 LibcAllOf0 31 if err := swag.ReadJSON(raw, &aO0); err != nil { 32 return err 33 } 34 m.LibcAllOf0 = aO0 35 36 // AO1 37 var aO1 LibcCore 38 if err := swag.ReadJSON(raw, &aO1); err != nil { 39 return err 40 } 41 m.LibcCore = aO1 42 43 return nil 44 } 45 46 // MarshalJSON marshals this object to a JSON structure 47 func (m Libc) MarshalJSON() ([]byte, error) { 48 _parts := make([][]byte, 0, 2) 49 50 aO0, err := swag.WriteJSON(m.LibcAllOf0) 51 if err != nil { 52 return nil, err 53 } 54 _parts = append(_parts, aO0) 55 56 aO1, err := swag.WriteJSON(m.LibcCore) 57 if err != nil { 58 return nil, err 59 } 60 _parts = append(_parts, aO1) 61 return swag.ConcatJSON(_parts...), nil 62 } 63 64 // Validate validates this libc 65 func (m *Libc) Validate(formats strfmt.Registry) error { 66 var res []error 67 68 // validation for a type composition with LibcAllOf0 69 if err := m.LibcAllOf0.Validate(formats); err != nil { 70 res = append(res, err) 71 } 72 // validation for a type composition with LibcCore 73 if err := m.LibcCore.Validate(formats); err != nil { 74 res = append(res, err) 75 } 76 77 if len(res) > 0 { 78 return errors.CompositeValidationError(res...) 79 } 80 return nil 81 } 82 83 // ContextValidate validate this libc based on the context it is used 84 func (m *Libc) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 85 var res []error 86 87 // validation for a type composition with LibcAllOf0 88 if err := m.LibcAllOf0.ContextValidate(ctx, formats); err != nil { 89 res = append(res, err) 90 } 91 // validation for a type composition with LibcCore 92 if err := m.LibcCore.ContextValidate(ctx, 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 // MarshalBinary interface implementation 103 func (m *Libc) MarshalBinary() ([]byte, error) { 104 if m == nil { 105 return nil, nil 106 } 107 return swag.WriteJSON(m) 108 } 109 110 // UnmarshalBinary interface implementation 111 func (m *Libc) UnmarshalBinary(b []byte) error { 112 var res Libc 113 if err := swag.ReadJSON(b, &res); err != nil { 114 return err 115 } 116 *m = res 117 return nil 118 }