github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/models/robot_created.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package 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 // RobotCreated The response for robot account creation. 18 // 19 // swagger:model RobotCreated 20 type RobotCreated struct { 21 22 // The creation time of the robot. 23 // Format: date-time 24 CreationTime strfmt.DateTime `json:"creation_time,omitempty"` 25 26 // The expiration date of the robot 27 ExpiresAt int64 `json:"expires_at,omitempty"` 28 29 // The ID of the robot 30 ID int64 `json:"id,omitempty"` 31 32 // The name of the robot 33 Name string `json:"name,omitempty"` 34 35 // The secret of the robot 36 Secret string `json:"secret,omitempty"` 37 } 38 39 // Validate validates this robot created 40 func (m *RobotCreated) Validate(formats strfmt.Registry) error { 41 var res []error 42 43 if err := m.validateCreationTime(formats); err != nil { 44 res = append(res, err) 45 } 46 47 if len(res) > 0 { 48 return errors.CompositeValidationError(res...) 49 } 50 return nil 51 } 52 53 func (m *RobotCreated) validateCreationTime(formats strfmt.Registry) error { 54 if swag.IsZero(m.CreationTime) { // not required 55 return nil 56 } 57 58 if err := validate.FormatOf("creation_time", "body", "date-time", m.CreationTime.String(), formats); err != nil { 59 return err 60 } 61 62 return nil 63 } 64 65 // ContextValidate validates this robot created based on context it is used 66 func (m *RobotCreated) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 67 return nil 68 } 69 70 // MarshalBinary interface implementation 71 func (m *RobotCreated) 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 *RobotCreated) UnmarshalBinary(b []byte) error { 80 var res RobotCreated 81 if err := swag.ReadJSON(b, &res); err != nil { 82 return err 83 } 84 *m = res 85 return nil 86 }