github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/buildlogstream/buildlogstream_models/pkg_build_started.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package buildlogstream_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 "github.com/go-openapi/errors" 10 "github.com/go-openapi/strfmt" 11 "github.com/go-openapi/swag" 12 "github.com/go-openapi/validate" 13 ) 14 15 // PkgBuildStarted Package Build Started 16 // 17 // A message indicating that a requested package build has been started. 18 // 19 // swagger:model pkgBuildStarted 20 type PkgBuildStarted struct { 21 22 // ingredient id 23 // Required: true 24 // Format: uuid 25 IngredientID *strfmt.UUID `json:"ingredient_id"` 26 27 // ingredient version 28 // Required: true 29 IngredientVersion *string `json:"ingredient_version"` 30 31 // The percentage through the total number of packages to be built in the current tast 32 // Maximum: 100 33 // Minimum: 0 34 Percent *int64 `json:"percent,omitempty"` 35 36 // The current position in the list of packages to be built in the current task 37 // Minimum: 0 38 Sequence *int64 `json:"sequence,omitempty"` 39 40 // The current total number of packages to be built in the current task 41 // Minimum: 0 42 Total *int64 `json:"total,omitempty"` 43 } 44 45 // Validate validates this pkg build started 46 func (m *PkgBuildStarted) Validate(formats strfmt.Registry) error { 47 var res []error 48 49 if err := m.validateIngredientID(formats); err != nil { 50 res = append(res, err) 51 } 52 53 if err := m.validateIngredientVersion(formats); err != nil { 54 res = append(res, err) 55 } 56 57 if err := m.validatePercent(formats); err != nil { 58 res = append(res, err) 59 } 60 61 if err := m.validateSequence(formats); err != nil { 62 res = append(res, err) 63 } 64 65 if err := m.validateTotal(formats); err != nil { 66 res = append(res, err) 67 } 68 69 if len(res) > 0 { 70 return errors.CompositeValidationError(res...) 71 } 72 return nil 73 } 74 75 func (m *PkgBuildStarted) validateIngredientID(formats strfmt.Registry) error { 76 77 if err := validate.Required("ingredient_id", "body", m.IngredientID); err != nil { 78 return err 79 } 80 81 if err := validate.FormatOf("ingredient_id", "body", "uuid", m.IngredientID.String(), formats); err != nil { 82 return err 83 } 84 85 return nil 86 } 87 88 func (m *PkgBuildStarted) validateIngredientVersion(formats strfmt.Registry) error { 89 90 if err := validate.Required("ingredient_version", "body", m.IngredientVersion); err != nil { 91 return err 92 } 93 94 return nil 95 } 96 97 func (m *PkgBuildStarted) validatePercent(formats strfmt.Registry) error { 98 99 if swag.IsZero(m.Percent) { // not required 100 return nil 101 } 102 103 if err := validate.MinimumInt("percent", "body", int64(*m.Percent), 0, false); err != nil { 104 return err 105 } 106 107 if err := validate.MaximumInt("percent", "body", int64(*m.Percent), 100, false); err != nil { 108 return err 109 } 110 111 return nil 112 } 113 114 func (m *PkgBuildStarted) validateSequence(formats strfmt.Registry) error { 115 116 if swag.IsZero(m.Sequence) { // not required 117 return nil 118 } 119 120 if err := validate.MinimumInt("sequence", "body", int64(*m.Sequence), 0, false); err != nil { 121 return err 122 } 123 124 return nil 125 } 126 127 func (m *PkgBuildStarted) validateTotal(formats strfmt.Registry) error { 128 129 if swag.IsZero(m.Total) { // not required 130 return nil 131 } 132 133 if err := validate.MinimumInt("total", "body", int64(*m.Total), 0, false); err != nil { 134 return err 135 } 136 137 return nil 138 } 139 140 // MarshalBinary interface implementation 141 func (m *PkgBuildStarted) MarshalBinary() ([]byte, error) { 142 if m == nil { 143 return nil, nil 144 } 145 return swag.WriteJSON(m) 146 } 147 148 // UnmarshalBinary interface implementation 149 func (m *PkgBuildStarted) UnmarshalBinary(b []byte) error { 150 var res PkgBuildStarted 151 if err := swag.ReadJSON(b, &res); err != nil { 152 return err 153 } 154 *m = res 155 return nil 156 }