-
Notifications
You must be signed in to change notification settings - Fork 2k
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: add field filters to /v1/{allocations,nodes} #9055
Conversation
Fixes #9017 The ?resources=true query parameter includes resources in the object stub listings. Specifically: - For `/v1/nodes?resources=true` both the `NodeResources` and `ReservedResources` field are included. - For `/v1/allocations?resources=true` the `AllocatedResources` field is included. The ?task_states=false query parameter removes TaskStates from /v1/allocations responses. (By default TaskStates are included.)
fcb15e7
to
276be86
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
} | ||
|
||
return false, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
golf: seems like these two could be combined into something like parseBool(req *http.Request, param string)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed. Mind taking another peek? My old approach let a bug sneak in that should be fixed now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bug being parseTaskStates
would return false by default if the field was absent?
(LGTM)
In the past I've used a [closed] library for extracting url parameters by providing a schema, providing the name, type, and default value into a call to lib.Parse
. It helped cleanup a lot of this url parameter boilerplate - might be worth trying to recreate it sometime.
} | ||
|
||
return false, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bug being parseTaskStates
would return false by default if the field was absent?
(LGTM)
In the past I've used a [closed] library for extracting url parameters by providing a schema, providing the name, type, and default value into a call to lib.Parse
. It helped cleanup a lot of this url parameter boilerplate - might be worth trying to recreate it sometime.
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Fixes #9017
The ?resources=true query parameter includes resources in the object stub listings. Specifically:
/v1/nodes?resources=true
both theNodeResources
andReservedResources
field are included./v1/allocations?resources=true
theAllocatedResources
field is included.The ?task_states=false query parameter removes TaskStates from
/v1/allocations responses. (By default TaskStates are included.)