github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_models/h_a_repo.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package mono_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 // HARepo h a repo 18 // 19 // swagger:model HARepo 20 type HARepo struct { 21 22 // commit ID 23 // Format: uuid 24 CommitID strfmt.UUID `json:"commitID,omitempty"` 25 26 // The repo id 27 // Format: uuid 28 HaRepoID strfmt.UUID `json:"haRepoID,omitempty"` 29 30 // label 31 Label string `json:"label,omitempty"` 32 33 // The project that this repo belongs to 34 // Format: uuid 35 ProjectID strfmt.UUID `json:"projectID,omitempty"` 36 } 37 38 // Validate validates this h a repo 39 func (m *HARepo) Validate(formats strfmt.Registry) error { 40 var res []error 41 42 if err := m.validateCommitID(formats); err != nil { 43 res = append(res, err) 44 } 45 46 if err := m.validateHaRepoID(formats); err != nil { 47 res = append(res, err) 48 } 49 50 if err := m.validateProjectID(formats); err != nil { 51 res = append(res, err) 52 } 53 54 if len(res) > 0 { 55 return errors.CompositeValidationError(res...) 56 } 57 return nil 58 } 59 60 func (m *HARepo) validateCommitID(formats strfmt.Registry) error { 61 if swag.IsZero(m.CommitID) { // not required 62 return nil 63 } 64 65 if err := validate.FormatOf("commitID", "body", "uuid", m.CommitID.String(), formats); err != nil { 66 return err 67 } 68 69 return nil 70 } 71 72 func (m *HARepo) validateHaRepoID(formats strfmt.Registry) error { 73 if swag.IsZero(m.HaRepoID) { // not required 74 return nil 75 } 76 77 if err := validate.FormatOf("haRepoID", "body", "uuid", m.HaRepoID.String(), formats); err != nil { 78 return err 79 } 80 81 return nil 82 } 83 84 func (m *HARepo) validateProjectID(formats strfmt.Registry) error { 85 if swag.IsZero(m.ProjectID) { // not required 86 return nil 87 } 88 89 if err := validate.FormatOf("projectID", "body", "uuid", m.ProjectID.String(), formats); err != nil { 90 return err 91 } 92 93 return nil 94 } 95 96 // ContextValidate validates this h a repo based on context it is used 97 func (m *HARepo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 98 return nil 99 } 100 101 // MarshalBinary interface implementation 102 func (m *HARepo) MarshalBinary() ([]byte, error) { 103 if m == nil { 104 return nil, nil 105 } 106 return swag.WriteJSON(m) 107 } 108 109 // UnmarshalBinary interface implementation 110 func (m *HARepo) UnmarshalBinary(b []byte) error { 111 var res HARepo 112 if err := swag.ReadJSON(b, &res); err != nil { 113 return err 114 } 115 *m = res 116 return nil 117 }