forked from kubernetes/client-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
379 changed files
with
20,753 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package versioned | ||
|
||
import ( | ||
glog "github.com/golang/glog" | ||
appsv1 "github.com/openshift/client-go/apps/clientset/versioned/typed/apps/v1" | ||
discovery "k8s.io/client-go/discovery" | ||
rest "k8s.io/client-go/rest" | ||
flowcontrol "k8s.io/client-go/util/flowcontrol" | ||
) | ||
|
||
type Interface interface { | ||
Discovery() discovery.DiscoveryInterface | ||
AppsV1() appsv1.AppsV1Interface | ||
// Deprecated: please explicitly pick a version if possible. | ||
Apps() appsv1.AppsV1Interface | ||
} | ||
|
||
// Clientset contains the clients for groups. Each group has exactly one | ||
// version included in a Clientset. | ||
type Clientset struct { | ||
*discovery.DiscoveryClient | ||
appsV1 *appsv1.AppsV1Client | ||
} | ||
|
||
// AppsV1 retrieves the AppsV1Client | ||
func (c *Clientset) AppsV1() appsv1.AppsV1Interface { | ||
return c.appsV1 | ||
} | ||
|
||
// Deprecated: Apps retrieves the default version of AppsClient. | ||
// Please explicitly pick a version. | ||
func (c *Clientset) Apps() appsv1.AppsV1Interface { | ||
return c.appsV1 | ||
} | ||
|
||
// Discovery retrieves the DiscoveryClient | ||
func (c *Clientset) Discovery() discovery.DiscoveryInterface { | ||
if c == nil { | ||
return nil | ||
} | ||
return c.DiscoveryClient | ||
} | ||
|
||
// NewForConfig creates a new Clientset for the given config. | ||
func NewForConfig(c *rest.Config) (*Clientset, error) { | ||
configShallowCopy := *c | ||
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { | ||
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) | ||
} | ||
var cs Clientset | ||
var err error | ||
cs.appsV1, err = appsv1.NewForConfig(&configShallowCopy) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) | ||
if err != nil { | ||
glog.Errorf("failed to create the DiscoveryClient: %v", err) | ||
return nil, err | ||
} | ||
return &cs, nil | ||
} | ||
|
||
// NewForConfigOrDie creates a new Clientset for the given config and | ||
// panics if there is an error in the config. | ||
func NewForConfigOrDie(c *rest.Config) *Clientset { | ||
var cs Clientset | ||
cs.appsV1 = appsv1.NewForConfigOrDie(c) | ||
|
||
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) | ||
return &cs | ||
} | ||
|
||
// New creates a new Clientset for the given RESTClient. | ||
func New(c rest.Interface) *Clientset { | ||
var cs Clientset | ||
cs.appsV1 = appsv1.New(c) | ||
|
||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c) | ||
return &cs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// This package is generated by client-gen with custom arguments. | ||
|
||
// This package has the automatically generated clientset. | ||
package versioned |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package fake | ||
|
||
import ( | ||
clientset "github.com/openshift/client-go/apps/clientset/versioned" | ||
appsv1 "github.com/openshift/client-go/apps/clientset/versioned/typed/apps/v1" | ||
fakeappsv1 "github.com/openshift/client-go/apps/clientset/versioned/typed/apps/v1/fake" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/watch" | ||
"k8s.io/client-go/discovery" | ||
fakediscovery "k8s.io/client-go/discovery/fake" | ||
"k8s.io/client-go/testing" | ||
) | ||
|
||
// NewSimpleClientset returns a clientset that will respond with the provided objects. | ||
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, | ||
// without applying any validations and/or defaults. It shouldn't be considered a replacement | ||
// for a real clientset and is mostly useful in simple unit tests. | ||
func NewSimpleClientset(objects ...runtime.Object) *Clientset { | ||
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) | ||
for _, obj := range objects { | ||
if err := o.Add(obj); err != nil { | ||
panic(err) | ||
} | ||
} | ||
|
||
fakePtr := testing.Fake{} | ||
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) | ||
fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) | ||
|
||
return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} | ||
} | ||
|
||
// Clientset implements clientset.Interface. Meant to be embedded into a | ||
// struct to get a default implementation. This makes faking out just the method | ||
// you want to test easier. | ||
type Clientset struct { | ||
testing.Fake | ||
discovery *fakediscovery.FakeDiscovery | ||
} | ||
|
||
func (c *Clientset) Discovery() discovery.DiscoveryInterface { | ||
return c.discovery | ||
} | ||
|
||
var _ clientset.Interface = &Clientset{} | ||
|
||
// AppsV1 retrieves the AppsV1Client | ||
func (c *Clientset) AppsV1() appsv1.AppsV1Interface { | ||
return &fakeappsv1.FakeAppsV1{Fake: &c.Fake} | ||
} | ||
|
||
// Apps retrieves the AppsV1Client | ||
func (c *Clientset) Apps() appsv1.AppsV1Interface { | ||
return &fakeappsv1.FakeAppsV1{Fake: &c.Fake} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// This package is generated by client-gen with custom arguments. | ||
|
||
// This package has the automatically generated fake clientset. | ||
package fake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package fake | ||
|
||
import ( | ||
appsv1 "github.com/openshift/api/apps/v1" | ||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
runtime "k8s.io/apimachinery/pkg/runtime" | ||
schema "k8s.io/apimachinery/pkg/runtime/schema" | ||
serializer "k8s.io/apimachinery/pkg/runtime/serializer" | ||
) | ||
|
||
var scheme = runtime.NewScheme() | ||
var codecs = serializer.NewCodecFactory(scheme) | ||
var parameterCodec = runtime.NewParameterCodec(scheme) | ||
|
||
func init() { | ||
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) | ||
AddToScheme(scheme) | ||
} | ||
|
||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition | ||
// of clientsets, like in: | ||
// | ||
// import ( | ||
// "k8s.io/client-go/kubernetes" | ||
// clientsetscheme "k8s.io/client-go/kuberentes/scheme" | ||
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" | ||
// ) | ||
// | ||
// kclientset, _ := kubernetes.NewForConfig(c) | ||
// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) | ||
// | ||
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types | ||
// correctly. | ||
func AddToScheme(scheme *runtime.Scheme) { | ||
appsv1.AddToScheme(scheme) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// This package is generated by client-gen with custom arguments. | ||
|
||
// This package contains the scheme of the automatically generated clientset. | ||
package scheme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package scheme | ||
|
||
import ( | ||
appsv1 "github.com/openshift/api/apps/v1" | ||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
runtime "k8s.io/apimachinery/pkg/runtime" | ||
schema "k8s.io/apimachinery/pkg/runtime/schema" | ||
serializer "k8s.io/apimachinery/pkg/runtime/serializer" | ||
) | ||
|
||
var Scheme = runtime.NewScheme() | ||
var Codecs = serializer.NewCodecFactory(Scheme) | ||
var ParameterCodec = runtime.NewParameterCodec(Scheme) | ||
|
||
func init() { | ||
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) | ||
AddToScheme(Scheme) | ||
} | ||
|
||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition | ||
// of clientsets, like in: | ||
// | ||
// import ( | ||
// "k8s.io/client-go/kubernetes" | ||
// clientsetscheme "k8s.io/client-go/kuberentes/scheme" | ||
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" | ||
// ) | ||
// | ||
// kclientset, _ := kubernetes.NewForConfig(c) | ||
// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) | ||
// | ||
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types | ||
// correctly. | ||
func AddToScheme(scheme *runtime.Scheme) { | ||
appsv1.AddToScheme(scheme) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package v1 | ||
|
||
import ( | ||
v1 "github.com/openshift/api/apps/v1" | ||
"github.com/openshift/client-go/apps/clientset/versioned/scheme" | ||
serializer "k8s.io/apimachinery/pkg/runtime/serializer" | ||
rest "k8s.io/client-go/rest" | ||
) | ||
|
||
type AppsV1Interface interface { | ||
RESTClient() rest.Interface | ||
DeploymentConfigsGetter | ||
} | ||
|
||
// AppsV1Client is used to interact with features provided by the apps.openshift.io group. | ||
type AppsV1Client struct { | ||
restClient rest.Interface | ||
} | ||
|
||
func (c *AppsV1Client) DeploymentConfigs(namespace string) DeploymentConfigInterface { | ||
return newDeploymentConfigs(c, namespace) | ||
} | ||
|
||
// NewForConfig creates a new AppsV1Client for the given config. | ||
func NewForConfig(c *rest.Config) (*AppsV1Client, error) { | ||
config := *c | ||
if err := setConfigDefaults(&config); err != nil { | ||
return nil, err | ||
} | ||
client, err := rest.RESTClientFor(&config) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &AppsV1Client{client}, nil | ||
} | ||
|
||
// NewForConfigOrDie creates a new AppsV1Client for the given config and | ||
// panics if there is an error in the config. | ||
func NewForConfigOrDie(c *rest.Config) *AppsV1Client { | ||
client, err := NewForConfig(c) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return client | ||
} | ||
|
||
// New creates a new AppsV1Client for the given RESTClient. | ||
func New(c rest.Interface) *AppsV1Client { | ||
return &AppsV1Client{c} | ||
} | ||
|
||
func setConfigDefaults(config *rest.Config) error { | ||
gv := v1.SchemeGroupVersion | ||
config.GroupVersion = &gv | ||
config.APIPath = "/apis" | ||
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} | ||
|
||
if config.UserAgent == "" { | ||
config.UserAgent = rest.DefaultKubernetesUserAgent() | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// RESTClient returns a RESTClient that is used to communicate | ||
// with API server by this client implementation. | ||
func (c *AppsV1Client) RESTClient() rest.Interface { | ||
if c == nil { | ||
return nil | ||
} | ||
return c.restClient | ||
} |
Oops, something went wrong.