github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/secrets/secrets_models/uid.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package secrets_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 // UID UID 17 // swagger:model UID 18 type UID struct { 19 20 // uid 21 // Required: true 22 // Format: uuid 23 UID *strfmt.UUID `json:"uid"` 24 } 25 26 // Validate validates this UID 27 func (m *UID) Validate(formats strfmt.Registry) error { 28 var res []error 29 30 if err := m.validateUID(formats); err != nil { 31 res = append(res, err) 32 } 33 34 if len(res) > 0 { 35 return errors.CompositeValidationError(res...) 36 } 37 return nil 38 } 39 40 func (m *UID) validateUID(formats strfmt.Registry) error { 41 42 if err := validate.Required("uid", "body", m.UID); err != nil { 43 return err 44 } 45 46 if err := validate.FormatOf("uid", "body", "uuid", m.UID.String(), formats); err != nil { 47 return err 48 } 49 50 return nil 51 } 52 53 // MarshalBinary interface implementation 54 func (m *UID) MarshalBinary() ([]byte, error) { 55 if m == nil { 56 return nil, nil 57 } 58 return swag.WriteJSON(m) 59 } 60 61 // UnmarshalBinary interface implementation 62 func (m *UID) UnmarshalBinary(b []byte) error { 63 var res UID 64 if err := swag.ReadJSON(b, &res); err != nil { 65 return err 66 } 67 *m = res 68 return nil 69 }