github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/models/gc_history.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 // GCHistory GC history 18 // 19 // swagger:model GCHistory 20 type GCHistory struct { 21 22 // the creation time of gc job. 23 // Format: date-time 24 CreationTime strfmt.DateTime `json:"creation_time,omitempty"` 25 26 // if gc job was deleted. 27 Deleted bool `json:"deleted,omitempty"` 28 29 // the id of gc job. 30 ID int64 `json:"id,omitempty"` 31 32 // the job kind of gc job. 33 JobKind string `json:"job_kind,omitempty"` 34 35 // the job name of gc job. 36 JobName string `json:"job_name,omitempty"` 37 38 // the job parameters of gc job. 39 JobParameters string `json:"job_parameters,omitempty"` 40 41 // the status of gc job. 42 JobStatus string `json:"job_status,omitempty"` 43 44 // schedule 45 Schedule *ScheduleObj `json:"schedule,omitempty"` 46 47 // the update time of gc job. 48 // Format: date-time 49 UpdateTime strfmt.DateTime `json:"update_time,omitempty"` 50 } 51 52 // Validate validates this GC history 53 func (m *GCHistory) Validate(formats strfmt.Registry) error { 54 var res []error 55 56 if err := m.validateCreationTime(formats); err != nil { 57 res = append(res, err) 58 } 59 60 if err := m.validateSchedule(formats); err != nil { 61 res = append(res, err) 62 } 63 64 if err := m.validateUpdateTime(formats); err != nil { 65 res = append(res, err) 66 } 67 68 if len(res) > 0 { 69 return errors.CompositeValidationError(res...) 70 } 71 return nil 72 } 73 74 func (m *GCHistory) validateCreationTime(formats strfmt.Registry) error { 75 if swag.IsZero(m.CreationTime) { // not required 76 return nil 77 } 78 79 if err := validate.FormatOf("creation_time", "body", "date-time", m.CreationTime.String(), formats); err != nil { 80 return err 81 } 82 83 return nil 84 } 85 86 func (m *GCHistory) validateSchedule(formats strfmt.Registry) error { 87 if swag.IsZero(m.Schedule) { // not required 88 return nil 89 } 90 91 if m.Schedule != nil { 92 if err := m.Schedule.Validate(formats); err != nil { 93 if ve, ok := err.(*errors.Validation); ok { 94 return ve.ValidateName("schedule") 95 } else if ce, ok := err.(*errors.CompositeError); ok { 96 return ce.ValidateName("schedule") 97 } 98 return err 99 } 100 } 101 102 return nil 103 } 104 105 func (m *GCHistory) validateUpdateTime(formats strfmt.Registry) error { 106 if swag.IsZero(m.UpdateTime) { // not required 107 return nil 108 } 109 110 if err := validate.FormatOf("update_time", "body", "date-time", m.UpdateTime.String(), formats); err != nil { 111 return err 112 } 113 114 return nil 115 } 116 117 // ContextValidate validate this GC history based on the context it is used 118 func (m *GCHistory) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 119 var res []error 120 121 if err := m.contextValidateSchedule(ctx, formats); err != nil { 122 res = append(res, err) 123 } 124 125 if len(res) > 0 { 126 return errors.CompositeValidationError(res...) 127 } 128 return nil 129 } 130 131 func (m *GCHistory) contextValidateSchedule(ctx context.Context, formats strfmt.Registry) error { 132 133 if m.Schedule != nil { 134 if err := m.Schedule.ContextValidate(ctx, formats); err != nil { 135 if ve, ok := err.(*errors.Validation); ok { 136 return ve.ValidateName("schedule") 137 } else if ce, ok := err.(*errors.CompositeError); ok { 138 return ce.ValidateName("schedule") 139 } 140 return err 141 } 142 } 143 144 return nil 145 } 146 147 // MarshalBinary interface implementation 148 func (m *GCHistory) MarshalBinary() ([]byte, error) { 149 if m == nil { 150 return nil, nil 151 } 152 return swag.WriteJSON(m) 153 } 154 155 // UnmarshalBinary interface implementation 156 func (m *GCHistory) UnmarshalBinary(b []byte) error { 157 var res GCHistory 158 if err := swag.ReadJSON(b, &res); err != nil { 159 return err 160 } 161 *m = res 162 return nil 163 }