github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/inventory/inventory_models/self_link.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 "github.com/go-openapi/validate" 15 ) 16 17 // SelfLink Self Link 18 // 19 // A self link 20 // 21 // swagger:model selfLink 22 type SelfLink struct { 23 24 // The URI of this resource 25 // Required: true 26 // Format: uri 27 Self *strfmt.URI `json:"self"` 28 } 29 30 // Validate validates this self link 31 func (m *SelfLink) Validate(formats strfmt.Registry) error { 32 var res []error 33 34 if err := m.validateSelf(formats); err != nil { 35 res = append(res, err) 36 } 37 38 if len(res) > 0 { 39 return errors.CompositeValidationError(res...) 40 } 41 return nil 42 } 43 44 func (m *SelfLink) validateSelf(formats strfmt.Registry) error { 45 46 if err := validate.Required("self", "body", m.Self); err != nil { 47 return err 48 } 49 50 if err := validate.FormatOf("self", "body", "uri", m.Self.String(), formats); err != nil { 51 return err 52 } 53 54 return nil 55 } 56 57 // ContextValidate validates this self link based on context it is used 58 func (m *SelfLink) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 59 return nil 60 } 61 62 // MarshalBinary interface implementation 63 func (m *SelfLink) MarshalBinary() ([]byte, error) { 64 if m == nil { 65 return nil, nil 66 } 67 return swag.WriteJSON(m) 68 } 69 70 // UnmarshalBinary interface implementation 71 func (m *SelfLink) UnmarshalBinary(b []byte) error { 72 var res SelfLink 73 if err := swag.ReadJSON(b, &res); err != nil { 74 return err 75 } 76 *m = res 77 return nil 78 }