Skip to content

Commit

Permalink
wip: removed api.RegisterJobRequest in favor of api.JobRegisterRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
cgbaker committed Jun 16, 2020
1 parent d8b020c commit 3ff5c35
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 22 deletions.
14 changes: 3 additions & 11 deletions api/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (j *Jobs) EnforceRegister(job *Job, modifyIndex uint64, q *WriteOptions) (*
// of the evaluation, along with any errors encountered.
func (j *Jobs) RegisterOpts(job *Job, opts *RegisterOptions, q *WriteOptions) (*JobRegisterResponse, *WriteMeta, error) {
// Format the request
req := &RegisterJobRequest{
req := &JobRegisterRequest{
Job: job,
}
if opts != nil {
Expand Down Expand Up @@ -1042,20 +1042,12 @@ type JobRegisterRequest struct {
// If EnforceIndex is set then the job will only be registered if the passed
// JobModifyIndex matches the current Jobs index. If the index is zero, the
// register only occurs if the job is new.
EnforceIndex bool
JobModifyIndex uint64
PolicyOverride bool

WriteRequest
}

// RegisterJobRequest is used to serialize a job registration
type RegisterJobRequest struct {
Job *Job
EnforceIndex bool `json:",omitempty"`
JobModifyIndex uint64 `json:",omitempty"`
PolicyOverride bool `json:",omitempty"`
PreserveCounts bool `json:",omitempty"`

WriteRequest
}

// JobRegisterResponse is used to respond to a job registration
Expand Down
2 changes: 1 addition & 1 deletion command/job_inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (c *JobInspectCommand) Run(args []string) int {
}

// Print the contents of the job
req := api.RegisterJobRequest{Job: job}
req := api.JobRegisterRequest{Job: job}
f, err := DataFormat("json", "")
if err != nil {
c.Ui.Error(fmt.Sprintf("Error getting formatter: %s", err))
Expand Down
2 changes: 1 addition & 1 deletion command/job_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (c *JobRunCommand) Run(args []string) int {
}

if output {
req := api.RegisterJobRequest{Job: job}
req := api.JobRegisterRequest{Job: job}
buf, err := json.MarshalIndent(req, "", " ")
if err != nil {
c.Ui.Error(fmt.Sprintf("Error converting job: %s", err))
Expand Down
10 changes: 1 addition & 9 deletions vendor/github.com/hashicorp/nomad/api/jobs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3ff5c35

Please sign in to comment.