Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api: enable setting choose parameter #12914

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ type QueryOptions struct {
// Currently only supported by specific endpoints.
Reverse bool

// Choose is used when selecting a subset of services from the normal
// complete list of services. Format is <count>|<key>, where the key is
// typically the allocation ID hashed with other service metadata associated
// with the requesting task.
Choose string

// ctx is an optional context pass through to the underlying HTTP
// request layer. Use Context() and WithContext() to manage this.
ctx context.Context
Expand Down Expand Up @@ -611,6 +617,9 @@ func (r *request) setQueryOptions(q *QueryOptions) {
if q.Filter != "" {
r.params.Set("filter", q.Filter)
}
if q.Choose != "" {
r.params.Set("choose", q.Choose)
}
if q.PerPage != 0 {
r.params.Set("per_page", fmt.Sprint(q.PerPage))
}
Expand Down