Merge pull request #10276 from hashicorp/b-api-operator-query-meta
api: set operator query meta Set the query meta for LicenseGet request. It's expected by api consumers to determine the raft index.
This commit is contained in:
commit
a618b6facd
|
@ -320,7 +320,7 @@ func (op *Operator) LicenseGet(q *QueryOptions) (*LicenseReply, *QueryMeta, erro
|
|||
req.setQueryOptions(q)
|
||||
|
||||
var reply LicenseReply
|
||||
_, resp, err := op.c.doRequest(req)
|
||||
rtt, resp, err := op.c.doRequest(req)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -331,9 +331,13 @@ func (op *Operator) LicenseGet(q *QueryOptions) (*LicenseReply, *QueryMeta, erro
|
|||
}
|
||||
|
||||
err = json.NewDecoder(resp.Body).Decode(&reply)
|
||||
if err == nil {
|
||||
return &reply, nil, nil
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return nil, nil, err
|
||||
qm := &QueryMeta{}
|
||||
parseQueryMeta(resp, qm)
|
||||
qm.RequestTime = rtt
|
||||
|
||||
return &reply, qm, nil
|
||||
}
|
||||
|
|
12
vendor/github.com/hashicorp/nomad/api/operator.go
generated
vendored
12
vendor/github.com/hashicorp/nomad/api/operator.go
generated
vendored
|
@ -320,7 +320,7 @@ func (op *Operator) LicenseGet(q *QueryOptions) (*LicenseReply, *QueryMeta, erro
|
|||
req.setQueryOptions(q)
|
||||
|
||||
var reply LicenseReply
|
||||
_, resp, err := op.c.doRequest(req)
|
||||
rtt, resp, err := op.c.doRequest(req)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -331,9 +331,13 @@ func (op *Operator) LicenseGet(q *QueryOptions) (*LicenseReply, *QueryMeta, erro
|
|||
}
|
||||
|
||||
err = json.NewDecoder(resp.Body).Decode(&reply)
|
||||
if err == nil {
|
||||
return &reply, nil, nil
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return nil, nil, err
|
||||
qm := &QueryMeta{}
|
||||
parseQueryMeta(resp, qm)
|
||||
qm.RequestTime = rtt
|
||||
|
||||
return &reply, qm, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue