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:
Mahmood Ali 2021-04-12 13:30:24 -04:00 committed by GitHub
commit a618b6facd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 8 deletions

View file

@ -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
}

View file

@ -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
}