Regenerating the federation client with updated client gen

This commit is contained in:
nikhiljindal 2016-05-13 12:49:20 -07:00
parent 73895c0418
commit b1fdd4180b
26 changed files with 980 additions and 8 deletions

View File

@ -18,6 +18,7 @@ package federation_internalclientset
import (
"github.com/golang/glog"
unversionedcore "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/core/unversioned"
unversionedfederation "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/federation/unversioned"
restclient "k8s.io/kubernetes/pkg/client/restclient"
discovery "k8s.io/kubernetes/pkg/client/typed/discovery"
@ -27,6 +28,7 @@ import (
type Interface interface {
Discovery() discovery.DiscoveryInterface
Federation() unversionedfederation.FederationInterface
Core() unversionedcore.CoreInterface
}
// Clientset contains the clients for groups. Each group has exactly one
@ -34,6 +36,7 @@ type Interface interface {
type Clientset struct {
*discovery.DiscoveryClient
*unversionedfederation.FederationClient
*unversionedcore.CoreClient
}
// Federation retrieves the FederationClient
@ -44,6 +47,14 @@ func (c *Clientset) Federation() unversionedfederation.FederationInterface {
return c.FederationClient
}
// Core retrieves the CoreClient
func (c *Clientset) Core() unversionedcore.CoreInterface {
if c == nil {
return nil
}
return c.CoreClient
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
return c.DiscoveryClient
@ -61,6 +72,10 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) {
if err != nil {
return &clientset, err
}
clientset.CoreClient, err = unversionedcore.NewForConfig(&configShallowCopy)
if err != nil {
return &clientset, err
}
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil {
@ -74,6 +89,7 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) {
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset
clientset.FederationClient = unversionedfederation.NewForConfigOrDie(c)
clientset.CoreClient = unversionedcore.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset
@ -83,6 +99,7 @@ func NewForConfigOrDie(c *restclient.Config) *Clientset {
func New(c *restclient.RESTClient) *Clientset {
var clientset Clientset
clientset.FederationClient = unversionedfederation.New(c)
clientset.CoreClient = unversionedcore.New(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &clientset

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[../../federation/apis/federation/]
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service] --input=[../../federation/apis/federation/,api/]
// This package has the automatically generated clientset.
package federation_internalclientset

View File

@ -18,6 +18,8 @@ package fake
import (
clientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset"
unversionedcore "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/core/unversioned"
fakeunversionedcore "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/core/unversioned/fake"
unversionedfederation "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/federation/unversioned"
fakeunversionedfederation "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/federation/unversioned/fake"
"k8s.io/kubernetes/pkg/api"
@ -63,3 +65,8 @@ var _ clientset.Interface = &Clientset{}
func (c *Clientset) Federation() unversionedfederation.FederationInterface {
return &fakeunversionedfederation.FakeFederation{Fake: &c.Fake}
}
// Core retrieves the CoreClient
func (c *Clientset) Core() unversionedcore.CoreInterface {
return &fakeunversionedcore.FakeCore{Fake: &c.Fake}
}

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[../../federation/apis/federation/]
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service] --input=[../../federation/apis/federation/,api/]
// This package has the automatically generated fake clientset.
package fake

View File

@ -0,0 +1,101 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 unversioned
import (
api "k8s.io/kubernetes/pkg/api"
registered "k8s.io/kubernetes/pkg/apimachinery/registered"
restclient "k8s.io/kubernetes/pkg/client/restclient"
)
type CoreInterface interface {
GetRESTClient() *restclient.RESTClient
ServicesGetter
}
// CoreClient is used to interact with features provided by the Core group.
type CoreClient struct {
*restclient.RESTClient
}
func (c *CoreClient) Services(namespace string) ServiceInterface {
return newServices(c, namespace)
}
// NewForConfig creates a new CoreClient for the given config.
func NewForConfig(c *restclient.Config) (*CoreClient, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &CoreClient{client}, nil
}
// NewForConfigOrDie creates a new CoreClient for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *CoreClient {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new CoreClient for the given RESTClient.
func New(c *restclient.RESTClient) *CoreClient {
return &CoreClient{c}
}
func setConfigDefaults(config *restclient.Config) error {
// if core group is not registered, return an error
g, err := registered.Group("")
if err != nil {
return err
}
config.APIPath = "/api"
if config.UserAgent == "" {
config.UserAgent = restclient.DefaultKubernetesUserAgent()
}
// TODO: Unconditionally set the config.Version, until we fix the config.
//if config.Version == "" {
copyGroupVersion := g.GroupVersion
config.GroupVersion = &copyGroupVersion
//}
config.NegotiatedSerializer = api.Codecs
if config.QPS == 0 {
config.QPS = 5
}
if config.Burst == 0 {
config.Burst = 10
}
return nil
}
// GetRESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *CoreClient) GetRESTClient() *restclient.RESTClient {
if c == nil {
return nil
}
return c.RESTClient
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service] --input=[../../federation/apis/federation/,api/]
// This package has the automatically generated typed clients.
package unversioned

View File

@ -0,0 +1,20 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service] --input=[../../federation/apis/federation/,api/]
// Package fake has the automatically generated clients.
package fake

View File

@ -0,0 +1,37 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 (
unversioned "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/core/unversioned"
restclient "k8s.io/kubernetes/pkg/client/restclient"
core "k8s.io/kubernetes/pkg/client/testing/core"
)
type FakeCore struct {
*core.Fake
}
func (c *FakeCore) Services(namespace string) unversioned.ServiceInterface {
return &FakeServices{c, namespace}
}
// GetRESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeCore) GetRESTClient() *restclient.RESTClient {
return nil
}

View File

@ -0,0 +1,115 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
core "k8s.io/kubernetes/pkg/client/testing/core"
labels "k8s.io/kubernetes/pkg/labels"
watch "k8s.io/kubernetes/pkg/watch"
)
// FakeServices implements ServiceInterface
type FakeServices struct {
Fake *FakeCore
ns string
}
var servicesResource = unversioned.GroupVersionResource{Group: "", Version: "", Resource: "services"}
func (c *FakeServices) Create(service *api.Service) (result *api.Service, err error) {
obj, err := c.Fake.
Invokes(core.NewCreateAction(servicesResource, c.ns, service), &api.Service{})
if obj == nil {
return nil, err
}
return obj.(*api.Service), err
}
func (c *FakeServices) Update(service *api.Service) (result *api.Service, err error) {
obj, err := c.Fake.
Invokes(core.NewUpdateAction(servicesResource, c.ns, service), &api.Service{})
if obj == nil {
return nil, err
}
return obj.(*api.Service), err
}
func (c *FakeServices) UpdateStatus(service *api.Service) (*api.Service, error) {
obj, err := c.Fake.
Invokes(core.NewUpdateSubresourceAction(servicesResource, "status", c.ns, service), &api.Service{})
if obj == nil {
return nil, err
}
return obj.(*api.Service), err
}
func (c *FakeServices) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.
Invokes(core.NewDeleteAction(servicesResource, c.ns, name), &api.Service{})
return err
}
func (c *FakeServices) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := core.NewDeleteCollectionAction(servicesResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &api.ServiceList{})
return err
}
func (c *FakeServices) Get(name string) (result *api.Service, err error) {
obj, err := c.Fake.
Invokes(core.NewGetAction(servicesResource, c.ns, name), &api.Service{})
if obj == nil {
return nil, err
}
return obj.(*api.Service), err
}
func (c *FakeServices) List(opts api.ListOptions) (result *api.ServiceList, err error) {
obj, err := c.Fake.
Invokes(core.NewListAction(servicesResource, c.ns, opts), &api.ServiceList{})
if obj == nil {
return nil, err
}
label := opts.LabelSelector
if label == nil {
label = labels.Everything()
}
list := &api.ServiceList{}
for _, item := range obj.(*api.ServiceList).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 services.
func (c *FakeServices) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(core.NewWatchAction(servicesResource, c.ns, opts))
}

View File

@ -0,0 +1,19 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 unversioned
type ServiceExpansion interface{}

View File

@ -0,0 +1,149 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 unversioned
import (
api "k8s.io/kubernetes/pkg/api"
watch "k8s.io/kubernetes/pkg/watch"
)
// ServicesGetter has a method to return a ServiceInterface.
// A group's client should implement this interface.
type ServicesGetter interface {
Services(namespace string) ServiceInterface
}
// ServiceInterface has methods to work with Service resources.
type ServiceInterface interface {
Create(*api.Service) (*api.Service, error)
Update(*api.Service) (*api.Service, error)
UpdateStatus(*api.Service) (*api.Service, error)
Delete(name string, options *api.DeleteOptions) error
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
Get(name string) (*api.Service, error)
List(opts api.ListOptions) (*api.ServiceList, error)
Watch(opts api.ListOptions) (watch.Interface, error)
ServiceExpansion
}
// services implements ServiceInterface
type services struct {
client *CoreClient
ns string
}
// newServices returns a Services
func newServices(c *CoreClient, namespace string) *services {
return &services{
client: c,
ns: namespace,
}
}
// Create takes the representation of a service and creates it. Returns the server's representation of the service, and an error, if there is any.
func (c *services) Create(service *api.Service) (result *api.Service, err error) {
result = &api.Service{}
err = c.client.Post().
Namespace(c.ns).
Resource("services").
Body(service).
Do().
Into(result)
return
}
// Update takes the representation of a service and updates it. Returns the server's representation of the service, and an error, if there is any.
func (c *services) Update(service *api.Service) (result *api.Service, err error) {
result = &api.Service{}
err = c.client.Put().
Namespace(c.ns).
Resource("services").
Name(service.Name).
Body(service).
Do().
Into(result)
return
}
func (c *services) UpdateStatus(service *api.Service) (result *api.Service, err error) {
result = &api.Service{}
err = c.client.Put().
Namespace(c.ns).
Resource("services").
Name(service.Name).
SubResource("status").
Body(service).
Do().
Into(result)
return
}
// Delete takes name of the service and deletes it. Returns an error if one occurs.
func (c *services) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("services").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *services) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("services").
VersionedParams(&listOptions, api.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the service, and returns the corresponding service object, and an error if there is any.
func (c *services) Get(name string) (result *api.Service, err error) {
result = &api.Service{}
err = c.client.Get().
Namespace(c.ns).
Resource("services").
Name(name).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Services that match those selectors.
func (c *services) List(opts api.ListOptions) (result *api.ServiceList, err error) {
result = &api.ServiceList{}
err = c.client.Get().
Namespace(c.ns).
Resource("services").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested services.
func (c *services) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("services").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[../../federation/apis/federation/]
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service] --input=[../../federation/apis/federation/,api/]
// This package has the automatically generated typed clients.
package unversioned

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[../../federation/apis/federation/]
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/Service] --input=[../../federation/apis/federation/,api/]
// Package fake has the automatically generated clients.
package fake

View File

@ -18,6 +18,7 @@ package federation_release_1_3
import (
"github.com/golang/glog"
v1core "k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_3/typed/core/v1"
v1alpha1federation "k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_3/typed/federation/v1alpha1"
restclient "k8s.io/kubernetes/pkg/client/restclient"
discovery "k8s.io/kubernetes/pkg/client/typed/discovery"
@ -27,6 +28,7 @@ import (
type Interface interface {
Discovery() discovery.DiscoveryInterface
Federation() v1alpha1federation.FederationInterface
Core() v1core.CoreInterface
}
// Clientset contains the clients for groups. Each group has exactly one
@ -34,6 +36,7 @@ type Interface interface {
type Clientset struct {
*discovery.DiscoveryClient
*v1alpha1federation.FederationClient
*v1core.CoreClient
}
// Federation retrieves the FederationClient
@ -44,6 +47,14 @@ func (c *Clientset) Federation() v1alpha1federation.FederationInterface {
return c.FederationClient
}
// Core retrieves the CoreClient
func (c *Clientset) Core() v1core.CoreInterface {
if c == nil {
return nil
}
return c.CoreClient
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
return c.DiscoveryClient
@ -61,6 +72,10 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) {
if err != nil {
return &clientset, err
}
clientset.CoreClient, err = v1core.NewForConfig(&configShallowCopy)
if err != nil {
return &clientset, err
}
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil {
@ -74,6 +89,7 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) {
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset
clientset.FederationClient = v1alpha1federation.NewForConfigOrDie(c)
clientset.CoreClient = v1core.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset
@ -83,6 +99,7 @@ func NewForConfigOrDie(c *restclient.Config) *Clientset {
func New(c *restclient.RESTClient) *Clientset {
var clientset Clientset
clientset.FederationClient = v1alpha1federation.New(c)
clientset.CoreClient = v1core.New(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &clientset

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_3 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[../../federation/apis/federation/v1alpha1]
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_3 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service] --input=[../../federation/apis/federation/v1alpha1,api/v1]
// This package has the automatically generated clientset.
package federation_release_1_3

View File

@ -18,6 +18,8 @@ package fake
import (
clientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_3"
v1core "k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_3/typed/core/v1"
fakev1core "k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_3/typed/core/v1/fake"
v1alpha1federation "k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_3/typed/federation/v1alpha1"
fakev1alpha1federation "k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_3/typed/federation/v1alpha1/fake"
"k8s.io/kubernetes/pkg/api"
@ -63,3 +65,8 @@ var _ clientset.Interface = &Clientset{}
func (c *Clientset) Federation() v1alpha1federation.FederationInterface {
return &fakev1alpha1federation.FakeFederation{Fake: &c.Fake}
}
// Core retrieves the CoreClient
func (c *Clientset) Core() v1core.CoreInterface {
return &fakev1core.FakeCore{Fake: &c.Fake}
}

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_3 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[../../federation/apis/federation/v1alpha1]
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_3 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service] --input=[../../federation/apis/federation/v1alpha1,api/v1]
// This package has the automatically generated fake clientset.
package fake

View File

@ -0,0 +1,101 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 v1
import (
api "k8s.io/kubernetes/pkg/api"
registered "k8s.io/kubernetes/pkg/apimachinery/registered"
restclient "k8s.io/kubernetes/pkg/client/restclient"
)
type CoreInterface interface {
GetRESTClient() *restclient.RESTClient
ServicesGetter
}
// CoreClient is used to interact with features provided by the Core group.
type CoreClient struct {
*restclient.RESTClient
}
func (c *CoreClient) Services(namespace string) ServiceInterface {
return newServices(c, namespace)
}
// NewForConfig creates a new CoreClient for the given config.
func NewForConfig(c *restclient.Config) (*CoreClient, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &CoreClient{client}, nil
}
// NewForConfigOrDie creates a new CoreClient for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *CoreClient {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new CoreClient for the given RESTClient.
func New(c *restclient.RESTClient) *CoreClient {
return &CoreClient{c}
}
func setConfigDefaults(config *restclient.Config) error {
// if core group is not registered, return an error
g, err := registered.Group("")
if err != nil {
return err
}
config.APIPath = "/api"
if config.UserAgent == "" {
config.UserAgent = restclient.DefaultKubernetesUserAgent()
}
// TODO: Unconditionally set the config.Version, until we fix the config.
//if config.Version == "" {
copyGroupVersion := g.GroupVersion
config.GroupVersion = &copyGroupVersion
//}
config.NegotiatedSerializer = api.Codecs
if config.QPS == 0 {
config.QPS = 5
}
if config.Burst == 0 {
config.Burst = 10
}
return nil
}
// GetRESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *CoreClient) GetRESTClient() *restclient.RESTClient {
if c == nil {
return nil
}
return c.RESTClient
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 arguments: --clientset-name=federation_release_1_3 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service] --input=[../../federation/apis/federation/v1alpha1,api/v1]
// This package has the automatically generated typed clients.
package v1

View File

@ -0,0 +1,20 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 arguments: --clientset-name=federation_release_1_3 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service] --input=[../../federation/apis/federation/v1alpha1,api/v1]
// Package fake has the automatically generated clients.
package fake

View File

@ -0,0 +1,37 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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/kubernetes/federation/client/clientset_generated/federation_release_1_3/typed/core/v1"
restclient "k8s.io/kubernetes/pkg/client/restclient"
core "k8s.io/kubernetes/pkg/client/testing/core"
)
type FakeCore struct {
*core.Fake
}
func (c *FakeCore) Services(namespace string) v1.ServiceInterface {
return &FakeServices{c, namespace}
}
// GetRESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeCore) GetRESTClient() *restclient.RESTClient {
return nil
}

View File

@ -0,0 +1,116 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
v1 "k8s.io/kubernetes/pkg/api/v1"
core "k8s.io/kubernetes/pkg/client/testing/core"
labels "k8s.io/kubernetes/pkg/labels"
watch "k8s.io/kubernetes/pkg/watch"
)
// FakeServices implements ServiceInterface
type FakeServices struct {
Fake *FakeCore
ns string
}
var servicesResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "services"}
func (c *FakeServices) Create(service *v1.Service) (result *v1.Service, err error) {
obj, err := c.Fake.
Invokes(core.NewCreateAction(servicesResource, c.ns, service), &v1.Service{})
if obj == nil {
return nil, err
}
return obj.(*v1.Service), err
}
func (c *FakeServices) Update(service *v1.Service) (result *v1.Service, err error) {
obj, err := c.Fake.
Invokes(core.NewUpdateAction(servicesResource, c.ns, service), &v1.Service{})
if obj == nil {
return nil, err
}
return obj.(*v1.Service), err
}
func (c *FakeServices) UpdateStatus(service *v1.Service) (*v1.Service, error) {
obj, err := c.Fake.
Invokes(core.NewUpdateSubresourceAction(servicesResource, "status", c.ns, service), &v1.Service{})
if obj == nil {
return nil, err
}
return obj.(*v1.Service), err
}
func (c *FakeServices) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.
Invokes(core.NewDeleteAction(servicesResource, c.ns, name), &v1.Service{})
return err
}
func (c *FakeServices) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := core.NewDeleteCollectionAction(servicesResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1.ServiceList{})
return err
}
func (c *FakeServices) Get(name string) (result *v1.Service, err error) {
obj, err := c.Fake.
Invokes(core.NewGetAction(servicesResource, c.ns, name), &v1.Service{})
if obj == nil {
return nil, err
}
return obj.(*v1.Service), err
}
func (c *FakeServices) List(opts api.ListOptions) (result *v1.ServiceList, err error) {
obj, err := c.Fake.
Invokes(core.NewListAction(servicesResource, c.ns, opts), &v1.ServiceList{})
if obj == nil {
return nil, err
}
label := opts.LabelSelector
if label == nil {
label = labels.Everything()
}
list := &v1.ServiceList{}
for _, item := range obj.(*v1.ServiceList).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 services.
func (c *FakeServices) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(core.NewWatchAction(servicesResource, c.ns, opts))
}

View File

@ -0,0 +1,19 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 v1
type ServiceExpansion interface{}

View File

@ -0,0 +1,150 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 v1
import (
api "k8s.io/kubernetes/pkg/api"
v1 "k8s.io/kubernetes/pkg/api/v1"
watch "k8s.io/kubernetes/pkg/watch"
)
// ServicesGetter has a method to return a ServiceInterface.
// A group's client should implement this interface.
type ServicesGetter interface {
Services(namespace string) ServiceInterface
}
// ServiceInterface has methods to work with Service resources.
type ServiceInterface interface {
Create(*v1.Service) (*v1.Service, error)
Update(*v1.Service) (*v1.Service, error)
UpdateStatus(*v1.Service) (*v1.Service, error)
Delete(name string, options *api.DeleteOptions) error
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
Get(name string) (*v1.Service, error)
List(opts api.ListOptions) (*v1.ServiceList, error)
Watch(opts api.ListOptions) (watch.Interface, error)
ServiceExpansion
}
// services implements ServiceInterface
type services struct {
client *CoreClient
ns string
}
// newServices returns a Services
func newServices(c *CoreClient, namespace string) *services {
return &services{
client: c,
ns: namespace,
}
}
// Create takes the representation of a service and creates it. Returns the server's representation of the service, and an error, if there is any.
func (c *services) Create(service *v1.Service) (result *v1.Service, err error) {
result = &v1.Service{}
err = c.client.Post().
Namespace(c.ns).
Resource("services").
Body(service).
Do().
Into(result)
return
}
// Update takes the representation of a service and updates it. Returns the server's representation of the service, and an error, if there is any.
func (c *services) Update(service *v1.Service) (result *v1.Service, err error) {
result = &v1.Service{}
err = c.client.Put().
Namespace(c.ns).
Resource("services").
Name(service.Name).
Body(service).
Do().
Into(result)
return
}
func (c *services) UpdateStatus(service *v1.Service) (result *v1.Service, err error) {
result = &v1.Service{}
err = c.client.Put().
Namespace(c.ns).
Resource("services").
Name(service.Name).
SubResource("status").
Body(service).
Do().
Into(result)
return
}
// Delete takes name of the service and deletes it. Returns an error if one occurs.
func (c *services) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("services").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *services) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("services").
VersionedParams(&listOptions, api.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the service, and returns the corresponding service object, and an error if there is any.
func (c *services) Get(name string) (result *v1.Service, err error) {
result = &v1.Service{}
err = c.client.Get().
Namespace(c.ns).
Resource("services").
Name(name).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Services that match those selectors.
func (c *services) List(opts api.ListOptions) (result *v1.ServiceList, err error) {
result = &v1.ServiceList{}
err = c.client.Get().
Namespace(c.ns).
Resource("services").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested services.
func (c *services) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("services").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_3 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[../../federation/apis/federation/v1alpha1]
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_3 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service] --input=[../../federation/apis/federation/v1alpha1,api/v1]
// This package has the automatically generated typed clients.
package v1alpha1

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_3 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[../../federation/apis/federation/v1alpha1]
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_3 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --included-types-overrides=[api/v1/Service] --input=[../../federation/apis/federation/v1alpha1,api/v1]
// Package fake has the automatically generated clients.
package fake