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