Add clientset generated code

This commit is contained in:
Justin Santa Barbara 2017-05-22 10:40:25 -04:00
parent e945322cab
commit 9ff3a7be64
80 changed files with 6896 additions and 0 deletions

View File

@ -0,0 +1,127 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package clientset
import (
glog "github.com/golang/glog"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"
kopsinternalversion "k8s.io/kops/pkg/client/clientset_generated/clientset/typed/kops/internalversion"
kopsv1alpha1 "k8s.io/kops/pkg/client/clientset_generated/clientset/typed/kops/v1alpha1"
kopsv1alpha2 "k8s.io/kops/pkg/client/clientset_generated/clientset/typed/kops/v1alpha2"
)
type Interface interface {
Discovery() discovery.DiscoveryInterface
Kops() kopsinternalversion.KopsInterface
KopsV1alpha1() kopsv1alpha1.KopsV1alpha1Interface
KopsV1alpha2() kopsv1alpha2.KopsV1alpha2Interface
}
// Clientset contains the clients for groups. Each group has exactly one
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
*kopsinternalversion.KopsClient
*kopsv1alpha1.KopsV1alpha1Client
*kopsv1alpha2.KopsV1alpha2Client
}
// Kops retrieves the KopsClient
func (c *Clientset) Kops() kopsinternalversion.KopsInterface {
if c == nil {
return nil
}
return c.KopsClient
}
// KopsV1alpha1 retrieves the KopsV1alpha1Client
func (c *Clientset) KopsV1alpha1() kopsv1alpha1.KopsV1alpha1Interface {
if c == nil {
return nil
}
return c.KopsV1alpha1Client
}
// KopsV1alpha2 retrieves the KopsV1alpha2Client
func (c *Clientset) KopsV1alpha2() kopsv1alpha2.KopsV1alpha2Interface {
if c == nil {
return nil
}
return c.KopsV1alpha2Client
}
// 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.KopsClient, err = kopsinternalversion.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.KopsV1alpha1Client, err = kopsv1alpha1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.KopsV1alpha2Client, err = kopsv1alpha2.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.KopsClient = kopsinternalversion.NewForConfigOrDie(c)
cs.KopsV1alpha1Client = kopsv1alpha1.NewForConfigOrDie(c)
cs.KopsV1alpha2Client = kopsv1alpha2.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.KopsClient = kopsinternalversion.New(c)
cs.KopsV1alpha1Client = kopsv1alpha1.New(c)
cs.KopsV1alpha2Client = kopsv1alpha2.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &cs
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// This package has the automatically generated clientset.
package clientset

View File

@ -0,0 +1,80 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
"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"
clientset "k8s.io/kops/pkg/client/clientset_generated/clientset"
kopsinternalversion "k8s.io/kops/pkg/client/clientset_generated/clientset/typed/kops/internalversion"
fakekopsinternalversion "k8s.io/kops/pkg/client/clientset_generated/clientset/typed/kops/internalversion/fake"
kopsv1alpha1 "k8s.io/kops/pkg/client/clientset_generated/clientset/typed/kops/v1alpha1"
fakekopsv1alpha1 "k8s.io/kops/pkg/client/clientset_generated/clientset/typed/kops/v1alpha1/fake"
kopsv1alpha2 "k8s.io/kops/pkg/client/clientset_generated/clientset/typed/kops/v1alpha2"
fakekopsv1alpha2 "k8s.io/kops/pkg/client/clientset_generated/clientset/typed/kops/v1alpha2/fake"
)
// 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(registry, scheme, codecs.UniversalDecoder())
for _, obj := range objects {
if err := o.Add(obj); err != nil {
panic(err)
}
}
fakePtr := testing.Fake{}
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o, registry.RESTMapper()))
fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil))
return &Clientset{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
}
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
return &fakediscovery.FakeDiscovery{Fake: &c.Fake}
}
var _ clientset.Interface = &Clientset{}
// Kops retrieves the KopsClient
func (c *Clientset) Kops() kopsinternalversion.KopsInterface {
return &fakekopsinternalversion.FakeKops{Fake: &c.Fake}
}
// KopsV1alpha1 retrieves the KopsV1alpha1Client
func (c *Clientset) KopsV1alpha1() kopsv1alpha1.KopsV1alpha1Interface {
return &fakekopsv1alpha1.FakeKopsV1alpha1{Fake: &c.Fake}
}
// KopsV1alpha2 retrieves the KopsV1alpha2Client
func (c *Clientset) KopsV1alpha2() kopsv1alpha2.KopsV1alpha2Interface {
return &fakekopsv1alpha2.FakeKopsV1alpha2{Fake: &c.Fake}
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// This package has the automatically generated fake clientset.
package fake

View File

@ -0,0 +1,46 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
announced "k8s.io/apimachinery/pkg/apimachinery/announced"
registered "k8s.io/apimachinery/pkg/apimachinery/registered"
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"
kops "k8s.io/kops/pkg/apis/kops/install"
os "os"
)
var scheme = runtime.NewScheme()
var codecs = serializer.NewCodecFactory(scheme)
var parameterCodec = runtime.NewParameterCodec(scheme)
var registry = registered.NewOrDie(os.Getenv("KUBE_API_VERSIONS"))
var groupFactoryRegistry = make(announced.APIGroupFactoryRegistry)
func init() {
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
Install(groupFactoryRegistry, registry, scheme)
}
// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
kops.Install(groupFactoryRegistry, registry, scheme)
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// This package contains the scheme of the automatically generated clientset.
package scheme

View File

@ -0,0 +1,46 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package scheme
import (
announced "k8s.io/apimachinery/pkg/apimachinery/announced"
registered "k8s.io/apimachinery/pkg/apimachinery/registered"
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"
kops "k8s.io/kops/pkg/apis/kops/install"
os "os"
)
var Scheme = runtime.NewScheme()
var Codecs = serializer.NewCodecFactory(Scheme)
var ParameterCodec = runtime.NewParameterCodec(Scheme)
var Registry = registered.NewOrDie(os.Getenv("KUBE_API_VERSIONS"))
var GroupFactoryRegistry = make(announced.APIGroupFactoryRegistry)
func init() {
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
Install(GroupFactoryRegistry, Registry, Scheme)
}
// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
kops.Install(groupFactoryRegistry, registry, scheme)
}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package internalversion
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
kops "k8s.io/kops/pkg/apis/kops"
scheme "k8s.io/kops/pkg/client/clientset_generated/clientset/scheme"
)
// ClustersGetter has a method to return a ClusterInterface.
// A group's client should implement this interface.
type ClustersGetter interface {
Clusters(namespace string) ClusterInterface
}
// ClusterInterface has methods to work with Cluster resources.
type ClusterInterface interface {
Create(*kops.Cluster) (*kops.Cluster, error)
Update(*kops.Cluster) (*kops.Cluster, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*kops.Cluster, error)
List(opts v1.ListOptions) (*kops.ClusterList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.Cluster, err error)
ClusterExpansion
}
// clusters implements ClusterInterface
type clusters struct {
client rest.Interface
ns string
}
// newClusters returns a Clusters
func newClusters(c *KopsClient, namespace string) *clusters {
return &clusters{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Create(cluster *kops.Cluster) (result *kops.Cluster, err error) {
result = &kops.Cluster{}
err = c.client.Post().
Namespace(c.ns).
Resource("clusters").
Body(cluster).
Do().
Into(result)
return
}
// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Update(cluster *kops.Cluster) (result *kops.Cluster, err error) {
result = &kops.Cluster{}
err = c.client.Put().
Namespace(c.ns).
Resource("clusters").
Name(cluster.Name).
Body(cluster).
Do().
Into(result)
return
}
// Delete takes name of the cluster and deletes it. Returns an error if one occurs.
func (c *clusters) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusters").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *clusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any.
func (c *clusters) Get(name string, options v1.GetOptions) (result *kops.Cluster, err error) {
result = &kops.Cluster{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusters").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Clusters that match those selectors.
func (c *clusters) List(opts v1.ListOptions) (result *kops.ClusterList, err error) {
result = &kops.ClusterList{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested clusters.
func (c *clusters) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched cluster.
func (c *clusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.Cluster, err error) {
result = &kops.Cluster{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("clusters").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// This package has the automatically generated typed clients.
package internalversion

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// Package fake has the automatically generated clients.
package fake

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
kops "k8s.io/kops/pkg/apis/kops"
)
// FakeClusters implements ClusterInterface
type FakeClusters struct {
Fake *FakeKops
ns string
}
var clustersResource = schema.GroupVersionResource{Group: "kops", Version: "", Resource: "clusters"}
func (c *FakeClusters) Create(cluster *kops.Cluster) (result *kops.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(clustersResource, c.ns, cluster), &kops.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*kops.Cluster), err
}
func (c *FakeClusters) Update(cluster *kops.Cluster) (result *kops.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(clustersResource, c.ns, cluster), &kops.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*kops.Cluster), err
}
func (c *FakeClusters) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(clustersResource, c.ns, name), &kops.Cluster{})
return err
}
func (c *FakeClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(clustersResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &kops.ClusterList{})
return err
}
func (c *FakeClusters) Get(name string, options v1.GetOptions) (result *kops.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(clustersResource, c.ns, name), &kops.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*kops.Cluster), err
}
func (c *FakeClusters) List(opts v1.ListOptions) (result *kops.ClusterList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(clustersResource, c.ns, opts), &kops.ClusterList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &kops.ClusterList{}
for _, item := range obj.(*kops.ClusterList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested clusters.
func (c *FakeClusters) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(clustersResource, c.ns, opts))
}
// Patch applies the patch and returns the patched cluster.
func (c *FakeClusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(clustersResource, c.ns, name, data, subresources...), &kops.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*kops.Cluster), err
}

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
kops "k8s.io/kops/pkg/apis/kops"
)
// FakeFederations implements FederationInterface
type FakeFederations struct {
Fake *FakeKops
ns string
}
var federationsResource = schema.GroupVersionResource{Group: "kops", Version: "", Resource: "federations"}
func (c *FakeFederations) Create(federation *kops.Federation) (result *kops.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(federationsResource, c.ns, federation), &kops.Federation{})
if obj == nil {
return nil, err
}
return obj.(*kops.Federation), err
}
func (c *FakeFederations) Update(federation *kops.Federation) (result *kops.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(federationsResource, c.ns, federation), &kops.Federation{})
if obj == nil {
return nil, err
}
return obj.(*kops.Federation), err
}
func (c *FakeFederations) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(federationsResource, c.ns, name), &kops.Federation{})
return err
}
func (c *FakeFederations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(federationsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &kops.FederationList{})
return err
}
func (c *FakeFederations) Get(name string, options v1.GetOptions) (result *kops.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(federationsResource, c.ns, name), &kops.Federation{})
if obj == nil {
return nil, err
}
return obj.(*kops.Federation), err
}
func (c *FakeFederations) List(opts v1.ListOptions) (result *kops.FederationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(federationsResource, c.ns, opts), &kops.FederationList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &kops.FederationList{}
for _, item := range obj.(*kops.FederationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested federations.
func (c *FakeFederations) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(federationsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched federation.
func (c *FakeFederations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(federationsResource, c.ns, name, data, subresources...), &kops.Federation{})
if obj == nil {
return nil, err
}
return obj.(*kops.Federation), err
}

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
kops "k8s.io/kops/pkg/apis/kops"
)
// FakeInstanceGroups implements InstanceGroupInterface
type FakeInstanceGroups struct {
Fake *FakeKops
ns string
}
var instancegroupsResource = schema.GroupVersionResource{Group: "kops", Version: "", Resource: "instancegroups"}
func (c *FakeInstanceGroups) Create(instanceGroup *kops.InstanceGroup) (result *kops.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(instancegroupsResource, c.ns, instanceGroup), &kops.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*kops.InstanceGroup), err
}
func (c *FakeInstanceGroups) Update(instanceGroup *kops.InstanceGroup) (result *kops.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(instancegroupsResource, c.ns, instanceGroup), &kops.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*kops.InstanceGroup), err
}
func (c *FakeInstanceGroups) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(instancegroupsResource, c.ns, name), &kops.InstanceGroup{})
return err
}
func (c *FakeInstanceGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(instancegroupsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &kops.InstanceGroupList{})
return err
}
func (c *FakeInstanceGroups) Get(name string, options v1.GetOptions) (result *kops.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(instancegroupsResource, c.ns, name), &kops.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*kops.InstanceGroup), err
}
func (c *FakeInstanceGroups) List(opts v1.ListOptions) (result *kops.InstanceGroupList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(instancegroupsResource, c.ns, opts), &kops.InstanceGroupList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &kops.InstanceGroupList{}
for _, item := range obj.(*kops.InstanceGroupList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested instanceGroups.
func (c *FakeInstanceGroups) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(instancegroupsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched instanceGroup.
func (c *FakeInstanceGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(instancegroupsResource, c.ns, name, data, subresources...), &kops.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*kops.InstanceGroup), err
}

View File

@ -0,0 +1,46 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
internalversion "k8s.io/kops/pkg/client/clientset_generated/clientset/typed/kops/internalversion"
)
type FakeKops struct {
*testing.Fake
}
func (c *FakeKops) Clusters(namespace string) internalversion.ClusterInterface {
return &FakeClusters{c, namespace}
}
func (c *FakeKops) Federations(namespace string) internalversion.FederationInterface {
return &FakeFederations{c, namespace}
}
func (c *FakeKops) InstanceGroups(namespace string) internalversion.InstanceGroupInterface {
return &FakeInstanceGroups{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeKops) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package internalversion
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
kops "k8s.io/kops/pkg/apis/kops"
scheme "k8s.io/kops/pkg/client/clientset_generated/clientset/scheme"
)
// FederationsGetter has a method to return a FederationInterface.
// A group's client should implement this interface.
type FederationsGetter interface {
Federations(namespace string) FederationInterface
}
// FederationInterface has methods to work with Federation resources.
type FederationInterface interface {
Create(*kops.Federation) (*kops.Federation, error)
Update(*kops.Federation) (*kops.Federation, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*kops.Federation, error)
List(opts v1.ListOptions) (*kops.FederationList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.Federation, err error)
FederationExpansion
}
// federations implements FederationInterface
type federations struct {
client rest.Interface
ns string
}
// newFederations returns a Federations
func newFederations(c *KopsClient, namespace string) *federations {
return &federations{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a federation and creates it. Returns the server's representation of the federation, and an error, if there is any.
func (c *federations) Create(federation *kops.Federation) (result *kops.Federation, err error) {
result = &kops.Federation{}
err = c.client.Post().
Namespace(c.ns).
Resource("federations").
Body(federation).
Do().
Into(result)
return
}
// Update takes the representation of a federation and updates it. Returns the server's representation of the federation, and an error, if there is any.
func (c *federations) Update(federation *kops.Federation) (result *kops.Federation, err error) {
result = &kops.Federation{}
err = c.client.Put().
Namespace(c.ns).
Resource("federations").
Name(federation.Name).
Body(federation).
Do().
Into(result)
return
}
// Delete takes name of the federation and deletes it. Returns an error if one occurs.
func (c *federations) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("federations").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *federations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("federations").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the federation, and returns the corresponding federation object, and an error if there is any.
func (c *federations) Get(name string, options v1.GetOptions) (result *kops.Federation, err error) {
result = &kops.Federation{}
err = c.client.Get().
Namespace(c.ns).
Resource("federations").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Federations that match those selectors.
func (c *federations) List(opts v1.ListOptions) (result *kops.FederationList, err error) {
result = &kops.FederationList{}
err = c.client.Get().
Namespace(c.ns).
Resource("federations").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested federations.
func (c *federations) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("federations").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched federation.
func (c *federations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.Federation, err error) {
result = &kops.Federation{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("federations").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,23 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package internalversion
type ClusterExpansion interface{}
type FederationExpansion interface{}
type InstanceGroupExpansion interface{}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package internalversion
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
kops "k8s.io/kops/pkg/apis/kops"
scheme "k8s.io/kops/pkg/client/clientset_generated/clientset/scheme"
)
// InstanceGroupsGetter has a method to return a InstanceGroupInterface.
// A group's client should implement this interface.
type InstanceGroupsGetter interface {
InstanceGroups(namespace string) InstanceGroupInterface
}
// InstanceGroupInterface has methods to work with InstanceGroup resources.
type InstanceGroupInterface interface {
Create(*kops.InstanceGroup) (*kops.InstanceGroup, error)
Update(*kops.InstanceGroup) (*kops.InstanceGroup, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*kops.InstanceGroup, error)
List(opts v1.ListOptions) (*kops.InstanceGroupList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.InstanceGroup, err error)
InstanceGroupExpansion
}
// instanceGroups implements InstanceGroupInterface
type instanceGroups struct {
client rest.Interface
ns string
}
// newInstanceGroups returns a InstanceGroups
func newInstanceGroups(c *KopsClient, namespace string) *instanceGroups {
return &instanceGroups{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a instanceGroup and creates it. Returns the server's representation of the instanceGroup, and an error, if there is any.
func (c *instanceGroups) Create(instanceGroup *kops.InstanceGroup) (result *kops.InstanceGroup, err error) {
result = &kops.InstanceGroup{}
err = c.client.Post().
Namespace(c.ns).
Resource("instancegroups").
Body(instanceGroup).
Do().
Into(result)
return
}
// Update takes the representation of a instanceGroup and updates it. Returns the server's representation of the instanceGroup, and an error, if there is any.
func (c *instanceGroups) Update(instanceGroup *kops.InstanceGroup) (result *kops.InstanceGroup, err error) {
result = &kops.InstanceGroup{}
err = c.client.Put().
Namespace(c.ns).
Resource("instancegroups").
Name(instanceGroup.Name).
Body(instanceGroup).
Do().
Into(result)
return
}
// Delete takes name of the instanceGroup and deletes it. Returns an error if one occurs.
func (c *instanceGroups) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("instancegroups").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *instanceGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the instanceGroup, and returns the corresponding instanceGroup object, and an error if there is any.
func (c *instanceGroups) Get(name string, options v1.GetOptions) (result *kops.InstanceGroup, err error) {
result = &kops.InstanceGroup{}
err = c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of InstanceGroups that match those selectors.
func (c *instanceGroups) List(opts v1.ListOptions) (result *kops.InstanceGroupList, err error) {
result = &kops.InstanceGroupList{}
err = c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested instanceGroups.
func (c *instanceGroups) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched instanceGroup.
func (c *instanceGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.InstanceGroup, err error) {
result = &kops.InstanceGroup{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("instancegroups").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,109 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package internalversion
import (
rest "k8s.io/client-go/rest"
"k8s.io/kops/pkg/client/clientset_generated/clientset/scheme"
)
type KopsInterface interface {
RESTClient() rest.Interface
ClustersGetter
FederationsGetter
InstanceGroupsGetter
}
// KopsClient is used to interact with features provided by the kops group.
type KopsClient struct {
restClient rest.Interface
}
func (c *KopsClient) Clusters(namespace string) ClusterInterface {
return newClusters(c, namespace)
}
func (c *KopsClient) Federations(namespace string) FederationInterface {
return newFederations(c, namespace)
}
func (c *KopsClient) InstanceGroups(namespace string) InstanceGroupInterface {
return newInstanceGroups(c, namespace)
}
// NewForConfig creates a new KopsClient for the given config.
func NewForConfig(c *rest.Config) (*KopsClient, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &KopsClient{client}, nil
}
// NewForConfigOrDie creates a new KopsClient for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *KopsClient {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new KopsClient for the given RESTClient.
func New(c rest.Interface) *KopsClient {
return &KopsClient{c}
}
func setConfigDefaults(config *rest.Config) error {
g, err := scheme.Registry.Group("kops")
if err != nil {
return err
}
config.APIPath = "/apis"
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group {
gv := g.GroupVersion
config.GroupVersion = &gv
}
config.NegotiatedSerializer = scheme.Codecs
if config.QPS == 0 {
config.QPS = 5
}
if config.Burst == 0 {
config.Burst = 10
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *KopsClient) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha1 "k8s.io/kops/pkg/apis/kops/v1alpha1"
scheme "k8s.io/kops/pkg/client/clientset_generated/clientset/scheme"
)
// ClustersGetter has a method to return a ClusterInterface.
// A group's client should implement this interface.
type ClustersGetter interface {
Clusters(namespace string) ClusterInterface
}
// ClusterInterface has methods to work with Cluster resources.
type ClusterInterface interface {
Create(*v1alpha1.Cluster) (*v1alpha1.Cluster, error)
Update(*v1alpha1.Cluster) (*v1alpha1.Cluster, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha1.Cluster, error)
List(opts v1.ListOptions) (*v1alpha1.ClusterList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error)
ClusterExpansion
}
// clusters implements ClusterInterface
type clusters struct {
client rest.Interface
ns string
}
// newClusters returns a Clusters
func newClusters(c *KopsV1alpha1Client, namespace string) *clusters {
return &clusters{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Create(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
result = &v1alpha1.Cluster{}
err = c.client.Post().
Namespace(c.ns).
Resource("clusters").
Body(cluster).
Do().
Into(result)
return
}
// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Update(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
result = &v1alpha1.Cluster{}
err = c.client.Put().
Namespace(c.ns).
Resource("clusters").
Name(cluster.Name).
Body(cluster).
Do().
Into(result)
return
}
// Delete takes name of the cluster and deletes it. Returns an error if one occurs.
func (c *clusters) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusters").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *clusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any.
func (c *clusters) Get(name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) {
result = &v1alpha1.Cluster{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusters").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Clusters that match those selectors.
func (c *clusters) List(opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) {
result = &v1alpha1.ClusterList{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested clusters.
func (c *clusters) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched cluster.
func (c *clusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error) {
result = &v1alpha1.Cluster{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("clusters").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// This package has the automatically generated typed clients.
package v1alpha1

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// Package fake has the automatically generated clients.
package fake

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha1 "k8s.io/kops/pkg/apis/kops/v1alpha1"
)
// FakeClusters implements ClusterInterface
type FakeClusters struct {
Fake *FakeKopsV1alpha1
ns string
}
var clustersResource = schema.GroupVersionResource{Group: "kops", Version: "v1alpha1", Resource: "clusters"}
func (c *FakeClusters) Create(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(clustersResource, c.ns, cluster), &v1alpha1.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Cluster), err
}
func (c *FakeClusters) Update(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(clustersResource, c.ns, cluster), &v1alpha1.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Cluster), err
}
func (c *FakeClusters) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(clustersResource, c.ns, name), &v1alpha1.Cluster{})
return err
}
func (c *FakeClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(clustersResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterList{})
return err
}
func (c *FakeClusters) Get(name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(clustersResource, c.ns, name), &v1alpha1.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Cluster), err
}
func (c *FakeClusters) List(opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(clustersResource, c.ns, opts), &v1alpha1.ClusterList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.ClusterList{}
for _, item := range obj.(*v1alpha1.ClusterList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested clusters.
func (c *FakeClusters) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(clustersResource, c.ns, opts))
}
// Patch applies the patch and returns the patched cluster.
func (c *FakeClusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(clustersResource, c.ns, name, data, subresources...), &v1alpha1.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Cluster), err
}

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha1 "k8s.io/kops/pkg/apis/kops/v1alpha1"
)
// FakeFederations implements FederationInterface
type FakeFederations struct {
Fake *FakeKopsV1alpha1
ns string
}
var federationsResource = schema.GroupVersionResource{Group: "kops", Version: "v1alpha1", Resource: "federations"}
func (c *FakeFederations) Create(federation *v1alpha1.Federation) (result *v1alpha1.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(federationsResource, c.ns, federation), &v1alpha1.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Federation), err
}
func (c *FakeFederations) Update(federation *v1alpha1.Federation) (result *v1alpha1.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(federationsResource, c.ns, federation), &v1alpha1.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Federation), err
}
func (c *FakeFederations) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(federationsResource, c.ns, name), &v1alpha1.Federation{})
return err
}
func (c *FakeFederations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(federationsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.FederationList{})
return err
}
func (c *FakeFederations) Get(name string, options v1.GetOptions) (result *v1alpha1.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(federationsResource, c.ns, name), &v1alpha1.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Federation), err
}
func (c *FakeFederations) List(opts v1.ListOptions) (result *v1alpha1.FederationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(federationsResource, c.ns, opts), &v1alpha1.FederationList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.FederationList{}
for _, item := range obj.(*v1alpha1.FederationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested federations.
func (c *FakeFederations) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(federationsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched federation.
func (c *FakeFederations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(federationsResource, c.ns, name, data, subresources...), &v1alpha1.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Federation), err
}

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha1 "k8s.io/kops/pkg/apis/kops/v1alpha1"
)
// FakeInstanceGroups implements InstanceGroupInterface
type FakeInstanceGroups struct {
Fake *FakeKopsV1alpha1
ns string
}
var instancegroupsResource = schema.GroupVersionResource{Group: "kops", Version: "v1alpha1", Resource: "instancegroups"}
func (c *FakeInstanceGroups) Create(instanceGroup *v1alpha1.InstanceGroup) (result *v1alpha1.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(instancegroupsResource, c.ns, instanceGroup), &v1alpha1.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.InstanceGroup), err
}
func (c *FakeInstanceGroups) Update(instanceGroup *v1alpha1.InstanceGroup) (result *v1alpha1.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(instancegroupsResource, c.ns, instanceGroup), &v1alpha1.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.InstanceGroup), err
}
func (c *FakeInstanceGroups) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(instancegroupsResource, c.ns, name), &v1alpha1.InstanceGroup{})
return err
}
func (c *FakeInstanceGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(instancegroupsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.InstanceGroupList{})
return err
}
func (c *FakeInstanceGroups) Get(name string, options v1.GetOptions) (result *v1alpha1.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(instancegroupsResource, c.ns, name), &v1alpha1.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.InstanceGroup), err
}
func (c *FakeInstanceGroups) List(opts v1.ListOptions) (result *v1alpha1.InstanceGroupList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(instancegroupsResource, c.ns, opts), &v1alpha1.InstanceGroupList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.InstanceGroupList{}
for _, item := range obj.(*v1alpha1.InstanceGroupList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested instanceGroups.
func (c *FakeInstanceGroups) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(instancegroupsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched instanceGroup.
func (c *FakeInstanceGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(instancegroupsResource, c.ns, name, data, subresources...), &v1alpha1.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.InstanceGroup), err
}

View File

@ -0,0 +1,46 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
v1alpha1 "k8s.io/kops/pkg/client/clientset_generated/clientset/typed/kops/v1alpha1"
)
type FakeKopsV1alpha1 struct {
*testing.Fake
}
func (c *FakeKopsV1alpha1) Clusters(namespace string) v1alpha1.ClusterInterface {
return &FakeClusters{c, namespace}
}
func (c *FakeKopsV1alpha1) Federations(namespace string) v1alpha1.FederationInterface {
return &FakeFederations{c, namespace}
}
func (c *FakeKopsV1alpha1) InstanceGroups(namespace string) v1alpha1.InstanceGroupInterface {
return &FakeInstanceGroups{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeKopsV1alpha1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha1 "k8s.io/kops/pkg/apis/kops/v1alpha1"
scheme "k8s.io/kops/pkg/client/clientset_generated/clientset/scheme"
)
// FederationsGetter has a method to return a FederationInterface.
// A group's client should implement this interface.
type FederationsGetter interface {
Federations(namespace string) FederationInterface
}
// FederationInterface has methods to work with Federation resources.
type FederationInterface interface {
Create(*v1alpha1.Federation) (*v1alpha1.Federation, error)
Update(*v1alpha1.Federation) (*v1alpha1.Federation, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha1.Federation, error)
List(opts v1.ListOptions) (*v1alpha1.FederationList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Federation, err error)
FederationExpansion
}
// federations implements FederationInterface
type federations struct {
client rest.Interface
ns string
}
// newFederations returns a Federations
func newFederations(c *KopsV1alpha1Client, namespace string) *federations {
return &federations{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a federation and creates it. Returns the server's representation of the federation, and an error, if there is any.
func (c *federations) Create(federation *v1alpha1.Federation) (result *v1alpha1.Federation, err error) {
result = &v1alpha1.Federation{}
err = c.client.Post().
Namespace(c.ns).
Resource("federations").
Body(federation).
Do().
Into(result)
return
}
// Update takes the representation of a federation and updates it. Returns the server's representation of the federation, and an error, if there is any.
func (c *federations) Update(federation *v1alpha1.Federation) (result *v1alpha1.Federation, err error) {
result = &v1alpha1.Federation{}
err = c.client.Put().
Namespace(c.ns).
Resource("federations").
Name(federation.Name).
Body(federation).
Do().
Into(result)
return
}
// Delete takes name of the federation and deletes it. Returns an error if one occurs.
func (c *federations) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("federations").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *federations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("federations").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the federation, and returns the corresponding federation object, and an error if there is any.
func (c *federations) Get(name string, options v1.GetOptions) (result *v1alpha1.Federation, err error) {
result = &v1alpha1.Federation{}
err = c.client.Get().
Namespace(c.ns).
Resource("federations").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Federations that match those selectors.
func (c *federations) List(opts v1.ListOptions) (result *v1alpha1.FederationList, err error) {
result = &v1alpha1.FederationList{}
err = c.client.Get().
Namespace(c.ns).
Resource("federations").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested federations.
func (c *federations) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("federations").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched federation.
func (c *federations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Federation, err error) {
result = &v1alpha1.Federation{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("federations").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,23 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
type ClusterExpansion interface{}
type FederationExpansion interface{}
type InstanceGroupExpansion interface{}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha1 "k8s.io/kops/pkg/apis/kops/v1alpha1"
scheme "k8s.io/kops/pkg/client/clientset_generated/clientset/scheme"
)
// InstanceGroupsGetter has a method to return a InstanceGroupInterface.
// A group's client should implement this interface.
type InstanceGroupsGetter interface {
InstanceGroups(namespace string) InstanceGroupInterface
}
// InstanceGroupInterface has methods to work with InstanceGroup resources.
type InstanceGroupInterface interface {
Create(*v1alpha1.InstanceGroup) (*v1alpha1.InstanceGroup, error)
Update(*v1alpha1.InstanceGroup) (*v1alpha1.InstanceGroup, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha1.InstanceGroup, error)
List(opts v1.ListOptions) (*v1alpha1.InstanceGroupList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstanceGroup, err error)
InstanceGroupExpansion
}
// instanceGroups implements InstanceGroupInterface
type instanceGroups struct {
client rest.Interface
ns string
}
// newInstanceGroups returns a InstanceGroups
func newInstanceGroups(c *KopsV1alpha1Client, namespace string) *instanceGroups {
return &instanceGroups{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a instanceGroup and creates it. Returns the server's representation of the instanceGroup, and an error, if there is any.
func (c *instanceGroups) Create(instanceGroup *v1alpha1.InstanceGroup) (result *v1alpha1.InstanceGroup, err error) {
result = &v1alpha1.InstanceGroup{}
err = c.client.Post().
Namespace(c.ns).
Resource("instancegroups").
Body(instanceGroup).
Do().
Into(result)
return
}
// Update takes the representation of a instanceGroup and updates it. Returns the server's representation of the instanceGroup, and an error, if there is any.
func (c *instanceGroups) Update(instanceGroup *v1alpha1.InstanceGroup) (result *v1alpha1.InstanceGroup, err error) {
result = &v1alpha1.InstanceGroup{}
err = c.client.Put().
Namespace(c.ns).
Resource("instancegroups").
Name(instanceGroup.Name).
Body(instanceGroup).
Do().
Into(result)
return
}
// Delete takes name of the instanceGroup and deletes it. Returns an error if one occurs.
func (c *instanceGroups) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("instancegroups").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *instanceGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the instanceGroup, and returns the corresponding instanceGroup object, and an error if there is any.
func (c *instanceGroups) Get(name string, options v1.GetOptions) (result *v1alpha1.InstanceGroup, err error) {
result = &v1alpha1.InstanceGroup{}
err = c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of InstanceGroups that match those selectors.
func (c *instanceGroups) List(opts v1.ListOptions) (result *v1alpha1.InstanceGroupList, err error) {
result = &v1alpha1.InstanceGroupList{}
err = c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested instanceGroups.
func (c *instanceGroups) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched instanceGroup.
func (c *instanceGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstanceGroup, err error) {
result = &v1alpha1.InstanceGroup{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("instancegroups").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,98 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
rest "k8s.io/client-go/rest"
v1alpha1 "k8s.io/kops/pkg/apis/kops/v1alpha1"
"k8s.io/kops/pkg/client/clientset_generated/clientset/scheme"
)
type KopsV1alpha1Interface interface {
RESTClient() rest.Interface
ClustersGetter
FederationsGetter
InstanceGroupsGetter
}
// KopsV1alpha1Client is used to interact with features provided by the kops group.
type KopsV1alpha1Client struct {
restClient rest.Interface
}
func (c *KopsV1alpha1Client) Clusters(namespace string) ClusterInterface {
return newClusters(c, namespace)
}
func (c *KopsV1alpha1Client) Federations(namespace string) FederationInterface {
return newFederations(c, namespace)
}
func (c *KopsV1alpha1Client) InstanceGroups(namespace string) InstanceGroupInterface {
return newInstanceGroups(c, namespace)
}
// NewForConfig creates a new KopsV1alpha1Client for the given config.
func NewForConfig(c *rest.Config) (*KopsV1alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &KopsV1alpha1Client{client}, nil
}
// NewForConfigOrDie creates a new KopsV1alpha1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *KopsV1alpha1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new KopsV1alpha1Client for the given RESTClient.
func New(c rest.Interface) *KopsV1alpha1Client {
return &KopsV1alpha1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha1.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 *KopsV1alpha1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha2 "k8s.io/kops/pkg/apis/kops/v1alpha2"
scheme "k8s.io/kops/pkg/client/clientset_generated/clientset/scheme"
)
// ClustersGetter has a method to return a ClusterInterface.
// A group's client should implement this interface.
type ClustersGetter interface {
Clusters(namespace string) ClusterInterface
}
// ClusterInterface has methods to work with Cluster resources.
type ClusterInterface interface {
Create(*v1alpha2.Cluster) (*v1alpha2.Cluster, error)
Update(*v1alpha2.Cluster) (*v1alpha2.Cluster, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha2.Cluster, error)
List(opts v1.ListOptions) (*v1alpha2.ClusterList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Cluster, err error)
ClusterExpansion
}
// clusters implements ClusterInterface
type clusters struct {
client rest.Interface
ns string
}
// newClusters returns a Clusters
func newClusters(c *KopsV1alpha2Client, namespace string) *clusters {
return &clusters{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Create(cluster *v1alpha2.Cluster) (result *v1alpha2.Cluster, err error) {
result = &v1alpha2.Cluster{}
err = c.client.Post().
Namespace(c.ns).
Resource("clusters").
Body(cluster).
Do().
Into(result)
return
}
// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Update(cluster *v1alpha2.Cluster) (result *v1alpha2.Cluster, err error) {
result = &v1alpha2.Cluster{}
err = c.client.Put().
Namespace(c.ns).
Resource("clusters").
Name(cluster.Name).
Body(cluster).
Do().
Into(result)
return
}
// Delete takes name of the cluster and deletes it. Returns an error if one occurs.
func (c *clusters) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusters").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *clusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any.
func (c *clusters) Get(name string, options v1.GetOptions) (result *v1alpha2.Cluster, err error) {
result = &v1alpha2.Cluster{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusters").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Clusters that match those selectors.
func (c *clusters) List(opts v1.ListOptions) (result *v1alpha2.ClusterList, err error) {
result = &v1alpha2.ClusterList{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested clusters.
func (c *clusters) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched cluster.
func (c *clusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Cluster, err error) {
result = &v1alpha2.Cluster{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("clusters").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// This package has the automatically generated typed clients.
package v1alpha2

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// Package fake has the automatically generated clients.
package fake

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha2 "k8s.io/kops/pkg/apis/kops/v1alpha2"
)
// FakeClusters implements ClusterInterface
type FakeClusters struct {
Fake *FakeKopsV1alpha2
ns string
}
var clustersResource = schema.GroupVersionResource{Group: "kops", Version: "v1alpha2", Resource: "clusters"}
func (c *FakeClusters) Create(cluster *v1alpha2.Cluster) (result *v1alpha2.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(clustersResource, c.ns, cluster), &v1alpha2.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Cluster), err
}
func (c *FakeClusters) Update(cluster *v1alpha2.Cluster) (result *v1alpha2.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(clustersResource, c.ns, cluster), &v1alpha2.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Cluster), err
}
func (c *FakeClusters) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(clustersResource, c.ns, name), &v1alpha2.Cluster{})
return err
}
func (c *FakeClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(clustersResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha2.ClusterList{})
return err
}
func (c *FakeClusters) Get(name string, options v1.GetOptions) (result *v1alpha2.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(clustersResource, c.ns, name), &v1alpha2.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Cluster), err
}
func (c *FakeClusters) List(opts v1.ListOptions) (result *v1alpha2.ClusterList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(clustersResource, c.ns, opts), &v1alpha2.ClusterList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha2.ClusterList{}
for _, item := range obj.(*v1alpha2.ClusterList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested clusters.
func (c *FakeClusters) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(clustersResource, c.ns, opts))
}
// Patch applies the patch and returns the patched cluster.
func (c *FakeClusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(clustersResource, c.ns, name, data, subresources...), &v1alpha2.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Cluster), err
}

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha2 "k8s.io/kops/pkg/apis/kops/v1alpha2"
)
// FakeFederations implements FederationInterface
type FakeFederations struct {
Fake *FakeKopsV1alpha2
ns string
}
var federationsResource = schema.GroupVersionResource{Group: "kops", Version: "v1alpha2", Resource: "federations"}
func (c *FakeFederations) Create(federation *v1alpha2.Federation) (result *v1alpha2.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(federationsResource, c.ns, federation), &v1alpha2.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Federation), err
}
func (c *FakeFederations) Update(federation *v1alpha2.Federation) (result *v1alpha2.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(federationsResource, c.ns, federation), &v1alpha2.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Federation), err
}
func (c *FakeFederations) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(federationsResource, c.ns, name), &v1alpha2.Federation{})
return err
}
func (c *FakeFederations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(federationsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha2.FederationList{})
return err
}
func (c *FakeFederations) Get(name string, options v1.GetOptions) (result *v1alpha2.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(federationsResource, c.ns, name), &v1alpha2.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Federation), err
}
func (c *FakeFederations) List(opts v1.ListOptions) (result *v1alpha2.FederationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(federationsResource, c.ns, opts), &v1alpha2.FederationList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha2.FederationList{}
for _, item := range obj.(*v1alpha2.FederationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested federations.
func (c *FakeFederations) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(federationsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched federation.
func (c *FakeFederations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(federationsResource, c.ns, name, data, subresources...), &v1alpha2.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Federation), err
}

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha2 "k8s.io/kops/pkg/apis/kops/v1alpha2"
)
// FakeInstanceGroups implements InstanceGroupInterface
type FakeInstanceGroups struct {
Fake *FakeKopsV1alpha2
ns string
}
var instancegroupsResource = schema.GroupVersionResource{Group: "kops", Version: "v1alpha2", Resource: "instancegroups"}
func (c *FakeInstanceGroups) Create(instanceGroup *v1alpha2.InstanceGroup) (result *v1alpha2.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(instancegroupsResource, c.ns, instanceGroup), &v1alpha2.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.InstanceGroup), err
}
func (c *FakeInstanceGroups) Update(instanceGroup *v1alpha2.InstanceGroup) (result *v1alpha2.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(instancegroupsResource, c.ns, instanceGroup), &v1alpha2.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.InstanceGroup), err
}
func (c *FakeInstanceGroups) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(instancegroupsResource, c.ns, name), &v1alpha2.InstanceGroup{})
return err
}
func (c *FakeInstanceGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(instancegroupsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha2.InstanceGroupList{})
return err
}
func (c *FakeInstanceGroups) Get(name string, options v1.GetOptions) (result *v1alpha2.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(instancegroupsResource, c.ns, name), &v1alpha2.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.InstanceGroup), err
}
func (c *FakeInstanceGroups) List(opts v1.ListOptions) (result *v1alpha2.InstanceGroupList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(instancegroupsResource, c.ns, opts), &v1alpha2.InstanceGroupList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha2.InstanceGroupList{}
for _, item := range obj.(*v1alpha2.InstanceGroupList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested instanceGroups.
func (c *FakeInstanceGroups) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(instancegroupsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched instanceGroup.
func (c *FakeInstanceGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(instancegroupsResource, c.ns, name, data, subresources...), &v1alpha2.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.InstanceGroup), err
}

View File

@ -0,0 +1,46 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
v1alpha2 "k8s.io/kops/pkg/client/clientset_generated/clientset/typed/kops/v1alpha2"
)
type FakeKopsV1alpha2 struct {
*testing.Fake
}
func (c *FakeKopsV1alpha2) Clusters(namespace string) v1alpha2.ClusterInterface {
return &FakeClusters{c, namespace}
}
func (c *FakeKopsV1alpha2) Federations(namespace string) v1alpha2.FederationInterface {
return &FakeFederations{c, namespace}
}
func (c *FakeKopsV1alpha2) InstanceGroups(namespace string) v1alpha2.InstanceGroupInterface {
return &FakeInstanceGroups{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeKopsV1alpha2) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha2 "k8s.io/kops/pkg/apis/kops/v1alpha2"
scheme "k8s.io/kops/pkg/client/clientset_generated/clientset/scheme"
)
// FederationsGetter has a method to return a FederationInterface.
// A group's client should implement this interface.
type FederationsGetter interface {
Federations(namespace string) FederationInterface
}
// FederationInterface has methods to work with Federation resources.
type FederationInterface interface {
Create(*v1alpha2.Federation) (*v1alpha2.Federation, error)
Update(*v1alpha2.Federation) (*v1alpha2.Federation, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha2.Federation, error)
List(opts v1.ListOptions) (*v1alpha2.FederationList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Federation, err error)
FederationExpansion
}
// federations implements FederationInterface
type federations struct {
client rest.Interface
ns string
}
// newFederations returns a Federations
func newFederations(c *KopsV1alpha2Client, namespace string) *federations {
return &federations{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a federation and creates it. Returns the server's representation of the federation, and an error, if there is any.
func (c *federations) Create(federation *v1alpha2.Federation) (result *v1alpha2.Federation, err error) {
result = &v1alpha2.Federation{}
err = c.client.Post().
Namespace(c.ns).
Resource("federations").
Body(federation).
Do().
Into(result)
return
}
// Update takes the representation of a federation and updates it. Returns the server's representation of the federation, and an error, if there is any.
func (c *federations) Update(federation *v1alpha2.Federation) (result *v1alpha2.Federation, err error) {
result = &v1alpha2.Federation{}
err = c.client.Put().
Namespace(c.ns).
Resource("federations").
Name(federation.Name).
Body(federation).
Do().
Into(result)
return
}
// Delete takes name of the federation and deletes it. Returns an error if one occurs.
func (c *federations) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("federations").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *federations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("federations").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the federation, and returns the corresponding federation object, and an error if there is any.
func (c *federations) Get(name string, options v1.GetOptions) (result *v1alpha2.Federation, err error) {
result = &v1alpha2.Federation{}
err = c.client.Get().
Namespace(c.ns).
Resource("federations").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Federations that match those selectors.
func (c *federations) List(opts v1.ListOptions) (result *v1alpha2.FederationList, err error) {
result = &v1alpha2.FederationList{}
err = c.client.Get().
Namespace(c.ns).
Resource("federations").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested federations.
func (c *federations) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("federations").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched federation.
func (c *federations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Federation, err error) {
result = &v1alpha2.Federation{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("federations").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,23 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
type ClusterExpansion interface{}
type FederationExpansion interface{}
type InstanceGroupExpansion interface{}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha2 "k8s.io/kops/pkg/apis/kops/v1alpha2"
scheme "k8s.io/kops/pkg/client/clientset_generated/clientset/scheme"
)
// InstanceGroupsGetter has a method to return a InstanceGroupInterface.
// A group's client should implement this interface.
type InstanceGroupsGetter interface {
InstanceGroups(namespace string) InstanceGroupInterface
}
// InstanceGroupInterface has methods to work with InstanceGroup resources.
type InstanceGroupInterface interface {
Create(*v1alpha2.InstanceGroup) (*v1alpha2.InstanceGroup, error)
Update(*v1alpha2.InstanceGroup) (*v1alpha2.InstanceGroup, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha2.InstanceGroup, error)
List(opts v1.ListOptions) (*v1alpha2.InstanceGroupList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.InstanceGroup, err error)
InstanceGroupExpansion
}
// instanceGroups implements InstanceGroupInterface
type instanceGroups struct {
client rest.Interface
ns string
}
// newInstanceGroups returns a InstanceGroups
func newInstanceGroups(c *KopsV1alpha2Client, namespace string) *instanceGroups {
return &instanceGroups{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a instanceGroup and creates it. Returns the server's representation of the instanceGroup, and an error, if there is any.
func (c *instanceGroups) Create(instanceGroup *v1alpha2.InstanceGroup) (result *v1alpha2.InstanceGroup, err error) {
result = &v1alpha2.InstanceGroup{}
err = c.client.Post().
Namespace(c.ns).
Resource("instancegroups").
Body(instanceGroup).
Do().
Into(result)
return
}
// Update takes the representation of a instanceGroup and updates it. Returns the server's representation of the instanceGroup, and an error, if there is any.
func (c *instanceGroups) Update(instanceGroup *v1alpha2.InstanceGroup) (result *v1alpha2.InstanceGroup, err error) {
result = &v1alpha2.InstanceGroup{}
err = c.client.Put().
Namespace(c.ns).
Resource("instancegroups").
Name(instanceGroup.Name).
Body(instanceGroup).
Do().
Into(result)
return
}
// Delete takes name of the instanceGroup and deletes it. Returns an error if one occurs.
func (c *instanceGroups) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("instancegroups").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *instanceGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the instanceGroup, and returns the corresponding instanceGroup object, and an error if there is any.
func (c *instanceGroups) Get(name string, options v1.GetOptions) (result *v1alpha2.InstanceGroup, err error) {
result = &v1alpha2.InstanceGroup{}
err = c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of InstanceGroups that match those selectors.
func (c *instanceGroups) List(opts v1.ListOptions) (result *v1alpha2.InstanceGroupList, err error) {
result = &v1alpha2.InstanceGroupList{}
err = c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested instanceGroups.
func (c *instanceGroups) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched instanceGroup.
func (c *instanceGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.InstanceGroup, err error) {
result = &v1alpha2.InstanceGroup{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("instancegroups").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,98 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
import (
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
rest "k8s.io/client-go/rest"
v1alpha2 "k8s.io/kops/pkg/apis/kops/v1alpha2"
"k8s.io/kops/pkg/client/clientset_generated/clientset/scheme"
)
type KopsV1alpha2Interface interface {
RESTClient() rest.Interface
ClustersGetter
FederationsGetter
InstanceGroupsGetter
}
// KopsV1alpha2Client is used to interact with features provided by the kops group.
type KopsV1alpha2Client struct {
restClient rest.Interface
}
func (c *KopsV1alpha2Client) Clusters(namespace string) ClusterInterface {
return newClusters(c, namespace)
}
func (c *KopsV1alpha2Client) Federations(namespace string) FederationInterface {
return newFederations(c, namespace)
}
func (c *KopsV1alpha2Client) InstanceGroups(namespace string) InstanceGroupInterface {
return newInstanceGroups(c, namespace)
}
// NewForConfig creates a new KopsV1alpha2Client for the given config.
func NewForConfig(c *rest.Config) (*KopsV1alpha2Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &KopsV1alpha2Client{client}, nil
}
// NewForConfigOrDie creates a new KopsV1alpha2Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *KopsV1alpha2Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new KopsV1alpha2Client for the given RESTClient.
func New(c rest.Interface) *KopsV1alpha2Client {
return &KopsV1alpha2Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha2.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 *KopsV1alpha2Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@ -0,0 +1,127 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package internalclientset
import (
glog "github.com/golang/glog"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"
kopsinternalversion "k8s.io/kops/pkg/client/clientset_generated/internalclientset/typed/kops/internalversion"
kopsv1alpha1 "k8s.io/kops/pkg/client/clientset_generated/internalclientset/typed/kops/v1alpha1"
kopsv1alpha2 "k8s.io/kops/pkg/client/clientset_generated/internalclientset/typed/kops/v1alpha2"
)
type Interface interface {
Discovery() discovery.DiscoveryInterface
Kops() kopsinternalversion.KopsInterface
KopsV1alpha1() kopsv1alpha1.KopsV1alpha1Interface
KopsV1alpha2() kopsv1alpha2.KopsV1alpha2Interface
}
// Clientset contains the clients for groups. Each group has exactly one
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
*kopsinternalversion.KopsClient
*kopsv1alpha1.KopsV1alpha1Client
*kopsv1alpha2.KopsV1alpha2Client
}
// Kops retrieves the KopsClient
func (c *Clientset) Kops() kopsinternalversion.KopsInterface {
if c == nil {
return nil
}
return c.KopsClient
}
// KopsV1alpha1 retrieves the KopsV1alpha1Client
func (c *Clientset) KopsV1alpha1() kopsv1alpha1.KopsV1alpha1Interface {
if c == nil {
return nil
}
return c.KopsV1alpha1Client
}
// KopsV1alpha2 retrieves the KopsV1alpha2Client
func (c *Clientset) KopsV1alpha2() kopsv1alpha2.KopsV1alpha2Interface {
if c == nil {
return nil
}
return c.KopsV1alpha2Client
}
// 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.KopsClient, err = kopsinternalversion.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.KopsV1alpha1Client, err = kopsv1alpha1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.KopsV1alpha2Client, err = kopsv1alpha2.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.KopsClient = kopsinternalversion.NewForConfigOrDie(c)
cs.KopsV1alpha1Client = kopsv1alpha1.NewForConfigOrDie(c)
cs.KopsV1alpha2Client = kopsv1alpha2.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.KopsClient = kopsinternalversion.New(c)
cs.KopsV1alpha1Client = kopsv1alpha1.New(c)
cs.KopsV1alpha2Client = kopsv1alpha2.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &cs
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// This package has the automatically generated clientset.
package internalclientset

View File

@ -0,0 +1,80 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
"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"
clientset "k8s.io/kops/pkg/client/clientset_generated/internalclientset"
kopsinternalversion "k8s.io/kops/pkg/client/clientset_generated/internalclientset/typed/kops/internalversion"
fakekopsinternalversion "k8s.io/kops/pkg/client/clientset_generated/internalclientset/typed/kops/internalversion/fake"
kopsv1alpha1 "k8s.io/kops/pkg/client/clientset_generated/internalclientset/typed/kops/v1alpha1"
fakekopsv1alpha1 "k8s.io/kops/pkg/client/clientset_generated/internalclientset/typed/kops/v1alpha1/fake"
kopsv1alpha2 "k8s.io/kops/pkg/client/clientset_generated/internalclientset/typed/kops/v1alpha2"
fakekopsv1alpha2 "k8s.io/kops/pkg/client/clientset_generated/internalclientset/typed/kops/v1alpha2/fake"
)
// 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(registry, scheme, codecs.UniversalDecoder())
for _, obj := range objects {
if err := o.Add(obj); err != nil {
panic(err)
}
}
fakePtr := testing.Fake{}
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o, registry.RESTMapper()))
fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil))
return &Clientset{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
}
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
return &fakediscovery.FakeDiscovery{Fake: &c.Fake}
}
var _ clientset.Interface = &Clientset{}
// Kops retrieves the KopsClient
func (c *Clientset) Kops() kopsinternalversion.KopsInterface {
return &fakekopsinternalversion.FakeKops{Fake: &c.Fake}
}
// KopsV1alpha1 retrieves the KopsV1alpha1Client
func (c *Clientset) KopsV1alpha1() kopsv1alpha1.KopsV1alpha1Interface {
return &fakekopsv1alpha1.FakeKopsV1alpha1{Fake: &c.Fake}
}
// KopsV1alpha2 retrieves the KopsV1alpha2Client
func (c *Clientset) KopsV1alpha2() kopsv1alpha2.KopsV1alpha2Interface {
return &fakekopsv1alpha2.FakeKopsV1alpha2{Fake: &c.Fake}
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// This package has the automatically generated fake clientset.
package fake

View File

@ -0,0 +1,46 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
announced "k8s.io/apimachinery/pkg/apimachinery/announced"
registered "k8s.io/apimachinery/pkg/apimachinery/registered"
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"
kops "k8s.io/kops/pkg/apis/kops/install"
os "os"
)
var scheme = runtime.NewScheme()
var codecs = serializer.NewCodecFactory(scheme)
var parameterCodec = runtime.NewParameterCodec(scheme)
var registry = registered.NewOrDie(os.Getenv("KUBE_API_VERSIONS"))
var groupFactoryRegistry = make(announced.APIGroupFactoryRegistry)
func init() {
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
Install(groupFactoryRegistry, registry, scheme)
}
// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
kops.Install(groupFactoryRegistry, registry, scheme)
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// This package contains the scheme of the automatically generated clientset.
package scheme

View File

@ -0,0 +1,46 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package scheme
import (
announced "k8s.io/apimachinery/pkg/apimachinery/announced"
registered "k8s.io/apimachinery/pkg/apimachinery/registered"
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"
kops "k8s.io/kops/pkg/apis/kops/install"
os "os"
)
var Scheme = runtime.NewScheme()
var Codecs = serializer.NewCodecFactory(Scheme)
var ParameterCodec = runtime.NewParameterCodec(Scheme)
var Registry = registered.NewOrDie(os.Getenv("KUBE_API_VERSIONS"))
var GroupFactoryRegistry = make(announced.APIGroupFactoryRegistry)
func init() {
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
Install(GroupFactoryRegistry, Registry, Scheme)
}
// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
kops.Install(groupFactoryRegistry, registry, scheme)
}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package internalversion
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
kops "k8s.io/kops/pkg/apis/kops"
scheme "k8s.io/kops/pkg/client/clientset_generated/internalclientset/scheme"
)
// ClustersGetter has a method to return a ClusterInterface.
// A group's client should implement this interface.
type ClustersGetter interface {
Clusters(namespace string) ClusterInterface
}
// ClusterInterface has methods to work with Cluster resources.
type ClusterInterface interface {
Create(*kops.Cluster) (*kops.Cluster, error)
Update(*kops.Cluster) (*kops.Cluster, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*kops.Cluster, error)
List(opts v1.ListOptions) (*kops.ClusterList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.Cluster, err error)
ClusterExpansion
}
// clusters implements ClusterInterface
type clusters struct {
client rest.Interface
ns string
}
// newClusters returns a Clusters
func newClusters(c *KopsClient, namespace string) *clusters {
return &clusters{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Create(cluster *kops.Cluster) (result *kops.Cluster, err error) {
result = &kops.Cluster{}
err = c.client.Post().
Namespace(c.ns).
Resource("clusters").
Body(cluster).
Do().
Into(result)
return
}
// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Update(cluster *kops.Cluster) (result *kops.Cluster, err error) {
result = &kops.Cluster{}
err = c.client.Put().
Namespace(c.ns).
Resource("clusters").
Name(cluster.Name).
Body(cluster).
Do().
Into(result)
return
}
// Delete takes name of the cluster and deletes it. Returns an error if one occurs.
func (c *clusters) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusters").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *clusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any.
func (c *clusters) Get(name string, options v1.GetOptions) (result *kops.Cluster, err error) {
result = &kops.Cluster{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusters").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Clusters that match those selectors.
func (c *clusters) List(opts v1.ListOptions) (result *kops.ClusterList, err error) {
result = &kops.ClusterList{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested clusters.
func (c *clusters) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched cluster.
func (c *clusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.Cluster, err error) {
result = &kops.Cluster{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("clusters").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// This package has the automatically generated typed clients.
package internalversion

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// Package fake has the automatically generated clients.
package fake

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
kops "k8s.io/kops/pkg/apis/kops"
)
// FakeClusters implements ClusterInterface
type FakeClusters struct {
Fake *FakeKops
ns string
}
var clustersResource = schema.GroupVersionResource{Group: "kops", Version: "", Resource: "clusters"}
func (c *FakeClusters) Create(cluster *kops.Cluster) (result *kops.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(clustersResource, c.ns, cluster), &kops.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*kops.Cluster), err
}
func (c *FakeClusters) Update(cluster *kops.Cluster) (result *kops.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(clustersResource, c.ns, cluster), &kops.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*kops.Cluster), err
}
func (c *FakeClusters) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(clustersResource, c.ns, name), &kops.Cluster{})
return err
}
func (c *FakeClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(clustersResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &kops.ClusterList{})
return err
}
func (c *FakeClusters) Get(name string, options v1.GetOptions) (result *kops.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(clustersResource, c.ns, name), &kops.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*kops.Cluster), err
}
func (c *FakeClusters) List(opts v1.ListOptions) (result *kops.ClusterList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(clustersResource, c.ns, opts), &kops.ClusterList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &kops.ClusterList{}
for _, item := range obj.(*kops.ClusterList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested clusters.
func (c *FakeClusters) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(clustersResource, c.ns, opts))
}
// Patch applies the patch and returns the patched cluster.
func (c *FakeClusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(clustersResource, c.ns, name, data, subresources...), &kops.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*kops.Cluster), err
}

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
kops "k8s.io/kops/pkg/apis/kops"
)
// FakeFederations implements FederationInterface
type FakeFederations struct {
Fake *FakeKops
ns string
}
var federationsResource = schema.GroupVersionResource{Group: "kops", Version: "", Resource: "federations"}
func (c *FakeFederations) Create(federation *kops.Federation) (result *kops.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(federationsResource, c.ns, federation), &kops.Federation{})
if obj == nil {
return nil, err
}
return obj.(*kops.Federation), err
}
func (c *FakeFederations) Update(federation *kops.Federation) (result *kops.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(federationsResource, c.ns, federation), &kops.Federation{})
if obj == nil {
return nil, err
}
return obj.(*kops.Federation), err
}
func (c *FakeFederations) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(federationsResource, c.ns, name), &kops.Federation{})
return err
}
func (c *FakeFederations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(federationsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &kops.FederationList{})
return err
}
func (c *FakeFederations) Get(name string, options v1.GetOptions) (result *kops.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(federationsResource, c.ns, name), &kops.Federation{})
if obj == nil {
return nil, err
}
return obj.(*kops.Federation), err
}
func (c *FakeFederations) List(opts v1.ListOptions) (result *kops.FederationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(federationsResource, c.ns, opts), &kops.FederationList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &kops.FederationList{}
for _, item := range obj.(*kops.FederationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested federations.
func (c *FakeFederations) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(federationsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched federation.
func (c *FakeFederations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(federationsResource, c.ns, name, data, subresources...), &kops.Federation{})
if obj == nil {
return nil, err
}
return obj.(*kops.Federation), err
}

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
kops "k8s.io/kops/pkg/apis/kops"
)
// FakeInstanceGroups implements InstanceGroupInterface
type FakeInstanceGroups struct {
Fake *FakeKops
ns string
}
var instancegroupsResource = schema.GroupVersionResource{Group: "kops", Version: "", Resource: "instancegroups"}
func (c *FakeInstanceGroups) Create(instanceGroup *kops.InstanceGroup) (result *kops.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(instancegroupsResource, c.ns, instanceGroup), &kops.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*kops.InstanceGroup), err
}
func (c *FakeInstanceGroups) Update(instanceGroup *kops.InstanceGroup) (result *kops.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(instancegroupsResource, c.ns, instanceGroup), &kops.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*kops.InstanceGroup), err
}
func (c *FakeInstanceGroups) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(instancegroupsResource, c.ns, name), &kops.InstanceGroup{})
return err
}
func (c *FakeInstanceGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(instancegroupsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &kops.InstanceGroupList{})
return err
}
func (c *FakeInstanceGroups) Get(name string, options v1.GetOptions) (result *kops.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(instancegroupsResource, c.ns, name), &kops.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*kops.InstanceGroup), err
}
func (c *FakeInstanceGroups) List(opts v1.ListOptions) (result *kops.InstanceGroupList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(instancegroupsResource, c.ns, opts), &kops.InstanceGroupList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &kops.InstanceGroupList{}
for _, item := range obj.(*kops.InstanceGroupList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested instanceGroups.
func (c *FakeInstanceGroups) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(instancegroupsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched instanceGroup.
func (c *FakeInstanceGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(instancegroupsResource, c.ns, name, data, subresources...), &kops.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*kops.InstanceGroup), err
}

View File

@ -0,0 +1,46 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
internalversion "k8s.io/kops/pkg/client/clientset_generated/internalclientset/typed/kops/internalversion"
)
type FakeKops struct {
*testing.Fake
}
func (c *FakeKops) Clusters(namespace string) internalversion.ClusterInterface {
return &FakeClusters{c, namespace}
}
func (c *FakeKops) Federations(namespace string) internalversion.FederationInterface {
return &FakeFederations{c, namespace}
}
func (c *FakeKops) InstanceGroups(namespace string) internalversion.InstanceGroupInterface {
return &FakeInstanceGroups{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeKops) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package internalversion
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
kops "k8s.io/kops/pkg/apis/kops"
scheme "k8s.io/kops/pkg/client/clientset_generated/internalclientset/scheme"
)
// FederationsGetter has a method to return a FederationInterface.
// A group's client should implement this interface.
type FederationsGetter interface {
Federations(namespace string) FederationInterface
}
// FederationInterface has methods to work with Federation resources.
type FederationInterface interface {
Create(*kops.Federation) (*kops.Federation, error)
Update(*kops.Federation) (*kops.Federation, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*kops.Federation, error)
List(opts v1.ListOptions) (*kops.FederationList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.Federation, err error)
FederationExpansion
}
// federations implements FederationInterface
type federations struct {
client rest.Interface
ns string
}
// newFederations returns a Federations
func newFederations(c *KopsClient, namespace string) *federations {
return &federations{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a federation and creates it. Returns the server's representation of the federation, and an error, if there is any.
func (c *federations) Create(federation *kops.Federation) (result *kops.Federation, err error) {
result = &kops.Federation{}
err = c.client.Post().
Namespace(c.ns).
Resource("federations").
Body(federation).
Do().
Into(result)
return
}
// Update takes the representation of a federation and updates it. Returns the server's representation of the federation, and an error, if there is any.
func (c *federations) Update(federation *kops.Federation) (result *kops.Federation, err error) {
result = &kops.Federation{}
err = c.client.Put().
Namespace(c.ns).
Resource("federations").
Name(federation.Name).
Body(federation).
Do().
Into(result)
return
}
// Delete takes name of the federation and deletes it. Returns an error if one occurs.
func (c *federations) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("federations").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *federations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("federations").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the federation, and returns the corresponding federation object, and an error if there is any.
func (c *federations) Get(name string, options v1.GetOptions) (result *kops.Federation, err error) {
result = &kops.Federation{}
err = c.client.Get().
Namespace(c.ns).
Resource("federations").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Federations that match those selectors.
func (c *federations) List(opts v1.ListOptions) (result *kops.FederationList, err error) {
result = &kops.FederationList{}
err = c.client.Get().
Namespace(c.ns).
Resource("federations").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested federations.
func (c *federations) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("federations").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched federation.
func (c *federations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.Federation, err error) {
result = &kops.Federation{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("federations").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,23 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package internalversion
type ClusterExpansion interface{}
type FederationExpansion interface{}
type InstanceGroupExpansion interface{}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package internalversion
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
kops "k8s.io/kops/pkg/apis/kops"
scheme "k8s.io/kops/pkg/client/clientset_generated/internalclientset/scheme"
)
// InstanceGroupsGetter has a method to return a InstanceGroupInterface.
// A group's client should implement this interface.
type InstanceGroupsGetter interface {
InstanceGroups(namespace string) InstanceGroupInterface
}
// InstanceGroupInterface has methods to work with InstanceGroup resources.
type InstanceGroupInterface interface {
Create(*kops.InstanceGroup) (*kops.InstanceGroup, error)
Update(*kops.InstanceGroup) (*kops.InstanceGroup, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*kops.InstanceGroup, error)
List(opts v1.ListOptions) (*kops.InstanceGroupList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.InstanceGroup, err error)
InstanceGroupExpansion
}
// instanceGroups implements InstanceGroupInterface
type instanceGroups struct {
client rest.Interface
ns string
}
// newInstanceGroups returns a InstanceGroups
func newInstanceGroups(c *KopsClient, namespace string) *instanceGroups {
return &instanceGroups{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a instanceGroup and creates it. Returns the server's representation of the instanceGroup, and an error, if there is any.
func (c *instanceGroups) Create(instanceGroup *kops.InstanceGroup) (result *kops.InstanceGroup, err error) {
result = &kops.InstanceGroup{}
err = c.client.Post().
Namespace(c.ns).
Resource("instancegroups").
Body(instanceGroup).
Do().
Into(result)
return
}
// Update takes the representation of a instanceGroup and updates it. Returns the server's representation of the instanceGroup, and an error, if there is any.
func (c *instanceGroups) Update(instanceGroup *kops.InstanceGroup) (result *kops.InstanceGroup, err error) {
result = &kops.InstanceGroup{}
err = c.client.Put().
Namespace(c.ns).
Resource("instancegroups").
Name(instanceGroup.Name).
Body(instanceGroup).
Do().
Into(result)
return
}
// Delete takes name of the instanceGroup and deletes it. Returns an error if one occurs.
func (c *instanceGroups) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("instancegroups").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *instanceGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the instanceGroup, and returns the corresponding instanceGroup object, and an error if there is any.
func (c *instanceGroups) Get(name string, options v1.GetOptions) (result *kops.InstanceGroup, err error) {
result = &kops.InstanceGroup{}
err = c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of InstanceGroups that match those selectors.
func (c *instanceGroups) List(opts v1.ListOptions) (result *kops.InstanceGroupList, err error) {
result = &kops.InstanceGroupList{}
err = c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested instanceGroups.
func (c *instanceGroups) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched instanceGroup.
func (c *instanceGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *kops.InstanceGroup, err error) {
result = &kops.InstanceGroup{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("instancegroups").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,109 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package internalversion
import (
rest "k8s.io/client-go/rest"
"k8s.io/kops/pkg/client/clientset_generated/internalclientset/scheme"
)
type KopsInterface interface {
RESTClient() rest.Interface
ClustersGetter
FederationsGetter
InstanceGroupsGetter
}
// KopsClient is used to interact with features provided by the kops group.
type KopsClient struct {
restClient rest.Interface
}
func (c *KopsClient) Clusters(namespace string) ClusterInterface {
return newClusters(c, namespace)
}
func (c *KopsClient) Federations(namespace string) FederationInterface {
return newFederations(c, namespace)
}
func (c *KopsClient) InstanceGroups(namespace string) InstanceGroupInterface {
return newInstanceGroups(c, namespace)
}
// NewForConfig creates a new KopsClient for the given config.
func NewForConfig(c *rest.Config) (*KopsClient, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &KopsClient{client}, nil
}
// NewForConfigOrDie creates a new KopsClient for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *KopsClient {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new KopsClient for the given RESTClient.
func New(c rest.Interface) *KopsClient {
return &KopsClient{c}
}
func setConfigDefaults(config *rest.Config) error {
g, err := scheme.Registry.Group("kops")
if err != nil {
return err
}
config.APIPath = "/apis"
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group {
gv := g.GroupVersion
config.GroupVersion = &gv
}
config.NegotiatedSerializer = scheme.Codecs
if config.QPS == 0 {
config.QPS = 5
}
if config.Burst == 0 {
config.Burst = 10
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *KopsClient) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha1 "k8s.io/kops/pkg/apis/kops/v1alpha1"
scheme "k8s.io/kops/pkg/client/clientset_generated/internalclientset/scheme"
)
// ClustersGetter has a method to return a ClusterInterface.
// A group's client should implement this interface.
type ClustersGetter interface {
Clusters(namespace string) ClusterInterface
}
// ClusterInterface has methods to work with Cluster resources.
type ClusterInterface interface {
Create(*v1alpha1.Cluster) (*v1alpha1.Cluster, error)
Update(*v1alpha1.Cluster) (*v1alpha1.Cluster, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha1.Cluster, error)
List(opts v1.ListOptions) (*v1alpha1.ClusterList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error)
ClusterExpansion
}
// clusters implements ClusterInterface
type clusters struct {
client rest.Interface
ns string
}
// newClusters returns a Clusters
func newClusters(c *KopsV1alpha1Client, namespace string) *clusters {
return &clusters{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Create(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
result = &v1alpha1.Cluster{}
err = c.client.Post().
Namespace(c.ns).
Resource("clusters").
Body(cluster).
Do().
Into(result)
return
}
// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Update(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
result = &v1alpha1.Cluster{}
err = c.client.Put().
Namespace(c.ns).
Resource("clusters").
Name(cluster.Name).
Body(cluster).
Do().
Into(result)
return
}
// Delete takes name of the cluster and deletes it. Returns an error if one occurs.
func (c *clusters) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusters").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *clusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any.
func (c *clusters) Get(name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) {
result = &v1alpha1.Cluster{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusters").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Clusters that match those selectors.
func (c *clusters) List(opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) {
result = &v1alpha1.ClusterList{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested clusters.
func (c *clusters) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched cluster.
func (c *clusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error) {
result = &v1alpha1.Cluster{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("clusters").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// This package has the automatically generated typed clients.
package v1alpha1

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// Package fake has the automatically generated clients.
package fake

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha1 "k8s.io/kops/pkg/apis/kops/v1alpha1"
)
// FakeClusters implements ClusterInterface
type FakeClusters struct {
Fake *FakeKopsV1alpha1
ns string
}
var clustersResource = schema.GroupVersionResource{Group: "kops", Version: "v1alpha1", Resource: "clusters"}
func (c *FakeClusters) Create(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(clustersResource, c.ns, cluster), &v1alpha1.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Cluster), err
}
func (c *FakeClusters) Update(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(clustersResource, c.ns, cluster), &v1alpha1.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Cluster), err
}
func (c *FakeClusters) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(clustersResource, c.ns, name), &v1alpha1.Cluster{})
return err
}
func (c *FakeClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(clustersResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterList{})
return err
}
func (c *FakeClusters) Get(name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(clustersResource, c.ns, name), &v1alpha1.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Cluster), err
}
func (c *FakeClusters) List(opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(clustersResource, c.ns, opts), &v1alpha1.ClusterList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.ClusterList{}
for _, item := range obj.(*v1alpha1.ClusterList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested clusters.
func (c *FakeClusters) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(clustersResource, c.ns, opts))
}
// Patch applies the patch and returns the patched cluster.
func (c *FakeClusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(clustersResource, c.ns, name, data, subresources...), &v1alpha1.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Cluster), err
}

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha1 "k8s.io/kops/pkg/apis/kops/v1alpha1"
)
// FakeFederations implements FederationInterface
type FakeFederations struct {
Fake *FakeKopsV1alpha1
ns string
}
var federationsResource = schema.GroupVersionResource{Group: "kops", Version: "v1alpha1", Resource: "federations"}
func (c *FakeFederations) Create(federation *v1alpha1.Federation) (result *v1alpha1.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(federationsResource, c.ns, federation), &v1alpha1.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Federation), err
}
func (c *FakeFederations) Update(federation *v1alpha1.Federation) (result *v1alpha1.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(federationsResource, c.ns, federation), &v1alpha1.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Federation), err
}
func (c *FakeFederations) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(federationsResource, c.ns, name), &v1alpha1.Federation{})
return err
}
func (c *FakeFederations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(federationsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.FederationList{})
return err
}
func (c *FakeFederations) Get(name string, options v1.GetOptions) (result *v1alpha1.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(federationsResource, c.ns, name), &v1alpha1.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Federation), err
}
func (c *FakeFederations) List(opts v1.ListOptions) (result *v1alpha1.FederationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(federationsResource, c.ns, opts), &v1alpha1.FederationList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.FederationList{}
for _, item := range obj.(*v1alpha1.FederationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested federations.
func (c *FakeFederations) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(federationsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched federation.
func (c *FakeFederations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(federationsResource, c.ns, name, data, subresources...), &v1alpha1.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Federation), err
}

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha1 "k8s.io/kops/pkg/apis/kops/v1alpha1"
)
// FakeInstanceGroups implements InstanceGroupInterface
type FakeInstanceGroups struct {
Fake *FakeKopsV1alpha1
ns string
}
var instancegroupsResource = schema.GroupVersionResource{Group: "kops", Version: "v1alpha1", Resource: "instancegroups"}
func (c *FakeInstanceGroups) Create(instanceGroup *v1alpha1.InstanceGroup) (result *v1alpha1.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(instancegroupsResource, c.ns, instanceGroup), &v1alpha1.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.InstanceGroup), err
}
func (c *FakeInstanceGroups) Update(instanceGroup *v1alpha1.InstanceGroup) (result *v1alpha1.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(instancegroupsResource, c.ns, instanceGroup), &v1alpha1.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.InstanceGroup), err
}
func (c *FakeInstanceGroups) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(instancegroupsResource, c.ns, name), &v1alpha1.InstanceGroup{})
return err
}
func (c *FakeInstanceGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(instancegroupsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.InstanceGroupList{})
return err
}
func (c *FakeInstanceGroups) Get(name string, options v1.GetOptions) (result *v1alpha1.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(instancegroupsResource, c.ns, name), &v1alpha1.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.InstanceGroup), err
}
func (c *FakeInstanceGroups) List(opts v1.ListOptions) (result *v1alpha1.InstanceGroupList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(instancegroupsResource, c.ns, opts), &v1alpha1.InstanceGroupList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.InstanceGroupList{}
for _, item := range obj.(*v1alpha1.InstanceGroupList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested instanceGroups.
func (c *FakeInstanceGroups) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(instancegroupsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched instanceGroup.
func (c *FakeInstanceGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(instancegroupsResource, c.ns, name, data, subresources...), &v1alpha1.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.InstanceGroup), err
}

View File

@ -0,0 +1,46 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
v1alpha1 "k8s.io/kops/pkg/client/clientset_generated/internalclientset/typed/kops/v1alpha1"
)
type FakeKopsV1alpha1 struct {
*testing.Fake
}
func (c *FakeKopsV1alpha1) Clusters(namespace string) v1alpha1.ClusterInterface {
return &FakeClusters{c, namespace}
}
func (c *FakeKopsV1alpha1) Federations(namespace string) v1alpha1.FederationInterface {
return &FakeFederations{c, namespace}
}
func (c *FakeKopsV1alpha1) InstanceGroups(namespace string) v1alpha1.InstanceGroupInterface {
return &FakeInstanceGroups{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeKopsV1alpha1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha1 "k8s.io/kops/pkg/apis/kops/v1alpha1"
scheme "k8s.io/kops/pkg/client/clientset_generated/internalclientset/scheme"
)
// FederationsGetter has a method to return a FederationInterface.
// A group's client should implement this interface.
type FederationsGetter interface {
Federations(namespace string) FederationInterface
}
// FederationInterface has methods to work with Federation resources.
type FederationInterface interface {
Create(*v1alpha1.Federation) (*v1alpha1.Federation, error)
Update(*v1alpha1.Federation) (*v1alpha1.Federation, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha1.Federation, error)
List(opts v1.ListOptions) (*v1alpha1.FederationList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Federation, err error)
FederationExpansion
}
// federations implements FederationInterface
type federations struct {
client rest.Interface
ns string
}
// newFederations returns a Federations
func newFederations(c *KopsV1alpha1Client, namespace string) *federations {
return &federations{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a federation and creates it. Returns the server's representation of the federation, and an error, if there is any.
func (c *federations) Create(federation *v1alpha1.Federation) (result *v1alpha1.Federation, err error) {
result = &v1alpha1.Federation{}
err = c.client.Post().
Namespace(c.ns).
Resource("federations").
Body(federation).
Do().
Into(result)
return
}
// Update takes the representation of a federation and updates it. Returns the server's representation of the federation, and an error, if there is any.
func (c *federations) Update(federation *v1alpha1.Federation) (result *v1alpha1.Federation, err error) {
result = &v1alpha1.Federation{}
err = c.client.Put().
Namespace(c.ns).
Resource("federations").
Name(federation.Name).
Body(federation).
Do().
Into(result)
return
}
// Delete takes name of the federation and deletes it. Returns an error if one occurs.
func (c *federations) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("federations").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *federations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("federations").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the federation, and returns the corresponding federation object, and an error if there is any.
func (c *federations) Get(name string, options v1.GetOptions) (result *v1alpha1.Federation, err error) {
result = &v1alpha1.Federation{}
err = c.client.Get().
Namespace(c.ns).
Resource("federations").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Federations that match those selectors.
func (c *federations) List(opts v1.ListOptions) (result *v1alpha1.FederationList, err error) {
result = &v1alpha1.FederationList{}
err = c.client.Get().
Namespace(c.ns).
Resource("federations").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested federations.
func (c *federations) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("federations").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched federation.
func (c *federations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Federation, err error) {
result = &v1alpha1.Federation{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("federations").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,23 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
type ClusterExpansion interface{}
type FederationExpansion interface{}
type InstanceGroupExpansion interface{}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha1 "k8s.io/kops/pkg/apis/kops/v1alpha1"
scheme "k8s.io/kops/pkg/client/clientset_generated/internalclientset/scheme"
)
// InstanceGroupsGetter has a method to return a InstanceGroupInterface.
// A group's client should implement this interface.
type InstanceGroupsGetter interface {
InstanceGroups(namespace string) InstanceGroupInterface
}
// InstanceGroupInterface has methods to work with InstanceGroup resources.
type InstanceGroupInterface interface {
Create(*v1alpha1.InstanceGroup) (*v1alpha1.InstanceGroup, error)
Update(*v1alpha1.InstanceGroup) (*v1alpha1.InstanceGroup, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha1.InstanceGroup, error)
List(opts v1.ListOptions) (*v1alpha1.InstanceGroupList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstanceGroup, err error)
InstanceGroupExpansion
}
// instanceGroups implements InstanceGroupInterface
type instanceGroups struct {
client rest.Interface
ns string
}
// newInstanceGroups returns a InstanceGroups
func newInstanceGroups(c *KopsV1alpha1Client, namespace string) *instanceGroups {
return &instanceGroups{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a instanceGroup and creates it. Returns the server's representation of the instanceGroup, and an error, if there is any.
func (c *instanceGroups) Create(instanceGroup *v1alpha1.InstanceGroup) (result *v1alpha1.InstanceGroup, err error) {
result = &v1alpha1.InstanceGroup{}
err = c.client.Post().
Namespace(c.ns).
Resource("instancegroups").
Body(instanceGroup).
Do().
Into(result)
return
}
// Update takes the representation of a instanceGroup and updates it. Returns the server's representation of the instanceGroup, and an error, if there is any.
func (c *instanceGroups) Update(instanceGroup *v1alpha1.InstanceGroup) (result *v1alpha1.InstanceGroup, err error) {
result = &v1alpha1.InstanceGroup{}
err = c.client.Put().
Namespace(c.ns).
Resource("instancegroups").
Name(instanceGroup.Name).
Body(instanceGroup).
Do().
Into(result)
return
}
// Delete takes name of the instanceGroup and deletes it. Returns an error if one occurs.
func (c *instanceGroups) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("instancegroups").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *instanceGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the instanceGroup, and returns the corresponding instanceGroup object, and an error if there is any.
func (c *instanceGroups) Get(name string, options v1.GetOptions) (result *v1alpha1.InstanceGroup, err error) {
result = &v1alpha1.InstanceGroup{}
err = c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of InstanceGroups that match those selectors.
func (c *instanceGroups) List(opts v1.ListOptions) (result *v1alpha1.InstanceGroupList, err error) {
result = &v1alpha1.InstanceGroupList{}
err = c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested instanceGroups.
func (c *instanceGroups) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched instanceGroup.
func (c *instanceGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstanceGroup, err error) {
result = &v1alpha1.InstanceGroup{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("instancegroups").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,98 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
rest "k8s.io/client-go/rest"
v1alpha1 "k8s.io/kops/pkg/apis/kops/v1alpha1"
"k8s.io/kops/pkg/client/clientset_generated/internalclientset/scheme"
)
type KopsV1alpha1Interface interface {
RESTClient() rest.Interface
ClustersGetter
FederationsGetter
InstanceGroupsGetter
}
// KopsV1alpha1Client is used to interact with features provided by the kops group.
type KopsV1alpha1Client struct {
restClient rest.Interface
}
func (c *KopsV1alpha1Client) Clusters(namespace string) ClusterInterface {
return newClusters(c, namespace)
}
func (c *KopsV1alpha1Client) Federations(namespace string) FederationInterface {
return newFederations(c, namespace)
}
func (c *KopsV1alpha1Client) InstanceGroups(namespace string) InstanceGroupInterface {
return newInstanceGroups(c, namespace)
}
// NewForConfig creates a new KopsV1alpha1Client for the given config.
func NewForConfig(c *rest.Config) (*KopsV1alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &KopsV1alpha1Client{client}, nil
}
// NewForConfigOrDie creates a new KopsV1alpha1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *KopsV1alpha1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new KopsV1alpha1Client for the given RESTClient.
func New(c rest.Interface) *KopsV1alpha1Client {
return &KopsV1alpha1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha1.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 *KopsV1alpha1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha2 "k8s.io/kops/pkg/apis/kops/v1alpha2"
scheme "k8s.io/kops/pkg/client/clientset_generated/internalclientset/scheme"
)
// ClustersGetter has a method to return a ClusterInterface.
// A group's client should implement this interface.
type ClustersGetter interface {
Clusters(namespace string) ClusterInterface
}
// ClusterInterface has methods to work with Cluster resources.
type ClusterInterface interface {
Create(*v1alpha2.Cluster) (*v1alpha2.Cluster, error)
Update(*v1alpha2.Cluster) (*v1alpha2.Cluster, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha2.Cluster, error)
List(opts v1.ListOptions) (*v1alpha2.ClusterList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Cluster, err error)
ClusterExpansion
}
// clusters implements ClusterInterface
type clusters struct {
client rest.Interface
ns string
}
// newClusters returns a Clusters
func newClusters(c *KopsV1alpha2Client, namespace string) *clusters {
return &clusters{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Create(cluster *v1alpha2.Cluster) (result *v1alpha2.Cluster, err error) {
result = &v1alpha2.Cluster{}
err = c.client.Post().
Namespace(c.ns).
Resource("clusters").
Body(cluster).
Do().
Into(result)
return
}
// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Update(cluster *v1alpha2.Cluster) (result *v1alpha2.Cluster, err error) {
result = &v1alpha2.Cluster{}
err = c.client.Put().
Namespace(c.ns).
Resource("clusters").
Name(cluster.Name).
Body(cluster).
Do().
Into(result)
return
}
// Delete takes name of the cluster and deletes it. Returns an error if one occurs.
func (c *clusters) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusters").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *clusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any.
func (c *clusters) Get(name string, options v1.GetOptions) (result *v1alpha2.Cluster, err error) {
result = &v1alpha2.Cluster{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusters").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Clusters that match those selectors.
func (c *clusters) List(opts v1.ListOptions) (result *v1alpha2.ClusterList, err error) {
result = &v1alpha2.ClusterList{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested clusters.
func (c *clusters) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched cluster.
func (c *clusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Cluster, err error) {
result = &v1alpha2.Cluster{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("clusters").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// This package has the automatically generated typed clients.
package v1alpha2

View File

@ -0,0 +1,20 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with custom arguments.
// Package fake has the automatically generated clients.
package fake

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha2 "k8s.io/kops/pkg/apis/kops/v1alpha2"
)
// FakeClusters implements ClusterInterface
type FakeClusters struct {
Fake *FakeKopsV1alpha2
ns string
}
var clustersResource = schema.GroupVersionResource{Group: "kops", Version: "v1alpha2", Resource: "clusters"}
func (c *FakeClusters) Create(cluster *v1alpha2.Cluster) (result *v1alpha2.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(clustersResource, c.ns, cluster), &v1alpha2.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Cluster), err
}
func (c *FakeClusters) Update(cluster *v1alpha2.Cluster) (result *v1alpha2.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(clustersResource, c.ns, cluster), &v1alpha2.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Cluster), err
}
func (c *FakeClusters) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(clustersResource, c.ns, name), &v1alpha2.Cluster{})
return err
}
func (c *FakeClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(clustersResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha2.ClusterList{})
return err
}
func (c *FakeClusters) Get(name string, options v1.GetOptions) (result *v1alpha2.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(clustersResource, c.ns, name), &v1alpha2.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Cluster), err
}
func (c *FakeClusters) List(opts v1.ListOptions) (result *v1alpha2.ClusterList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(clustersResource, c.ns, opts), &v1alpha2.ClusterList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha2.ClusterList{}
for _, item := range obj.(*v1alpha2.ClusterList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested clusters.
func (c *FakeClusters) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(clustersResource, c.ns, opts))
}
// Patch applies the patch and returns the patched cluster.
func (c *FakeClusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(clustersResource, c.ns, name, data, subresources...), &v1alpha2.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Cluster), err
}

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha2 "k8s.io/kops/pkg/apis/kops/v1alpha2"
)
// FakeFederations implements FederationInterface
type FakeFederations struct {
Fake *FakeKopsV1alpha2
ns string
}
var federationsResource = schema.GroupVersionResource{Group: "kops", Version: "v1alpha2", Resource: "federations"}
func (c *FakeFederations) Create(federation *v1alpha2.Federation) (result *v1alpha2.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(federationsResource, c.ns, federation), &v1alpha2.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Federation), err
}
func (c *FakeFederations) Update(federation *v1alpha2.Federation) (result *v1alpha2.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(federationsResource, c.ns, federation), &v1alpha2.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Federation), err
}
func (c *FakeFederations) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(federationsResource, c.ns, name), &v1alpha2.Federation{})
return err
}
func (c *FakeFederations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(federationsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha2.FederationList{})
return err
}
func (c *FakeFederations) Get(name string, options v1.GetOptions) (result *v1alpha2.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(federationsResource, c.ns, name), &v1alpha2.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Federation), err
}
func (c *FakeFederations) List(opts v1.ListOptions) (result *v1alpha2.FederationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(federationsResource, c.ns, opts), &v1alpha2.FederationList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha2.FederationList{}
for _, item := range obj.(*v1alpha2.FederationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested federations.
func (c *FakeFederations) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(federationsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched federation.
func (c *FakeFederations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Federation, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(federationsResource, c.ns, name, data, subresources...), &v1alpha2.Federation{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Federation), err
}

View File

@ -0,0 +1,118 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha2 "k8s.io/kops/pkg/apis/kops/v1alpha2"
)
// FakeInstanceGroups implements InstanceGroupInterface
type FakeInstanceGroups struct {
Fake *FakeKopsV1alpha2
ns string
}
var instancegroupsResource = schema.GroupVersionResource{Group: "kops", Version: "v1alpha2", Resource: "instancegroups"}
func (c *FakeInstanceGroups) Create(instanceGroup *v1alpha2.InstanceGroup) (result *v1alpha2.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(instancegroupsResource, c.ns, instanceGroup), &v1alpha2.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.InstanceGroup), err
}
func (c *FakeInstanceGroups) Update(instanceGroup *v1alpha2.InstanceGroup) (result *v1alpha2.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(instancegroupsResource, c.ns, instanceGroup), &v1alpha2.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.InstanceGroup), err
}
func (c *FakeInstanceGroups) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(instancegroupsResource, c.ns, name), &v1alpha2.InstanceGroup{})
return err
}
func (c *FakeInstanceGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(instancegroupsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha2.InstanceGroupList{})
return err
}
func (c *FakeInstanceGroups) Get(name string, options v1.GetOptions) (result *v1alpha2.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(instancegroupsResource, c.ns, name), &v1alpha2.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.InstanceGroup), err
}
func (c *FakeInstanceGroups) List(opts v1.ListOptions) (result *v1alpha2.InstanceGroupList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(instancegroupsResource, c.ns, opts), &v1alpha2.InstanceGroupList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha2.InstanceGroupList{}
for _, item := range obj.(*v1alpha2.InstanceGroupList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested instanceGroups.
func (c *FakeInstanceGroups) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(instancegroupsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched instanceGroup.
func (c *FakeInstanceGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.InstanceGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(instancegroupsResource, c.ns, name, data, subresources...), &v1alpha2.InstanceGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.InstanceGroup), err
}

View File

@ -0,0 +1,46 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
v1alpha2 "k8s.io/kops/pkg/client/clientset_generated/internalclientset/typed/kops/v1alpha2"
)
type FakeKopsV1alpha2 struct {
*testing.Fake
}
func (c *FakeKopsV1alpha2) Clusters(namespace string) v1alpha2.ClusterInterface {
return &FakeClusters{c, namespace}
}
func (c *FakeKopsV1alpha2) Federations(namespace string) v1alpha2.FederationInterface {
return &FakeFederations{c, namespace}
}
func (c *FakeKopsV1alpha2) InstanceGroups(namespace string) v1alpha2.InstanceGroupInterface {
return &FakeInstanceGroups{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeKopsV1alpha2) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha2 "k8s.io/kops/pkg/apis/kops/v1alpha2"
scheme "k8s.io/kops/pkg/client/clientset_generated/internalclientset/scheme"
)
// FederationsGetter has a method to return a FederationInterface.
// A group's client should implement this interface.
type FederationsGetter interface {
Federations(namespace string) FederationInterface
}
// FederationInterface has methods to work with Federation resources.
type FederationInterface interface {
Create(*v1alpha2.Federation) (*v1alpha2.Federation, error)
Update(*v1alpha2.Federation) (*v1alpha2.Federation, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha2.Federation, error)
List(opts v1.ListOptions) (*v1alpha2.FederationList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Federation, err error)
FederationExpansion
}
// federations implements FederationInterface
type federations struct {
client rest.Interface
ns string
}
// newFederations returns a Federations
func newFederations(c *KopsV1alpha2Client, namespace string) *federations {
return &federations{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a federation and creates it. Returns the server's representation of the federation, and an error, if there is any.
func (c *federations) Create(federation *v1alpha2.Federation) (result *v1alpha2.Federation, err error) {
result = &v1alpha2.Federation{}
err = c.client.Post().
Namespace(c.ns).
Resource("federations").
Body(federation).
Do().
Into(result)
return
}
// Update takes the representation of a federation and updates it. Returns the server's representation of the federation, and an error, if there is any.
func (c *federations) Update(federation *v1alpha2.Federation) (result *v1alpha2.Federation, err error) {
result = &v1alpha2.Federation{}
err = c.client.Put().
Namespace(c.ns).
Resource("federations").
Name(federation.Name).
Body(federation).
Do().
Into(result)
return
}
// Delete takes name of the federation and deletes it. Returns an error if one occurs.
func (c *federations) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("federations").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *federations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("federations").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the federation, and returns the corresponding federation object, and an error if there is any.
func (c *federations) Get(name string, options v1.GetOptions) (result *v1alpha2.Federation, err error) {
result = &v1alpha2.Federation{}
err = c.client.Get().
Namespace(c.ns).
Resource("federations").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Federations that match those selectors.
func (c *federations) List(opts v1.ListOptions) (result *v1alpha2.FederationList, err error) {
result = &v1alpha2.FederationList{}
err = c.client.Get().
Namespace(c.ns).
Resource("federations").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested federations.
func (c *federations) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("federations").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched federation.
func (c *federations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Federation, err error) {
result = &v1alpha2.Federation{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("federations").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,23 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
type ClusterExpansion interface{}
type FederationExpansion interface{}
type InstanceGroupExpansion interface{}

View File

@ -0,0 +1,155 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha2 "k8s.io/kops/pkg/apis/kops/v1alpha2"
scheme "k8s.io/kops/pkg/client/clientset_generated/internalclientset/scheme"
)
// InstanceGroupsGetter has a method to return a InstanceGroupInterface.
// A group's client should implement this interface.
type InstanceGroupsGetter interface {
InstanceGroups(namespace string) InstanceGroupInterface
}
// InstanceGroupInterface has methods to work with InstanceGroup resources.
type InstanceGroupInterface interface {
Create(*v1alpha2.InstanceGroup) (*v1alpha2.InstanceGroup, error)
Update(*v1alpha2.InstanceGroup) (*v1alpha2.InstanceGroup, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha2.InstanceGroup, error)
List(opts v1.ListOptions) (*v1alpha2.InstanceGroupList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.InstanceGroup, err error)
InstanceGroupExpansion
}
// instanceGroups implements InstanceGroupInterface
type instanceGroups struct {
client rest.Interface
ns string
}
// newInstanceGroups returns a InstanceGroups
func newInstanceGroups(c *KopsV1alpha2Client, namespace string) *instanceGroups {
return &instanceGroups{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a instanceGroup and creates it. Returns the server's representation of the instanceGroup, and an error, if there is any.
func (c *instanceGroups) Create(instanceGroup *v1alpha2.InstanceGroup) (result *v1alpha2.InstanceGroup, err error) {
result = &v1alpha2.InstanceGroup{}
err = c.client.Post().
Namespace(c.ns).
Resource("instancegroups").
Body(instanceGroup).
Do().
Into(result)
return
}
// Update takes the representation of a instanceGroup and updates it. Returns the server's representation of the instanceGroup, and an error, if there is any.
func (c *instanceGroups) Update(instanceGroup *v1alpha2.InstanceGroup) (result *v1alpha2.InstanceGroup, err error) {
result = &v1alpha2.InstanceGroup{}
err = c.client.Put().
Namespace(c.ns).
Resource("instancegroups").
Name(instanceGroup.Name).
Body(instanceGroup).
Do().
Into(result)
return
}
// Delete takes name of the instanceGroup and deletes it. Returns an error if one occurs.
func (c *instanceGroups) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("instancegroups").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *instanceGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the instanceGroup, and returns the corresponding instanceGroup object, and an error if there is any.
func (c *instanceGroups) Get(name string, options v1.GetOptions) (result *v1alpha2.InstanceGroup, err error) {
result = &v1alpha2.InstanceGroup{}
err = c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of InstanceGroups that match those selectors.
func (c *instanceGroups) List(opts v1.ListOptions) (result *v1alpha2.InstanceGroupList, err error) {
result = &v1alpha2.InstanceGroupList{}
err = c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested instanceGroups.
func (c *instanceGroups) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("instancegroups").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched instanceGroup.
func (c *instanceGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.InstanceGroup, err error) {
result = &v1alpha2.InstanceGroup{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("instancegroups").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,98 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
import (
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
rest "k8s.io/client-go/rest"
v1alpha2 "k8s.io/kops/pkg/apis/kops/v1alpha2"
"k8s.io/kops/pkg/client/clientset_generated/internalclientset/scheme"
)
type KopsV1alpha2Interface interface {
RESTClient() rest.Interface
ClustersGetter
FederationsGetter
InstanceGroupsGetter
}
// KopsV1alpha2Client is used to interact with features provided by the kops group.
type KopsV1alpha2Client struct {
restClient rest.Interface
}
func (c *KopsV1alpha2Client) Clusters(namespace string) ClusterInterface {
return newClusters(c, namespace)
}
func (c *KopsV1alpha2Client) Federations(namespace string) FederationInterface {
return newFederations(c, namespace)
}
func (c *KopsV1alpha2Client) InstanceGroups(namespace string) InstanceGroupInterface {
return newInstanceGroups(c, namespace)
}
// NewForConfig creates a new KopsV1alpha2Client for the given config.
func NewForConfig(c *rest.Config) (*KopsV1alpha2Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &KopsV1alpha2Client{client}, nil
}
// NewForConfigOrDie creates a new KopsV1alpha2Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *KopsV1alpha2Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new KopsV1alpha2Client for the given RESTClient.
func New(c rest.Interface) *KopsV1alpha2Client {
return &KopsV1alpha2Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha2.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 *KopsV1alpha2Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}