mirror of https://github.com/k3s-io/k3s
generated code
parent
4a176600fc
commit
adda69c7ca
|
@ -26,6 +26,7 @@ import (
|
||||||
unversionedcertificates "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/certificates/unversioned"
|
unversionedcertificates "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/certificates/unversioned"
|
||||||
unversionedcore "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned"
|
unversionedcore "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned"
|
||||||
unversionedextensions "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned"
|
unversionedextensions "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned"
|
||||||
|
unversionedpolicy "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/policy/unversioned"
|
||||||
unversionedrbac "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/rbac/unversioned"
|
unversionedrbac "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/rbac/unversioned"
|
||||||
unversionedstorage "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/storage/unversioned"
|
unversionedstorage "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/storage/unversioned"
|
||||||
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||||
|
@ -45,6 +46,7 @@ type Interface interface {
|
||||||
Rbac() unversionedrbac.RbacInterface
|
Rbac() unversionedrbac.RbacInterface
|
||||||
Storage() unversionedstorage.StorageInterface
|
Storage() unversionedstorage.StorageInterface
|
||||||
Apps() unversionedapps.AppsInterface
|
Apps() unversionedapps.AppsInterface
|
||||||
|
Policy() unversionedpolicy.PolicyInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clientset contains the clients for groups. Each group has exactly one
|
// Clientset contains the clients for groups. Each group has exactly one
|
||||||
|
@ -61,6 +63,7 @@ type Clientset struct {
|
||||||
*unversionedrbac.RbacClient
|
*unversionedrbac.RbacClient
|
||||||
*unversionedstorage.StorageClient
|
*unversionedstorage.StorageClient
|
||||||
*unversionedapps.AppsClient
|
*unversionedapps.AppsClient
|
||||||
|
*unversionedpolicy.PolicyClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// Core retrieves the CoreClient
|
// Core retrieves the CoreClient
|
||||||
|
@ -143,6 +146,14 @@ func (c *Clientset) Apps() unversionedapps.AppsInterface {
|
||||||
return c.AppsClient
|
return c.AppsClient
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Policy retrieves the PolicyClient
|
||||||
|
func (c *Clientset) Policy() unversionedpolicy.PolicyInterface {
|
||||||
|
if c == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return c.PolicyClient
|
||||||
|
}
|
||||||
|
|
||||||
// Discovery retrieves the DiscoveryClient
|
// Discovery retrieves the DiscoveryClient
|
||||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||||
return c.DiscoveryClient
|
return c.DiscoveryClient
|
||||||
|
@ -196,6 +207,10 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
clientset.PolicyClient, err = unversionedpolicy.NewForConfig(&configShallowCopy)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -219,6 +234,7 @@ func NewForConfigOrDie(c *restclient.Config) *Clientset {
|
||||||
clientset.RbacClient = unversionedrbac.NewForConfigOrDie(c)
|
clientset.RbacClient = unversionedrbac.NewForConfigOrDie(c)
|
||||||
clientset.StorageClient = unversionedstorage.NewForConfigOrDie(c)
|
clientset.StorageClient = unversionedstorage.NewForConfigOrDie(c)
|
||||||
clientset.AppsClient = unversionedapps.NewForConfigOrDie(c)
|
clientset.AppsClient = unversionedapps.NewForConfigOrDie(c)
|
||||||
|
clientset.PolicyClient = unversionedpolicy.NewForConfigOrDie(c)
|
||||||
|
|
||||||
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
||||||
return &clientset
|
return &clientset
|
||||||
|
@ -237,6 +253,7 @@ func New(c *restclient.RESTClient) *Clientset {
|
||||||
clientset.RbacClient = unversionedrbac.New(c)
|
clientset.RbacClient = unversionedrbac.New(c)
|
||||||
clientset.StorageClient = unversionedstorage.New(c)
|
clientset.StorageClient = unversionedstorage.New(c)
|
||||||
clientset.AppsClient = unversionedapps.New(c)
|
clientset.AppsClient = unversionedapps.New(c)
|
||||||
|
clientset.PolicyClient = unversionedpolicy.New(c)
|
||||||
|
|
||||||
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||||
return &clientset
|
return &clientset
|
||||||
|
|
|
@ -36,6 +36,8 @@ import (
|
||||||
fakeunversionedcore "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/fake"
|
fakeunversionedcore "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/fake"
|
||||||
unversionedextensions "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned"
|
unversionedextensions "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned"
|
||||||
fakeunversionedextensions "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned/fake"
|
fakeunversionedextensions "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned/fake"
|
||||||
|
unversionedpolicy "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/policy/unversioned"
|
||||||
|
fakeunversionedpolicy "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/policy/unversioned/fake"
|
||||||
unversionedrbac "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/rbac/unversioned"
|
unversionedrbac "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/rbac/unversioned"
|
||||||
fakeunversionedrbac "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/rbac/unversioned/fake"
|
fakeunversionedrbac "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/rbac/unversioned/fake"
|
||||||
unversionedstorage "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/storage/unversioned"
|
unversionedstorage "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/storage/unversioned"
|
||||||
|
@ -129,3 +131,8 @@ func (c *Clientset) Storage() unversionedstorage.StorageInterface {
|
||||||
func (c *Clientset) Apps() unversionedapps.AppsInterface {
|
func (c *Clientset) Apps() unversionedapps.AppsInterface {
|
||||||
return &fakeunversionedapps.FakeApps{Fake: &c.Fake}
|
return &fakeunversionedapps.FakeApps{Fake: &c.Fake}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Policy retrieves the PolicyClient
|
||||||
|
func (c *Clientset) Policy() unversionedpolicy.PolicyInterface {
|
||||||
|
return &fakeunversionedpolicy.FakePolicy{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
Copyright 2016 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 the default arguments.
|
||||||
|
|
||||||
|
// This package has the automatically generated typed clients.
|
||||||
|
package unversioned
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
Copyright 2016 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 the default arguments.
|
||||||
|
|
||||||
|
// Package fake has the automatically generated clients.
|
||||||
|
package fake
|
|
@ -0,0 +1,127 @@
|
||||||
|
/*
|
||||||
|
Copyright 2016 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 (
|
||||||
|
api "k8s.io/kubernetes/pkg/api"
|
||||||
|
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
|
policy "k8s.io/kubernetes/pkg/apis/policy"
|
||||||
|
core "k8s.io/kubernetes/pkg/client/testing/core"
|
||||||
|
labels "k8s.io/kubernetes/pkg/labels"
|
||||||
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FakePodDisruptionBudgets implements PodDisruptionBudgetInterface
|
||||||
|
type FakePodDisruptionBudgets struct {
|
||||||
|
Fake *FakePolicy
|
||||||
|
ns string
|
||||||
|
}
|
||||||
|
|
||||||
|
var poddisruptionbudgetsResource = unversioned.GroupVersionResource{Group: "policy", Version: "", Resource: "poddisruptionbudgets"}
|
||||||
|
|
||||||
|
func (c *FakePodDisruptionBudgets) Create(podDisruptionBudget *policy.PodDisruptionBudget) (result *policy.PodDisruptionBudget, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewCreateAction(poddisruptionbudgetsResource, c.ns, podDisruptionBudget), &policy.PodDisruptionBudget{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*policy.PodDisruptionBudget), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakePodDisruptionBudgets) Update(podDisruptionBudget *policy.PodDisruptionBudget) (result *policy.PodDisruptionBudget, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewUpdateAction(poddisruptionbudgetsResource, c.ns, podDisruptionBudget), &policy.PodDisruptionBudget{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*policy.PodDisruptionBudget), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakePodDisruptionBudgets) UpdateStatus(podDisruptionBudget *policy.PodDisruptionBudget) (*policy.PodDisruptionBudget, error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewUpdateSubresourceAction(poddisruptionbudgetsResource, "status", c.ns, podDisruptionBudget), &policy.PodDisruptionBudget{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*policy.PodDisruptionBudget), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakePodDisruptionBudgets) Delete(name string, options *api.DeleteOptions) error {
|
||||||
|
_, err := c.Fake.
|
||||||
|
Invokes(core.NewDeleteAction(poddisruptionbudgetsResource, c.ns, name), &policy.PodDisruptionBudget{})
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakePodDisruptionBudgets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||||
|
action := core.NewDeleteCollectionAction(poddisruptionbudgetsResource, c.ns, listOptions)
|
||||||
|
|
||||||
|
_, err := c.Fake.Invokes(action, &policy.PodDisruptionBudgetList{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakePodDisruptionBudgets) Get(name string) (result *policy.PodDisruptionBudget, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewGetAction(poddisruptionbudgetsResource, c.ns, name), &policy.PodDisruptionBudget{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*policy.PodDisruptionBudget), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakePodDisruptionBudgets) List(opts api.ListOptions) (result *policy.PodDisruptionBudgetList, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewListAction(poddisruptionbudgetsResource, c.ns, opts), &policy.PodDisruptionBudgetList{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
label := opts.LabelSelector
|
||||||
|
if label == nil {
|
||||||
|
label = labels.Everything()
|
||||||
|
}
|
||||||
|
list := &policy.PodDisruptionBudgetList{}
|
||||||
|
for _, item := range obj.(*policy.PodDisruptionBudgetList).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 podDisruptionBudgets.
|
||||||
|
func (c *FakePodDisruptionBudgets) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.Fake.
|
||||||
|
InvokesWatch(core.NewWatchAction(poddisruptionbudgetsResource, c.ns, opts))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched podDisruptionBudget.
|
||||||
|
func (c *FakePodDisruptionBudgets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *policy.PodDisruptionBudget, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewPatchSubresourceAction(poddisruptionbudgetsResource, c.ns, name, data, subresources...), &policy.PodDisruptionBudget{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*policy.PodDisruptionBudget), err
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
Copyright 2016 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 (
|
||||||
|
unversioned "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/policy/unversioned"
|
||||||
|
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||||
|
core "k8s.io/kubernetes/pkg/client/testing/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FakePolicy struct {
|
||||||
|
*core.Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakePolicy) PodDisruptionBudgets(namespace string) unversioned.PodDisruptionBudgetInterface {
|
||||||
|
return &FakePodDisruptionBudgets{c, namespace}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRESTClient returns a RESTClient that is used to communicate
|
||||||
|
// with API server by this client implementation.
|
||||||
|
func (c *FakePolicy) GetRESTClient() *restclient.RESTClient {
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
Copyright 2016 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 unversioned
|
||||||
|
|
||||||
|
type PodDisruptionBudgetExpansion interface{}
|
|
@ -0,0 +1,165 @@
|
||||||
|
/*
|
||||||
|
Copyright 2016 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 unversioned
|
||||||
|
|
||||||
|
import (
|
||||||
|
api "k8s.io/kubernetes/pkg/api"
|
||||||
|
policy "k8s.io/kubernetes/pkg/apis/policy"
|
||||||
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PodDisruptionBudgetsGetter has a method to return a PodDisruptionBudgetInterface.
|
||||||
|
// A group's client should implement this interface.
|
||||||
|
type PodDisruptionBudgetsGetter interface {
|
||||||
|
PodDisruptionBudgets(namespace string) PodDisruptionBudgetInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
// PodDisruptionBudgetInterface has methods to work with PodDisruptionBudget resources.
|
||||||
|
type PodDisruptionBudgetInterface interface {
|
||||||
|
Create(*policy.PodDisruptionBudget) (*policy.PodDisruptionBudget, error)
|
||||||
|
Update(*policy.PodDisruptionBudget) (*policy.PodDisruptionBudget, error)
|
||||||
|
UpdateStatus(*policy.PodDisruptionBudget) (*policy.PodDisruptionBudget, error)
|
||||||
|
Delete(name string, options *api.DeleteOptions) error
|
||||||
|
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
|
||||||
|
Get(name string) (*policy.PodDisruptionBudget, error)
|
||||||
|
List(opts api.ListOptions) (*policy.PodDisruptionBudgetList, error)
|
||||||
|
Watch(opts api.ListOptions) (watch.Interface, error)
|
||||||
|
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *policy.PodDisruptionBudget, err error)
|
||||||
|
PodDisruptionBudgetExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// podDisruptionBudgets implements PodDisruptionBudgetInterface
|
||||||
|
type podDisruptionBudgets struct {
|
||||||
|
client *PolicyClient
|
||||||
|
ns string
|
||||||
|
}
|
||||||
|
|
||||||
|
// newPodDisruptionBudgets returns a PodDisruptionBudgets
|
||||||
|
func newPodDisruptionBudgets(c *PolicyClient, namespace string) *podDisruptionBudgets {
|
||||||
|
return &podDisruptionBudgets{
|
||||||
|
client: c,
|
||||||
|
ns: namespace,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create takes the representation of a podDisruptionBudget and creates it. Returns the server's representation of the podDisruptionBudget, and an error, if there is any.
|
||||||
|
func (c *podDisruptionBudgets) Create(podDisruptionBudget *policy.PodDisruptionBudget) (result *policy.PodDisruptionBudget, err error) {
|
||||||
|
result = &policy.PodDisruptionBudget{}
|
||||||
|
err = c.client.Post().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("poddisruptionbudgets").
|
||||||
|
Body(podDisruptionBudget).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update takes the representation of a podDisruptionBudget and updates it. Returns the server's representation of the podDisruptionBudget, and an error, if there is any.
|
||||||
|
func (c *podDisruptionBudgets) Update(podDisruptionBudget *policy.PodDisruptionBudget) (result *policy.PodDisruptionBudget, err error) {
|
||||||
|
result = &policy.PodDisruptionBudget{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("poddisruptionbudgets").
|
||||||
|
Name(podDisruptionBudget.Name).
|
||||||
|
Body(podDisruptionBudget).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *podDisruptionBudgets) UpdateStatus(podDisruptionBudget *policy.PodDisruptionBudget) (result *policy.PodDisruptionBudget, err error) {
|
||||||
|
result = &policy.PodDisruptionBudget{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("poddisruptionbudgets").
|
||||||
|
Name(podDisruptionBudget.Name).
|
||||||
|
SubResource("status").
|
||||||
|
Body(podDisruptionBudget).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete takes name of the podDisruptionBudget and deletes it. Returns an error if one occurs.
|
||||||
|
func (c *podDisruptionBudgets) Delete(name string, options *api.DeleteOptions) error {
|
||||||
|
return c.client.Delete().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("poddisruptionbudgets").
|
||||||
|
Name(name).
|
||||||
|
Body(options).
|
||||||
|
Do().
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCollection deletes a collection of objects.
|
||||||
|
func (c *podDisruptionBudgets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||||
|
return c.client.Delete().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("poddisruptionbudgets").
|
||||||
|
VersionedParams(&listOptions, api.ParameterCodec).
|
||||||
|
Body(options).
|
||||||
|
Do().
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get takes name of the podDisruptionBudget, and returns the corresponding podDisruptionBudget object, and an error if there is any.
|
||||||
|
func (c *podDisruptionBudgets) Get(name string) (result *policy.PodDisruptionBudget, err error) {
|
||||||
|
result = &policy.PodDisruptionBudget{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("poddisruptionbudgets").
|
||||||
|
Name(name).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List takes label and field selectors, and returns the list of PodDisruptionBudgets that match those selectors.
|
||||||
|
func (c *podDisruptionBudgets) List(opts api.ListOptions) (result *policy.PodDisruptionBudgetList, err error) {
|
||||||
|
result = &policy.PodDisruptionBudgetList{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("poddisruptionbudgets").
|
||||||
|
VersionedParams(&opts, api.ParameterCodec).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested podDisruptionBudgets.
|
||||||
|
func (c *podDisruptionBudgets) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.client.Get().
|
||||||
|
Prefix("watch").
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("poddisruptionbudgets").
|
||||||
|
VersionedParams(&opts, api.ParameterCodec).
|
||||||
|
Watch()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched podDisruptionBudget.
|
||||||
|
func (c *podDisruptionBudgets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *policy.PodDisruptionBudget, err error) {
|
||||||
|
result = &policy.PodDisruptionBudget{}
|
||||||
|
err = c.client.Patch(pt).
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("poddisruptionbudgets").
|
||||||
|
SubResource(subresources...).
|
||||||
|
Name(name).
|
||||||
|
Body(data).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
/*
|
||||||
|
Copyright 2016 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 unversioned
|
||||||
|
|
||||||
|
import (
|
||||||
|
api "k8s.io/kubernetes/pkg/api"
|
||||||
|
registered "k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||||
|
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PolicyInterface interface {
|
||||||
|
GetRESTClient() *restclient.RESTClient
|
||||||
|
PodDisruptionBudgetsGetter
|
||||||
|
}
|
||||||
|
|
||||||
|
// PolicyClient is used to interact with features provided by the Policy group.
|
||||||
|
type PolicyClient struct {
|
||||||
|
*restclient.RESTClient
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *PolicyClient) PodDisruptionBudgets(namespace string) PodDisruptionBudgetInterface {
|
||||||
|
return newPodDisruptionBudgets(c, namespace)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfig creates a new PolicyClient for the given config.
|
||||||
|
func NewForConfig(c *restclient.Config) (*PolicyClient, error) {
|
||||||
|
config := *c
|
||||||
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
client, err := restclient.RESTClientFor(&config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &PolicyClient{client}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigOrDie creates a new PolicyClient for the given config and
|
||||||
|
// panics if there is an error in the config.
|
||||||
|
func NewForConfigOrDie(c *restclient.Config) *PolicyClient {
|
||||||
|
client, err := NewForConfig(c)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return client
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new PolicyClient for the given RESTClient.
|
||||||
|
func New(c *restclient.RESTClient) *PolicyClient {
|
||||||
|
return &PolicyClient{c}
|
||||||
|
}
|
||||||
|
|
||||||
|
func setConfigDefaults(config *restclient.Config) error {
|
||||||
|
// if policy group is not registered, return an error
|
||||||
|
g, err := registered.Group("policy")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
config.APIPath = "/apis"
|
||||||
|
if config.UserAgent == "" {
|
||||||
|
config.UserAgent = restclient.DefaultKubernetesUserAgent()
|
||||||
|
}
|
||||||
|
if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group {
|
||||||
|
copyGroupVersion := g.GroupVersion
|
||||||
|
config.GroupVersion = ©GroupVersion
|
||||||
|
}
|
||||||
|
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 *PolicyClient) GetRESTClient() *restclient.RESTClient {
|
||||||
|
if c == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return c.RESTClient
|
||||||
|
}
|
Loading…
Reference in New Issue