Move restclient to its own package
This commit is contained in:
@@ -28,7 +28,7 @@ import (
|
||||
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
"k8s.io/kubernetes/pkg/client/restclient"
|
||||
"k8s.io/kubernetes/pkg/conversion/queryparams"
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
"k8s.io/kubernetes/pkg/watch"
|
||||
@@ -37,12 +37,12 @@ import (
|
||||
// Client is a Kubernetes client that allows you to access metadata
|
||||
// and manipulate metadata of a Kubernetes API group.
|
||||
type Client struct {
|
||||
cl *client.RESTClient
|
||||
cl *restclient.RESTClient
|
||||
}
|
||||
|
||||
// NewClient returns a new client based on the passed in config. The
|
||||
// codec is ignored, as the dynamic client uses it's own codec.
|
||||
func NewClient(conf *client.Config) (*Client, error) {
|
||||
func NewClient(conf *restclient.Config) (*Client, error) {
|
||||
// avoid changing the original config
|
||||
confCopy := *conf
|
||||
conf = &confCopy
|
||||
@@ -54,7 +54,7 @@ func NewClient(conf *client.Config) (*Client, error) {
|
||||
}
|
||||
|
||||
if len(conf.UserAgent) == 0 {
|
||||
conf.UserAgent = client.DefaultKubernetesUserAgent()
|
||||
conf.UserAgent = restclient.DefaultKubernetesUserAgent()
|
||||
}
|
||||
|
||||
if conf.QPS == 0.0 {
|
||||
@@ -64,7 +64,7 @@ func NewClient(conf *client.Config) (*Client, error) {
|
||||
conf.Burst = 10
|
||||
}
|
||||
|
||||
cl, err := client.RESTClientFor(conf)
|
||||
cl, err := restclient.RESTClientFor(conf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -86,7 +86,7 @@ func (c *Client) Resource(resource *unversioned.APIResource, namespace string) *
|
||||
// ResourceClient is an API interface to a specific resource under a
|
||||
// dynamic client.
|
||||
type ResourceClient struct {
|
||||
cl *client.RESTClient
|
||||
cl *restclient.RESTClient
|
||||
resource *unversioned.APIResource
|
||||
ns string
|
||||
}
|
||||
@@ -94,7 +94,7 @@ type ResourceClient struct {
|
||||
// namespace applies a namespace to the request if the configured
|
||||
// resource is a namespaced resource. Otherwise, it just returns the
|
||||
// passed in request.
|
||||
func (rc *ResourceClient) namespace(req *client.Request) *client.Request {
|
||||
func (rc *ResourceClient) namespace(req *restclient.Request) *restclient.Request {
|
||||
if rc.resource.Namespaced {
|
||||
return req.Namespace(rc.ns)
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ import (
|
||||
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
"k8s.io/kubernetes/pkg/client/restclient"
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
"k8s.io/kubernetes/pkg/watch"
|
||||
watchjson "k8s.io/kubernetes/pkg/watch/json"
|
||||
@@ -62,9 +62,9 @@ func getObject(version, kind, name string) *runtime.Unstructured {
|
||||
|
||||
func getClientServer(gv *unversioned.GroupVersion, h func(http.ResponseWriter, *http.Request)) (*Client, *httptest.Server, error) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(h))
|
||||
cl, err := NewClient(&client.Config{
|
||||
cl, err := NewClient(&restclient.Config{
|
||||
Host: srv.URL,
|
||||
ContentConfig: client.ContentConfig{GroupVersion: gv},
|
||||
ContentConfig: restclient.ContentConfig{GroupVersion: gv},
|
||||
})
|
||||
if err != nil {
|
||||
srv.Close()
|
||||
|
@@ -19,7 +19,7 @@ package unversioned
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
registered "k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||
unversioned "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||
)
|
||||
|
||||
type CoreInterface interface {
|
||||
@@ -43,7 +43,7 @@ type CoreInterface interface {
|
||||
|
||||
// CoreClient is used to interact with features provided by the Core group.
|
||||
type CoreClient struct {
|
||||
*unversioned.RESTClient
|
||||
*restclient.RESTClient
|
||||
}
|
||||
|
||||
func (c *CoreClient) ComponentStatuses() ComponentStatusInterface {
|
||||
@@ -111,12 +111,12 @@ func (c *CoreClient) ServiceAccounts(namespace string) ServiceAccountInterface {
|
||||
}
|
||||
|
||||
// NewForConfig creates a new CoreClient for the given config.
|
||||
func NewForConfig(c *unversioned.Config) (*CoreClient, error) {
|
||||
func NewForConfig(c *restclient.Config) (*CoreClient, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := unversioned.RESTClientFor(&config)
|
||||
client, err := restclient.RESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -125,7 +125,7 @@ func NewForConfig(c *unversioned.Config) (*CoreClient, error) {
|
||||
|
||||
// NewForConfigOrDie creates a new CoreClient for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *unversioned.Config) *CoreClient {
|
||||
func NewForConfigOrDie(c *restclient.Config) *CoreClient {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -134,11 +134,11 @@ func NewForConfigOrDie(c *unversioned.Config) *CoreClient {
|
||||
}
|
||||
|
||||
// New creates a new CoreClient for the given RESTClient.
|
||||
func New(c *unversioned.RESTClient) *CoreClient {
|
||||
func New(c *restclient.RESTClient) *CoreClient {
|
||||
return &CoreClient{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *unversioned.Config) error {
|
||||
func setConfigDefaults(config *restclient.Config) error {
|
||||
// if core group is not registered, return an error
|
||||
g, err := registered.Group("")
|
||||
if err != nil {
|
||||
@@ -146,7 +146,7 @@ func setConfigDefaults(config *unversioned.Config) error {
|
||||
}
|
||||
config.APIPath = "/api"
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = unversioned.DefaultKubernetesUserAgent()
|
||||
config.UserAgent = restclient.DefaultKubernetesUserAgent()
|
||||
}
|
||||
// TODO: Unconditionally set the config.Version, until we fix the config.
|
||||
//if config.Version == "" {
|
||||
|
@@ -18,8 +18,8 @@ package fake
|
||||
|
||||
import (
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/client/restclient"
|
||||
"k8s.io/kubernetes/pkg/client/testing/core"
|
||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
)
|
||||
|
||||
func (c *FakePods) Bind(binding *api.Binding) error {
|
||||
@@ -33,7 +33,7 @@ func (c *FakePods) Bind(binding *api.Binding) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakePods) GetLogs(name string, opts *api.PodLogOptions) *client.Request {
|
||||
func (c *FakePods) GetLogs(name string, opts *api.PodLogOptions) *restclient.Request {
|
||||
action := core.GenericActionImpl{}
|
||||
action.Verb = "get"
|
||||
action.Namespace = c.ns
|
||||
@@ -42,5 +42,5 @@ func (c *FakePods) GetLogs(name string, opts *api.PodLogOptions) *client.Request
|
||||
action.Value = opts
|
||||
|
||||
_, _ = c.Fake.Invokes(action, &api.Pod{})
|
||||
return &client.Request{}
|
||||
return &restclient.Request{}
|
||||
}
|
||||
|
@@ -17,10 +17,10 @@ limitations under the License.
|
||||
package fake
|
||||
|
||||
import (
|
||||
"k8s.io/kubernetes/pkg/client/restclient"
|
||||
"k8s.io/kubernetes/pkg/client/testing/core"
|
||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
)
|
||||
|
||||
func (c *FakeServices) ProxyGet(scheme, name, port, path string, params map[string]string) client.ResponseWrapper {
|
||||
func (c *FakeServices) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper {
|
||||
return c.Fake.InvokesProxy(core.NewProxyGetAction("services", c.ns, scheme, name, port, path, params))
|
||||
}
|
||||
|
@@ -18,13 +18,13 @@ package unversioned
|
||||
|
||||
import (
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
unversioned "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
"k8s.io/kubernetes/pkg/client/restclient"
|
||||
)
|
||||
|
||||
// The PodExpansion interface allows manually adding extra methods to the PodInterface.
|
||||
type PodExpansion interface {
|
||||
Bind(binding *api.Binding) error
|
||||
GetLogs(name string, opts *api.PodLogOptions) *unversioned.Request
|
||||
GetLogs(name string, opts *api.PodLogOptions) *restclient.Request
|
||||
}
|
||||
|
||||
// Bind applies the provided binding to the named pod in the current namespace (binding.Namespace is ignored).
|
||||
@@ -33,6 +33,6 @@ func (c *pods) Bind(binding *api.Binding) error {
|
||||
}
|
||||
|
||||
// Get constructs a request for getting the logs for a pod
|
||||
func (c *pods) GetLogs(name string, opts *api.PodLogOptions) *unversioned.Request {
|
||||
func (c *pods) GetLogs(name string, opts *api.PodLogOptions) *restclient.Request {
|
||||
return c.client.Get().Namespace(c.ns).Name(name).Resource("pods").SubResource("log").VersionedParams(opts, api.ParameterCodec)
|
||||
}
|
||||
|
@@ -17,17 +17,17 @@ limitations under the License.
|
||||
package unversioned
|
||||
|
||||
import (
|
||||
"k8s.io/kubernetes/pkg/client/unversioned"
|
||||
"k8s.io/kubernetes/pkg/client/restclient"
|
||||
"k8s.io/kubernetes/pkg/util/net"
|
||||
)
|
||||
|
||||
// The ServiceExpansion interface allows manually adding extra methods to the ServiceInterface.
|
||||
type ServiceExpansion interface {
|
||||
ProxyGet(scheme, name, port, path string, params map[string]string) unversioned.ResponseWrapper
|
||||
ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper
|
||||
}
|
||||
|
||||
// ProxyGet returns a response of the service by calling it through the proxy.
|
||||
func (c *services) ProxyGet(scheme, name, port, path string, params map[string]string) unversioned.ResponseWrapper {
|
||||
func (c *services) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper {
|
||||
request := c.client.Get().
|
||||
Prefix("proxy").
|
||||
Namespace(c.ns).
|
||||
|
@@ -19,7 +19,7 @@ package v1
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
registered "k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||
unversioned "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||
)
|
||||
|
||||
type CoreInterface interface {
|
||||
@@ -42,7 +42,7 @@ type CoreInterface interface {
|
||||
|
||||
// CoreClient is used to interact with features provided by the Core group.
|
||||
type CoreClient struct {
|
||||
*unversioned.RESTClient
|
||||
*restclient.RESTClient
|
||||
}
|
||||
|
||||
func (c *CoreClient) ComponentStatuses() ComponentStatusInterface {
|
||||
@@ -106,12 +106,12 @@ func (c *CoreClient) ServiceAccounts(namespace string) ServiceAccountInterface {
|
||||
}
|
||||
|
||||
// NewForConfig creates a new CoreClient for the given config.
|
||||
func NewForConfig(c *unversioned.Config) (*CoreClient, error) {
|
||||
func NewForConfig(c *restclient.Config) (*CoreClient, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := unversioned.RESTClientFor(&config)
|
||||
client, err := restclient.RESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -120,7 +120,7 @@ func NewForConfig(c *unversioned.Config) (*CoreClient, error) {
|
||||
|
||||
// NewForConfigOrDie creates a new CoreClient for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *unversioned.Config) *CoreClient {
|
||||
func NewForConfigOrDie(c *restclient.Config) *CoreClient {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -129,11 +129,11 @@ func NewForConfigOrDie(c *unversioned.Config) *CoreClient {
|
||||
}
|
||||
|
||||
// New creates a new CoreClient for the given RESTClient.
|
||||
func New(c *unversioned.RESTClient) *CoreClient {
|
||||
func New(c *restclient.RESTClient) *CoreClient {
|
||||
return &CoreClient{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *unversioned.Config) error {
|
||||
func setConfigDefaults(config *restclient.Config) error {
|
||||
// if core group is not registered, return an error
|
||||
g, err := registered.Group("")
|
||||
if err != nil {
|
||||
@@ -141,7 +141,7 @@ func setConfigDefaults(config *unversioned.Config) error {
|
||||
}
|
||||
config.APIPath = "/api"
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = unversioned.DefaultKubernetesUserAgent()
|
||||
config.UserAgent = restclient.DefaultKubernetesUserAgent()
|
||||
}
|
||||
// TODO: Unconditionally set the config.Version, until we fix the config.
|
||||
//if config.Version == "" {
|
||||
|
@@ -18,8 +18,8 @@ package fake
|
||||
|
||||
import (
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
"k8s.io/kubernetes/pkg/client/restclient"
|
||||
"k8s.io/kubernetes/pkg/client/testing/core"
|
||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
)
|
||||
|
||||
func (c *FakePods) Bind(binding *v1.Binding) error {
|
||||
@@ -33,7 +33,7 @@ func (c *FakePods) Bind(binding *v1.Binding) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakePods) GetLogs(name string, opts *v1.PodLogOptions) *client.Request {
|
||||
func (c *FakePods) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request {
|
||||
action := core.GenericActionImpl{}
|
||||
action.Verb = "get"
|
||||
action.Namespace = c.ns
|
||||
@@ -42,5 +42,5 @@ func (c *FakePods) GetLogs(name string, opts *v1.PodLogOptions) *client.Request
|
||||
action.Value = opts
|
||||
|
||||
_, _ = c.Fake.Invokes(action, &v1.Pod{})
|
||||
return &client.Request{}
|
||||
return &restclient.Request{}
|
||||
}
|
||||
|
@@ -17,10 +17,10 @@ limitations under the License.
|
||||
package fake
|
||||
|
||||
import (
|
||||
"k8s.io/kubernetes/pkg/client/restclient"
|
||||
"k8s.io/kubernetes/pkg/client/testing/core"
|
||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
)
|
||||
|
||||
func (c *FakeServices) ProxyGet(scheme, name, port, path string, params map[string]string) client.ResponseWrapper {
|
||||
func (c *FakeServices) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper {
|
||||
return c.Fake.InvokesProxy(core.NewProxyGetAction("services", c.ns, scheme, name, port, path, params))
|
||||
}
|
||||
|
@@ -19,13 +19,13 @@ package v1
|
||||
import (
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
unversioned "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
"k8s.io/kubernetes/pkg/client/restclient"
|
||||
)
|
||||
|
||||
// The PodExpansion interface allows manually adding extra methods to the PodInterface.
|
||||
type PodExpansion interface {
|
||||
Bind(binding *v1.Binding) error
|
||||
GetLogs(name string, opts *v1.PodLogOptions) *unversioned.Request
|
||||
GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request
|
||||
}
|
||||
|
||||
// Bind applies the provided binding to the named pod in the current namespace (binding.Namespace is ignored).
|
||||
@@ -34,6 +34,6 @@ func (c *pods) Bind(binding *v1.Binding) error {
|
||||
}
|
||||
|
||||
// Get constructs a request for getting the logs for a pod
|
||||
func (c *pods) GetLogs(name string, opts *v1.PodLogOptions) *unversioned.Request {
|
||||
func (c *pods) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request {
|
||||
return c.client.Get().Namespace(c.ns).Name(name).Resource("pods").SubResource("log").VersionedParams(opts, api.ParameterCodec)
|
||||
}
|
||||
|
@@ -17,17 +17,17 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
"k8s.io/kubernetes/pkg/client/unversioned"
|
||||
"k8s.io/kubernetes/pkg/client/restclient"
|
||||
"k8s.io/kubernetes/pkg/util/net"
|
||||
)
|
||||
|
||||
// The ServiceExpansion interface allows manually adding extra methods to the ServiceInterface.
|
||||
type ServiceExpansion interface {
|
||||
ProxyGet(scheme, name, port, path string, params map[string]string) unversioned.ResponseWrapper
|
||||
ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper
|
||||
}
|
||||
|
||||
// ProxyGet returns a response of the service by calling it through the proxy.
|
||||
func (c *services) ProxyGet(scheme, name, port, path string, params map[string]string) unversioned.ResponseWrapper {
|
||||
func (c *services) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper {
|
||||
request := c.client.Get().
|
||||
Prefix("proxy").
|
||||
Namespace(c.ns).
|
||||
|
@@ -19,7 +19,7 @@ package unversioned
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
registered "k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||
unversioned "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||
)
|
||||
|
||||
type ExtensionsInterface interface {
|
||||
@@ -35,7 +35,7 @@ type ExtensionsInterface interface {
|
||||
|
||||
// ExtensionsClient is used to interact with features provided by the Extensions group.
|
||||
type ExtensionsClient struct {
|
||||
*unversioned.RESTClient
|
||||
*restclient.RESTClient
|
||||
}
|
||||
|
||||
func (c *ExtensionsClient) DaemonSets(namespace string) DaemonSetInterface {
|
||||
@@ -71,12 +71,12 @@ func (c *ExtensionsClient) ThirdPartyResources(namespace string) ThirdPartyResou
|
||||
}
|
||||
|
||||
// NewForConfig creates a new ExtensionsClient for the given config.
|
||||
func NewForConfig(c *unversioned.Config) (*ExtensionsClient, error) {
|
||||
func NewForConfig(c *restclient.Config) (*ExtensionsClient, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := unversioned.RESTClientFor(&config)
|
||||
client, err := restclient.RESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -85,7 +85,7 @@ func NewForConfig(c *unversioned.Config) (*ExtensionsClient, error) {
|
||||
|
||||
// NewForConfigOrDie creates a new ExtensionsClient for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *unversioned.Config) *ExtensionsClient {
|
||||
func NewForConfigOrDie(c *restclient.Config) *ExtensionsClient {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -94,11 +94,11 @@ func NewForConfigOrDie(c *unversioned.Config) *ExtensionsClient {
|
||||
}
|
||||
|
||||
// New creates a new ExtensionsClient for the given RESTClient.
|
||||
func New(c *unversioned.RESTClient) *ExtensionsClient {
|
||||
func New(c *restclient.RESTClient) *ExtensionsClient {
|
||||
return &ExtensionsClient{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *unversioned.Config) error {
|
||||
func setConfigDefaults(config *restclient.Config) error {
|
||||
// if extensions group is not registered, return an error
|
||||
g, err := registered.Group("extensions")
|
||||
if err != nil {
|
||||
@@ -106,7 +106,7 @@ func setConfigDefaults(config *unversioned.Config) error {
|
||||
}
|
||||
config.APIPath = "/apis"
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = unversioned.DefaultKubernetesUserAgent()
|
||||
config.UserAgent = restclient.DefaultKubernetesUserAgent()
|
||||
}
|
||||
// TODO: Unconditionally set the config.Version, until we fix the config.
|
||||
//if config.Version == "" {
|
||||
|
@@ -19,7 +19,7 @@ package v1beta1
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
registered "k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||
unversioned "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||
)
|
||||
|
||||
type ExtensionsInterface interface {
|
||||
@@ -35,7 +35,7 @@ type ExtensionsInterface interface {
|
||||
|
||||
// ExtensionsClient is used to interact with features provided by the Extensions group.
|
||||
type ExtensionsClient struct {
|
||||
*unversioned.RESTClient
|
||||
*restclient.RESTClient
|
||||
}
|
||||
|
||||
func (c *ExtensionsClient) DaemonSets(namespace string) DaemonSetInterface {
|
||||
@@ -71,12 +71,12 @@ func (c *ExtensionsClient) ThirdPartyResources(namespace string) ThirdPartyResou
|
||||
}
|
||||
|
||||
// NewForConfig creates a new ExtensionsClient for the given config.
|
||||
func NewForConfig(c *unversioned.Config) (*ExtensionsClient, error) {
|
||||
func NewForConfig(c *restclient.Config) (*ExtensionsClient, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := unversioned.RESTClientFor(&config)
|
||||
client, err := restclient.RESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -85,7 +85,7 @@ func NewForConfig(c *unversioned.Config) (*ExtensionsClient, error) {
|
||||
|
||||
// NewForConfigOrDie creates a new ExtensionsClient for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *unversioned.Config) *ExtensionsClient {
|
||||
func NewForConfigOrDie(c *restclient.Config) *ExtensionsClient {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -94,11 +94,11 @@ func NewForConfigOrDie(c *unversioned.Config) *ExtensionsClient {
|
||||
}
|
||||
|
||||
// New creates a new ExtensionsClient for the given RESTClient.
|
||||
func New(c *unversioned.RESTClient) *ExtensionsClient {
|
||||
func New(c *restclient.RESTClient) *ExtensionsClient {
|
||||
return &ExtensionsClient{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *unversioned.Config) error {
|
||||
func setConfigDefaults(config *restclient.Config) error {
|
||||
// if extensions group is not registered, return an error
|
||||
g, err := registered.Group("extensions")
|
||||
if err != nil {
|
||||
@@ -106,7 +106,7 @@ func setConfigDefaults(config *unversioned.Config) error {
|
||||
}
|
||||
config.APIPath = "/apis"
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = unversioned.DefaultKubernetesUserAgent()
|
||||
config.UserAgent = restclient.DefaultKubernetesUserAgent()
|
||||
}
|
||||
// TODO: Unconditionally set the config.Version, until we fix the config.
|
||||
//if config.Version == "" {
|
||||
|
Reference in New Issue
Block a user