Beispiel #1
0
// buildQueryValues is a convenience function for knowing if a namespace should be in a query param or not
func buildQueryValues(namespace string, query url.Values) url.Values {
	v := url.Values{}
	if query != nil {
		for key, values := range query {
			for _, value := range values {
				v.Add(key, value)
			}
		}
	}
	if len(namespace) > 0 {
		if api.PreV1Beta3(testapi.Version()) {
			v.Set("namespace", namespace)
		}
	}
	return v
}
Beispiel #2
0
// resourceName returns node's URL resource name based on resource version.
// Uses "minions" as the URL resource name for v1beta1 and v1beta2.
func (c *nodes) resourceName() string {
	if api.PreV1Beta3(c.r.APIVersion()) {
		return "minions"
	}
	return "nodes"
}
Beispiel #3
0
// Returns the appropriate field label to use for name of the involved object as per the given API version.
func getInvolvedObjectNameFieldLabel(version string) string {
	if api.PreV1Beta3(version) {
		return "involvedObject.id"
	}
	return "involvedObject.name"
}