command/agent: add Canonicalize option to parse args
This commit is contained in:
parent
31da01856a
commit
de4176606d
|
@ -36,8 +36,13 @@ type Jobs struct {
|
|||
client *Client
|
||||
}
|
||||
|
||||
// JobsParseRequest is used for arguments of the /vi/jobs/parse endpoint
|
||||
type JobsParseRequest struct {
|
||||
//JobHCL is an hcl jobspec
|
||||
JobHCL string
|
||||
//Canonicalize is a flag as to if the server should return default values
|
||||
//for unset fields
|
||||
Canonicalize bool
|
||||
}
|
||||
|
||||
// Jobs returns a handle on the jobs endpoints.
|
||||
|
|
|
@ -565,6 +565,9 @@ func (s *HTTPServer) JobsParseRequest(resp http.ResponseWriter, req *http.Reques
|
|||
return nil, CodedError(400, err.Error())
|
||||
}
|
||||
|
||||
if args.Canonicalize {
|
||||
jobStruct.Canonicalize()
|
||||
}
|
||||
return jobStruct, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue