Exemplo n.º 1
0
// FromUnversionedClient adapts a unversioned.Client to a internalclientset.Clientset.
// This function is temporary. We will remove it when everyone has moved to using
// Clientset. New code should NOT use this function.
func FromUnversionedClient(c *unversioned.Client) *internalclientset.Clientset {
	var clientset internalclientset.Clientset
	if c != nil {
		clientset.CoreClient = unversionedcore.New(c.RESTClient)
	} else {
		clientset.CoreClient = unversionedcore.New(nil)
	}
	if c != nil && c.ExtensionsClient != nil {
		clientset.ExtensionsClient = unversionedextensions.New(c.ExtensionsClient.RESTClient)
	} else {
		clientset.ExtensionsClient = unversionedextensions.New(nil)
	}
	if c != nil && c.BatchClient != nil {
		clientset.BatchClient = unversionedbatch.New(c.BatchClient.RESTClient)
	} else {
		clientset.BatchClient = unversionedbatch.New(nil)
	}
	if c != nil && c.AuthorizationClient != nil {
		clientset.AuthorizationClient = unversionedauthorization.New(c.AuthorizationClient.RESTClient)
	} else {
		clientset.AuthorizationClient = unversionedauthorization.New(nil)
	}
	if c != nil && c.AutoscalingClient != nil {
		clientset.AutoscalingClient = unversionedautoscaling.New(c.AutoscalingClient.RESTClient)
	} else {
		clientset.AutoscalingClient = unversionedautoscaling.New(nil)
	}
	if c != nil && c.AuthenticationClient != nil {
		clientset.AuthenticationClient = unversionedauthentication.New(c.AuthenticationClient.RESTClient)
	} else {
		clientset.AuthenticationClient = unversionedauthentication.New(nil)
	}
	if c != nil && c.DiscoveryClient != nil {
		clientset.DiscoveryClient = discovery.NewDiscoveryClient(c.DiscoveryClient.RESTClient)
	} else {
		clientset.DiscoveryClient = discovery.NewDiscoveryClient(nil)
	}
	if c != nil && c.StorageClient != nil {
		clientset.StorageClient = unversionedstorage.New(c.StorageClient.RESTClient)
	} else {
		clientset.StorageClient = unversionedstorage.New(nil)
	}

	return &clientset
}
Exemplo n.º 2
0
// New creates a new Clientset for the given RESTClient.
func New(c *restclient.RESTClient) *Clientset {
	var clientset Clientset
	clientset.CoreClient = unversionedcore.New(c)
	clientset.AuthenticationClient = unversionedauthentication.New(c)
	clientset.AuthorizationClient = unversionedauthorization.New(c)
	clientset.AutoscalingClient = unversionedautoscaling.New(c)
	clientset.BatchClient = unversionedbatch.New(c)
	clientset.CertificatesClient = unversionedcertificates.New(c)
	clientset.ExtensionsClient = unversionedextensions.New(c)
	clientset.RbacClient = unversionedrbac.New(c)

	clientset.DiscoveryClient = discovery.NewDiscoveryClient(c)
	return &clientset
}
Exemplo n.º 3
0
// New creates a new Clientset for the given RESTClient.
func New(c restclient.Interface) *Clientset {
	var clientset Clientset
	clientset.CoreClient = unversionedcore.New(c)
	clientset.AuthenticationClient = unversionedauthentication.New(c)
	clientset.AuthorizationClient = unversionedauthorization.New(c)
	clientset.AutoscalingClient = unversionedautoscaling.New(c)
	clientset.BatchClient = unversionedbatch.New(c)
	clientset.CertificatesClient = unversionedcertificates.New(c)
	clientset.ExtensionsClient = unversionedextensions.New(c)
	clientset.RbacClient = unversionedrbac.New(c)
	clientset.StorageClient = unversionedstorage.New(c)
	clientset.AppsClient = unversionedapps.New(c)
	clientset.PolicyClient = unversionedpolicy.New(c)

	clientset.DiscoveryClient = discovery.NewDiscoveryClient(c)
	return &clientset
}