UnversionedRESTClientFor is the same as RESTClientFor, except that it allows the config.Version to be empty.
(config *Config)
| 305 | // UnversionedRESTClientFor is the same as RESTClientFor, except that it allows |
| 306 | // the config.Version to be empty. |
| 307 | func UnversionedRESTClientFor(config *Config) (*RESTClient, error) { |
| 308 | if config.NegotiatedSerializer == nil { |
| 309 | return nil, fmt.Errorf("NegotiatedSerializer is required when initializing a RESTClient") |
| 310 | } |
| 311 | |
| 312 | baseURL, versionedAPIPath, err := defaultServerUrlFor(config) |
| 313 | if err != nil { |
| 314 | return nil, err |
| 315 | } |
| 316 | |
| 317 | transport, err := TransportFor(config) |
| 318 | if err != nil { |
| 319 | return nil, err |
| 320 | } |
| 321 | |
| 322 | var httpClient *http.Client |
| 323 | if transport != http.DefaultTransport { |
| 324 | httpClient = &http.Client{Transport: transport} |
| 325 | if config.Timeout > 0 { |
| 326 | httpClient.Timeout = config.Timeout |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | versionConfig := config.ContentConfig |
| 331 | if versionConfig.GroupVersion == nil { |
| 332 | v := metav1.SchemeGroupVersion |
| 333 | versionConfig.GroupVersion = &v |
| 334 | } |
| 335 | |
| 336 | return NewRESTClient(baseURL, versionedAPIPath, versionConfig, config.QPS, config.Burst, config.RateLimiter, httpClient) |
| 337 | } |
| 338 | |
| 339 | // SetKubernetesDefaults sets default values on the provided client config for accessing the |
| 340 | // Kubernetes API or returns an error if any of the defaults are impossible or invalid. |
nothing calls this directly
no test coverage detected