github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/models/replication_task.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 // ReplicationTask The replication task 18 // 19 // swagger:model ReplicationTask 20 type ReplicationTask struct { 21 22 // The destination resource that the task operates 23 DstResource string `json:"dst_resource,omitempty"` 24 25 // The end time of the task 26 // Format: date-time 27 EndTime strfmt.DateTime `json:"end_time,omitempty"` 28 29 // The ID of the execution that the task belongs to 30 ExecutionID int64 `json:"execution_id,omitempty"` 31 32 // The ID of the task 33 ID int64 `json:"id,omitempty"` 34 35 // The ID of the underlying job that the task related to 36 JobID string `json:"job_id,omitempty"` 37 38 // The operation of the task 39 Operation string `json:"operation,omitempty"` 40 41 // The type of the resource that the task operates 42 ResourceType string `json:"resource_type,omitempty"` 43 44 // The source resource that the task operates 45 SrcResource string `json:"src_resource,omitempty"` 46 47 // The start time of the task 48 // Format: date-time 49 StartTime strfmt.DateTime `json:"start_time,omitempty"` 50 51 // The status of the task 52 Status string `json:"status,omitempty"` 53 } 54 55 // Validate validates this replication task 56 func (m *ReplicationTask) Validate(formats strfmt.Registry) error { 57 var res []error 58 59 if err := m.validateEndTime(formats); err != nil { 60 res = append(res, err) 61 } 62 63 if err := m.validateStartTime(formats); err != nil { 64 res = append(res, err) 65 } 66 67 if len(res) > 0 { 68 return errors.CompositeValidationError(res...) 69 } 70 return nil 71 } 72 73 func (m *ReplicationTask) validateEndTime(formats strfmt.Registry) error { 74 if swag.IsZero(m.EndTime) { // not required 75 return nil 76 } 77 78 if err := validate.FormatOf("end_time", "body", "date-time", m.EndTime.String(), formats); err != nil { 79 return err 80 } 81 82 return nil 83 } 84 85 func (m *ReplicationTask) validateStartTime(formats strfmt.Registry) error { 86 if swag.IsZero(m.StartTime) { // not required 87 return nil 88 } 89 90 if err := validate.FormatOf("start_time", "body", "date-time", m.StartTime.String(), formats); err != nil { 91 return err 92 } 93 94 return nil 95 } 96 97 // ContextValidate validates this replication task based on context it is used 98 func (m *ReplicationTask) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 99 return nil 100 } 101 102 // MarshalBinary interface implementation 103 func (m *ReplicationTask) MarshalBinary() ([]byte, error) { 104 if m == nil { 105 return nil, nil 106 } 107 return swag.WriteJSON(m) 108 } 109 110 // UnmarshalBinary interface implementation 111 func (m *ReplicationTask) UnmarshalBinary(b []byte) error { 112 var res ReplicationTask 113 if err := swag.ReadJSON(b, &res); err != nil { 114 return err 115 } 116 *m = res 117 return nil 118 }