github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/inventory/inventory_models/revision_base.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 // RevisionBase Revision Base 18 // 19 // Base properties of a revisioned resource which can be modified by a new revision. Does not include provided features, so for most usage revision is actually the appropriate schema. 20 // 21 // swagger:model revisionBase 22 type RevisionBase struct { 23 24 // The platform user_id for the author of the revision. This will be automatically populated for writes based on the credentials you provide to the API. 25 // Format: uuid 26 AuthorPlatformUserID strfmt.UUID `json:"author_platform_user_id,omitempty"` 27 28 // A comment describing the revision. 29 // Required: true 30 Comment *string `json:"comment"` 31 32 // Whether this revision should be considered 'stable'. When a new stable revision is created, it supercedes any existing stable revision and becomes the default revision of the revisioned resource going forward. 33 IsStableRevision *bool `json:"is_stable_revision,omitempty"` 34 } 35 36 // Validate validates this revision base 37 func (m *RevisionBase) Validate(formats strfmt.Registry) error { 38 var res []error 39 40 if err := m.validateAuthorPlatformUserID(formats); err != nil { 41 res = append(res, err) 42 } 43 44 if err := m.validateComment(formats); err != nil { 45 res = append(res, err) 46 } 47 48 if len(res) > 0 { 49 return errors.CompositeValidationError(res...) 50 } 51 return nil 52 } 53 54 func (m *RevisionBase) validateAuthorPlatformUserID(formats strfmt.Registry) error { 55 if swag.IsZero(m.AuthorPlatformUserID) { // not required 56 return nil 57 } 58 59 if err := validate.FormatOf("author_platform_user_id", "body", "uuid", m.AuthorPlatformUserID.String(), formats); err != nil { 60 return err 61 } 62 63 return nil 64 } 65 66 func (m *RevisionBase) validateComment(formats strfmt.Registry) error { 67 68 if err := validate.Required("comment", "body", m.Comment); err != nil { 69 return err 70 } 71 72 return nil 73 } 74 75 // ContextValidate validates this revision base based on context it is used 76 func (m *RevisionBase) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 77 return nil 78 } 79 80 // MarshalBinary interface implementation 81 func (m *RevisionBase) MarshalBinary() ([]byte, error) { 82 if m == nil { 83 return nil, nil 84 } 85 return swag.WriteJSON(m) 86 } 87 88 // UnmarshalBinary interface implementation 89 func (m *RevisionBase) UnmarshalBinary(b []byte) error { 90 var res RevisionBase 91 if err := swag.ReadJSON(b, &res); err != nil { 92 return err 93 } 94 *m = res 95 return nil 96 }