Make label and field selector query strings versionable.

This commit is contained in:
Brendan Burns
2015-03-09 21:45:35 -07:00
parent 0aee25e065
commit 266234f3b9
22 changed files with 92 additions and 74 deletions

View File

@@ -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"
}