github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/models/worker_pool.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 // WorkerPool the worker pool of job service 18 // 19 // swagger:model WorkerPool 20 type WorkerPool struct { 21 22 // The concurrency of the work pool 23 Concurrency int64 `json:"concurrency,omitempty"` 24 25 // The heartbeat time of the work pool 26 // Format: date-time 27 HeartbeatAt strfmt.DateTime `json:"heartbeat_at,omitempty"` 28 29 // The host of the work pool 30 Host string `json:"host,omitempty"` 31 32 // the process id of jobservice 33 Pid int64 `json:"pid,omitempty"` 34 35 // The start time of the work pool 36 // Format: date-time 37 StartAt strfmt.DateTime `json:"start_at,omitempty"` 38 39 // the id of the worker pool 40 WorkerPoolID string `json:"worker_pool_id,omitempty"` 41 } 42 43 // Validate validates this worker pool 44 func (m *WorkerPool) Validate(formats strfmt.Registry) error { 45 var res []error 46 47 if err := m.validateHeartbeatAt(formats); err != nil { 48 res = append(res, err) 49 } 50 51 if err := m.validateStartAt(formats); err != nil { 52 res = append(res, err) 53 } 54 55 if len(res) > 0 { 56 return errors.CompositeValidationError(res...) 57 } 58 return nil 59 } 60 61 func (m *WorkerPool) validateHeartbeatAt(formats strfmt.Registry) error { 62 if swag.IsZero(m.HeartbeatAt) { // not required 63 return nil 64 } 65 66 if err := validate.FormatOf("heartbeat_at", "body", "date-time", m.HeartbeatAt.String(), formats); err != nil { 67 return err 68 } 69 70 return nil 71 } 72 73 func (m *WorkerPool) validateStartAt(formats strfmt.Registry) error { 74 if swag.IsZero(m.StartAt) { // not required 75 return nil 76 } 77 78 if err := validate.FormatOf("start_at", "body", "date-time", m.StartAt.String(), formats); err != nil { 79 return err 80 } 81 82 return nil 83 } 84 85 // ContextValidate validates this worker pool based on context it is used 86 func (m *WorkerPool) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 87 return nil 88 } 89 90 // MarshalBinary interface implementation 91 func (m *WorkerPool) MarshalBinary() ([]byte, error) { 92 if m == nil { 93 return nil, nil 94 } 95 return swag.WriteJSON(m) 96 } 97 98 // UnmarshalBinary interface implementation 99 func (m *WorkerPool) UnmarshalBinary(b []byte) error { 100 var res WorkerPool 101 if err := swag.ReadJSON(b, &res); err != nil { 102 return err 103 } 104 *m = res 105 return nil 106 }