package models // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( strfmt "github.com/go-openapi/strfmt" "github.com/go-openapi/errors" "github.com/go-openapi/validate" ) /*NewJob new job swagger:model NewJob */ type NewJob struct { /* Number of seconds to wait before queueing the job for consumption for the first time. Must be a positive integer. Jobs with a delay start in state "delayed" and transition to "running" after delay seconds. */ Delay int32 `json:"delay,omitempty"` /* Name of Docker image to use. This is optional and can be used to override the image defined at the group level. Required: true */ Image *string `json:"image"` /* "Number of automatic retries this job is allowed. A retry will be attempted if a task fails. Max 25. Automatic retries are performed by titan when a task reaches a failed state and has `max_retries` > 0. A retry is performed by queueing a new job with the same image id and payload. The new job's max_retries is one less than the original. The new job's `retry_of` field is set to the original Job ID. Titan will delay the new job for retries_delay seconds before queueing it. Cancelled or successful tasks are never automatically retried." */ MaxRetries int32 `json:"max_retries,omitempty"` /* Payload for the job. This is what you pass into each job to make it do something. */ Payload string `json:"payload,omitempty"` /* Priority of the job. Higher has more priority. 3 levels from 0-2. Jobs at same priority are processed in FIFO order. Required: true */ Priority *int32 `json:"priority"` /* Time in seconds to wait before retrying the job. Must be a non-negative integer. */ RetriesDelay *int32 `json:"retries_delay,omitempty"` /* Maximum runtime in seconds. If a consumer retrieves the job, but does not change it's status within timeout seconds, the job is considered failed, with reason timeout (Titan may allow a small grace period). The consumer should also kill the job after timeout seconds. If a consumer tries to change status after Titan has already timed out the job, the consumer will be ignored. */ Timeout *int32 `json:"timeout,omitempty"` } // Validate validates this new job func (m *NewJob) Validate(formats strfmt.Registry) error { var res []error if err := m.validateImage(formats); err != nil { // prop res = append(res, err) } if err := m.validatePriority(formats); err != nil { // prop res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *NewJob) validateImage(formats strfmt.Registry) error { if err := validate.Required("image", "body", m.Image); err != nil { return err } return nil } func (m *NewJob) validatePriority(formats strfmt.Registry) error { if err := validate.Required("priority", "body", m.Priority); err != nil { return err } return nil }