Commit b8b18dbe authored by Alex Dadgar's avatar Alex Dadgar
Browse files

Structs

parent 53eb407c
No related merge requests found
Showing with 42 additions and 11 deletions
+42 -11
......@@ -539,6 +539,21 @@ type JobValidateResponse struct {
Error string
}
// JobRevertRequest is used to revert a job to a prior version.
type JobRevertRequest struct {
// JobID is the ID of the job being reverted
JobID string
// JobVersion the version to revert to.
JobVersion uint64
// EnforcePriorVersion if set will enforce that the job is at the given
// version before reverting.
EnforcePriorVersion *uint64
WriteRequest
}
// JobUpdateRequest is used to update a job
type JobRegisterRequest struct {
Job *Job
......
......@@ -286,8 +286,8 @@ func (j *Job) Summary(args *structs.JobSummaryRequest,
}
// Validate validates a job
func (j *Job) Validate(args *structs.JobValidateRequest,
reply *structs.JobValidateResponse) error {
func (j *Job) Validate(args *structs.JobValidateRequest, reply *structs.JobValidateResponse) error {
defer metrics.MeasureSince([]string{"nomad", "job", "validate"}, time.Now())
if err := validateJob(args.Job); err != nil {
if merr, ok := err.(*multierror.Error); ok {
......@@ -300,6 +300,7 @@ func (j *Job) Validate(args *structs.JobValidateRequest,
reply.Error = err.Error()
}
}
reply.DriverConfigValidated = true
return nil
}
......
......@@ -294,17 +294,19 @@ type JobValidateRequest struct {
WriteRequest
}
// JobValidateResponse is the response from validate request
type JobValidateResponse struct {
// DriverConfigValidated indicates whether the agent validated the driver
// config
DriverConfigValidated bool
// JobRevertRequest is used to revert a job to a prior version.
type JobRevertRequest struct {
// JobID is the ID of the job being reverted
JobID string
// ValidationErrors is a list of validation errors
ValidationErrors []string
// JobVersion the version to revert to.
JobVersion uint64
// Error is a string version of any error that may have occured
Error string
// EnforcePriorVersion if set will enforce that the job is at the given
// version before reverting.
EnforcePriorVersion *uint64
WriteRequest
}
// NodeListRequest is used to parameterize a list request
......@@ -493,6 +495,19 @@ type JobDeregisterResponse struct {
QueryMeta
}
// JobValidateResponse is the response from validate request
type JobValidateResponse struct {
// DriverConfigValidated indicates whether the agent validated the driver
// config
DriverConfigValidated bool
// ValidationErrors is a list of validation errors
ValidationErrors []string
// Error is a string version of any error that may have occured
Error string
}
// NodeUpdateResponse is used to respond to a node update
type NodeUpdateResponse struct {
HeartbeatTTL time.Duration
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment