mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 13:12:20 +00:00
Make label and field selector query strings versionable.
This commit is contained in:
@@ -30,3 +30,22 @@ type APIVersions struct {
|
||||
type RootPaths struct {
|
||||
Paths []string `json:"paths"`
|
||||
}
|
||||
|
||||
// preV1Beta3 returns true if the provided API version is an API introduced before v1beta3.
|
||||
func PreV1Beta3(version string) bool {
|
||||
return version == "v1beta1" || version == "v1beta2"
|
||||
}
|
||||
|
||||
func LabelSelectorQueryParam(version string) string {
|
||||
if PreV1Beta3(version) {
|
||||
return "labels"
|
||||
}
|
||||
return "label-selector"
|
||||
}
|
||||
|
||||
func FieldSelectorQueryParam(version string) string {
|
||||
if PreV1Beta3(version) {
|
||||
return "fields"
|
||||
}
|
||||
return "field-selector"
|
||||
}
|
||||
|
Reference in New Issue
Block a user