github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/headchef/headchef_models/v2_build_request_requester.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package headchef_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 strfmt "github.com/go-openapi/strfmt" 10 11 "github.com/go-openapi/errors" 12 "github.com/go-openapi/swag" 13 "github.com/go-openapi/validate" 14 ) 15 16 // V2BuildRequestRequester Requester 17 // 18 // Identifying information about who is placing the build request 19 // swagger:model v2BuildRequestRequester 20 type V2BuildRequestRequester struct { 21 22 // The UUID of the platform organization that owns the project being built 23 // Required: true 24 // Format: uuid 25 OrganizationID *strfmt.UUID `json:"organization_id"` 26 27 // The UUID of the platform project being built by this build request 28 // Required: true 29 // Format: uuid 30 ProjectID *strfmt.UUID `json:"project_id"` 31 32 // An optional string describing the service for non user initiated requests 33 Service string `json:"service,omitempty"` 34 35 // The UUID of the platform user who initiated the build request 36 // Format: uuid 37 UserID strfmt.UUID `json:"user_id,omitempty"` 38 } 39 40 // Validate validates this v2 build request requester 41 func (m *V2BuildRequestRequester) Validate(formats strfmt.Registry) error { 42 var res []error 43 44 if err := m.validateOrganizationID(formats); err != nil { 45 res = append(res, err) 46 } 47 48 if err := m.validateProjectID(formats); err != nil { 49 res = append(res, err) 50 } 51 52 if err := m.validateUserID(formats); err != nil { 53 res = append(res, err) 54 } 55 56 if len(res) > 0 { 57 return errors.CompositeValidationError(res...) 58 } 59 return nil 60 } 61 62 func (m *V2BuildRequestRequester) validateOrganizationID(formats strfmt.Registry) error { 63 64 if err := validate.Required("organization_id", "body", m.OrganizationID); err != nil { 65 return err 66 } 67 68 if err := validate.FormatOf("organization_id", "body", "uuid", m.OrganizationID.String(), formats); err != nil { 69 return err 70 } 71 72 return nil 73 } 74 75 func (m *V2BuildRequestRequester) validateProjectID(formats strfmt.Registry) error { 76 77 if err := validate.Required("project_id", "body", m.ProjectID); err != nil { 78 return err 79 } 80 81 if err := validate.FormatOf("project_id", "body", "uuid", m.ProjectID.String(), formats); err != nil { 82 return err 83 } 84 85 return nil 86 } 87 88 func (m *V2BuildRequestRequester) validateUserID(formats strfmt.Registry) error { 89 90 if swag.IsZero(m.UserID) { // not required 91 return nil 92 } 93 94 if err := validate.FormatOf("user_id", "body", "uuid", m.UserID.String(), formats); err != nil { 95 return err 96 } 97 98 return nil 99 } 100 101 // MarshalBinary interface implementation 102 func (m *V2BuildRequestRequester) 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 *V2BuildRequestRequester) UnmarshalBinary(b []byte) error { 111 var res V2BuildRequestRequester 112 if err := swag.ReadJSON(b, &res); err != nil { 113 return err 114 } 115 *m = res 116 return nil 117 }