Closed ndenev closed 6 years ago
This is basically just an alternate syntax for:
let query = ListQuery::default().label_selector("app=my-great-app");
I should probably document an example of using this to help make it more discoverable, but is there any particular reason this Default
merits a new
alias and not others?
Personally, I'm wondering if that exact construction will be common enough to merit supporting ListQuery::with_label("app=my-great-app");
or maybe listing could expose APIs more like this:
list_all()
list_with_label(label: &str)
list(query: ListQuery)
I certainly feel like querying based on label far exceeds other queries, but definitely open to opinions.
You are right, ListQuery::default()
works, for some reason I didn't think of it.
I think I tried ListQuery{ ..Default::default() }
which understandably didn't work because the fields are private.
Cool. I'm gonna close this for now, but if you have any compelling thoughts on the ergonomics of common usage patterns, feel free to open an issue to discuss. Cheers!
I couldn't find another way to instantiate
ListQuery
from code that useskubeclient-rs
as the fields are private. Instead of making them public, implement simple constructor so it can be used like so: