github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/secrets/secrets_models/public_key.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 // PublicKey public key 17 // swagger:model PublicKey 18 type PublicKey struct { 19 20 // user id 21 // Required: true 22 // Format: uuid 23 UserID *strfmt.UUID `json:"user_id"` 24 25 // value 26 // Required: true 27 Value *string `json:"value"` 28 } 29 30 // Validate validates this public key 31 func (m *PublicKey) Validate(formats strfmt.Registry) error { 32 var res []error 33 34 if err := m.validateUserID(formats); err != nil { 35 res = append(res, err) 36 } 37 38 if err := m.validateValue(formats); err != nil { 39 res = append(res, err) 40 } 41 42 if len(res) > 0 { 43 return errors.CompositeValidationError(res...) 44 } 45 return nil 46 } 47 48 func (m *PublicKey) validateUserID(formats strfmt.Registry) error { 49 50 if err := validate.Required("user_id", "body", m.UserID); err != nil { 51 return err 52 } 53 54 if err := validate.FormatOf("user_id", "body", "uuid", m.UserID.String(), formats); err != nil { 55 return err 56 } 57 58 return nil 59 } 60 61 func (m *PublicKey) validateValue(formats strfmt.Registry) error { 62 63 if err := validate.Required("value", "body", m.Value); err != nil { 64 return err 65 } 66 67 return nil 68 } 69 70 // MarshalBinary interface implementation 71 func (m *PublicKey) MarshalBinary() ([]byte, error) { 72 if m == nil { 73 return nil, nil 74 } 75 return swag.WriteJSON(m) 76 } 77 78 // UnmarshalBinary interface implementation 79 func (m *PublicKey) UnmarshalBinary(b []byte) error { 80 var res PublicKey 81 if err := swag.ReadJSON(b, &res); err != nil { 82 return err 83 } 84 *m = res 85 return nil 86 }