diff --git a/api/api.go b/api/api.go index b59b4a687a4..3d7fab65218 100644 --- a/api/api.go +++ b/api/api.go @@ -98,6 +98,10 @@ type QueryOptions struct { // Currently only supported by specific endpoints. Reverse bool + // Resources specifies whether to include the AllocatedResources + // field in the response. + Resources bool + // ctx is an optional context pass through to the underlying HTTP // request layer. Use Context() and WithContext() to manage this. ctx context.Context @@ -713,6 +717,9 @@ func (r *request) setQueryOptions(q *QueryOptions) { if q.Reverse { r.params.Set("reverse", "true") } + if q.Resources { + r.params.Set("resources", "true") + } for k, v := range q.Params { r.params.Set(k, v) } diff --git a/api/api_test.go b/api/api_test.go index 4c62cf073eb..fb55ad20023 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -167,6 +167,7 @@ func TestSetQueryOptions(t *testing.T) { WaitTime: 100 * time.Second, AuthToken: "foobar", Reverse: true, + Resources: true, } r.setQueryOptions(q) @@ -185,6 +186,7 @@ func TestSetQueryOptions(t *testing.T) { try("index", "1000") try("wait", "100000ms") try("reverse", "true") + try("resources", "true") } func TestQueryOptionsContext(t *testing.T) {