github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/inventory/inventory_models/provided_feature.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 // ProvidedFeature Provided Feature 17 // 18 // A feature that is provided by a revisioned resource 19 // 20 // swagger:model providedFeature 21 type ProvidedFeature struct { 22 ProvidedFeatureAllOf0 23 24 VersionInfo 25 } 26 27 // UnmarshalJSON unmarshals this object from a JSON structure 28 func (m *ProvidedFeature) UnmarshalJSON(raw []byte) error { 29 // AO0 30 var aO0 ProvidedFeatureAllOf0 31 if err := swag.ReadJSON(raw, &aO0); err != nil { 32 return err 33 } 34 m.ProvidedFeatureAllOf0 = aO0 35 36 // AO1 37 var aO1 VersionInfo 38 if err := swag.ReadJSON(raw, &aO1); err != nil { 39 return err 40 } 41 m.VersionInfo = aO1 42 43 return nil 44 } 45 46 // MarshalJSON marshals this object to a JSON structure 47 func (m ProvidedFeature) MarshalJSON() ([]byte, error) { 48 _parts := make([][]byte, 0, 2) 49 50 aO0, err := swag.WriteJSON(m.ProvidedFeatureAllOf0) 51 if err != nil { 52 return nil, err 53 } 54 _parts = append(_parts, aO0) 55 56 aO1, err := swag.WriteJSON(m.VersionInfo) 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 provided feature 65 func (m *ProvidedFeature) Validate(formats strfmt.Registry) error { 66 var res []error 67 68 // validation for a type composition with ProvidedFeatureAllOf0 69 if err := m.ProvidedFeatureAllOf0.Validate(formats); err != nil { 70 res = append(res, err) 71 } 72 // validation for a type composition with VersionInfo 73 if err := m.VersionInfo.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 provided feature based on the context it is used 84 func (m *ProvidedFeature) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 85 var res []error 86 87 // validation for a type composition with ProvidedFeatureAllOf0 88 if err := m.ProvidedFeatureAllOf0.ContextValidate(ctx, formats); err != nil { 89 res = append(res, err) 90 } 91 // validation for a type composition with VersionInfo 92 if err := m.VersionInfo.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 *ProvidedFeature) 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 *ProvidedFeature) UnmarshalBinary(b []byte) error { 112 var res ProvidedFeature 113 if err := swag.ReadJSON(b, &res); err != nil { 114 return err 115 } 116 *m = res 117 return nil 118 }