github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_models/build_flag.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 // BuildFlag build flag 18 // 19 // swagger:model BuildFlag 20 type BuildFlag struct { 21 22 // name 23 // Required: true 24 Name string `json:"name"` 25 26 // value 27 Value *string `json:"value,omitempty"` 28 } 29 30 // Validate validates this build flag 31 func (m *BuildFlag) Validate(formats strfmt.Registry) error { 32 var res []error 33 34 if err := m.validateName(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 *BuildFlag) validateName(formats strfmt.Registry) error { 45 46 if err := validate.RequiredString("name", "body", m.Name); err != nil { 47 return err 48 } 49 50 return nil 51 } 52 53 // ContextValidate validates this build flag based on context it is used 54 func (m *BuildFlag) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 55 return nil 56 } 57 58 // MarshalBinary interface implementation 59 func (m *BuildFlag) MarshalBinary() ([]byte, error) { 60 if m == nil { 61 return nil, nil 62 } 63 return swag.WriteJSON(m) 64 } 65 66 // UnmarshalBinary interface implementation 67 func (m *BuildFlag) UnmarshalBinary(b []byte) error { 68 var res BuildFlag 69 if err := swag.ReadJSON(b, &res); err != nil { 70 return err 71 } 72 *m = res 73 return nil 74 }