Update godeps

This commit is contained in:
Manuel de Brito Fontes 2016-11-10 19:57:28 -03:00
parent 1c8773fc98
commit 1bc383f9c5
1723 changed files with 287976 additions and 411028 deletions

52
vendor/k8s.io/kubernetes/pkg/client/unversioned/BUILD generated vendored Normal file
View file

@ -0,0 +1,52 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
"go_test",
"cgo_library",
)
go_library(
name = "go_default_library",
srcs = [
"conditions.go",
"helper.go",
],
tags = ["automanaged"],
deps = [
"//pkg/api:go_default_library",
"//pkg/api/errors:go_default_library",
"//pkg/api/unversioned:go_default_library",
"//pkg/apimachinery/registered:go_default_library",
"//pkg/apis/apps:go_default_library",
"//pkg/apis/batch:go_default_library",
"//pkg/apis/extensions:go_default_library",
"//pkg/client/clientset_generated/internalclientset/typed/apps/internalversion:go_default_library",
"//pkg/client/clientset_generated/internalclientset/typed/batch/internalversion:go_default_library",
"//pkg/client/clientset_generated/internalclientset/typed/core/internalversion:go_default_library",
"//pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion:go_default_library",
"//pkg/client/restclient:go_default_library",
"//pkg/util/wait:go_default_library",
"//pkg/watch:go_default_library",
"//plugin/pkg/client/auth:go_default_library",
],
)
go_test(
name = "go_default_test",
srcs = ["helper_test.go"],
library = "go_default_library",
tags = ["automanaged"],
deps = [
"//pkg/api:go_default_library",
"//pkg/api/testapi:go_default_library",
"//pkg/api/unversioned:go_default_library",
"//pkg/apimachinery/registered:go_default_library",
"//pkg/client/restclient:go_default_library",
"//pkg/runtime:go_default_library",
],
)

View file

@ -1,79 +0,0 @@
/*
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 internalclientset
import (
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
unversionedauthentication "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/authentication/unversioned"
unversionedauthorization "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/authorization/unversioned"
unversionedautoscaling "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/autoscaling/unversioned"
unversionedbatch "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/batch/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"
unversionedstorage "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/storage/unversioned"
"k8s.io/kubernetes/pkg/client/typed/discovery"
"k8s.io/kubernetes/pkg/client/unversioned"
)
// FromUnversionedClient adapts a unversioned.Client to a internalclientset.Clientset.
// This function is temporary. We will remove it when everyone has moved to using
// Clientset. New code should NOT use this function.
func FromUnversionedClient(c *unversioned.Client) *internalclientset.Clientset {
var clientset internalclientset.Clientset
if c != nil {
clientset.CoreClient = unversionedcore.New(c.RESTClient)
} else {
clientset.CoreClient = unversionedcore.New(nil)
}
if c != nil && c.ExtensionsClient != nil {
clientset.ExtensionsClient = unversionedextensions.New(c.ExtensionsClient.RESTClient)
} else {
clientset.ExtensionsClient = unversionedextensions.New(nil)
}
if c != nil && c.BatchClient != nil {
clientset.BatchClient = unversionedbatch.New(c.BatchClient.RESTClient)
} else {
clientset.BatchClient = unversionedbatch.New(nil)
}
if c != nil && c.AuthorizationClient != nil {
clientset.AuthorizationClient = unversionedauthorization.New(c.AuthorizationClient.RESTClient)
} else {
clientset.AuthorizationClient = unversionedauthorization.New(nil)
}
if c != nil && c.AutoscalingClient != nil {
clientset.AutoscalingClient = unversionedautoscaling.New(c.AutoscalingClient.RESTClient)
} else {
clientset.AutoscalingClient = unversionedautoscaling.New(nil)
}
if c != nil && c.AuthenticationClient != nil {
clientset.AuthenticationClient = unversionedauthentication.New(c.AuthenticationClient.RESTClient)
} else {
clientset.AuthenticationClient = unversionedauthentication.New(nil)
}
if c != nil && c.DiscoveryClient != nil {
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c.DiscoveryClient.RESTClient)
} else {
clientset.DiscoveryClient = discovery.NewDiscoveryClient(nil)
}
if c != nil && c.StorageClient != nil {
clientset.StorageClient = unversionedstorage.New(c.StorageClient.RESTClient)
} else {
clientset.StorageClient = unversionedstorage.New(nil)
}
return &clientset
}

View file

@ -1,55 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/apis/apps"
"k8s.io/kubernetes/pkg/client/restclient"
)
type AppsInterface interface {
PetSetNamespacer
}
// AppsClient is used to interact with Kubernetes batch features.
type AppsClient struct {
*restclient.RESTClient
}
func (c *AppsClient) PetSets(namespace string) PetSetInterface {
return newPetSet(c, namespace)
}
func NewApps(c *restclient.Config) (*AppsClient, error) {
config := *c
if err := setGroupDefaults(apps.GroupName, &config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &AppsClient{client}, nil
}
func NewAppsOrDie(c *restclient.Config) *AppsClient {
client, err := NewApps(c)
if err != nil {
panic(err)
}
return client
}

View file

@ -0,0 +1,25 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
"go_test",
"cgo_library",
)
go_library(
name = "go_default_library",
srcs = ["clientauth.go"],
tags = ["automanaged"],
deps = ["//pkg/client/restclient:go_default_library"],
)
go_test(
name = "go_default_xtest",
srcs = ["clientauth_test.go"],
tags = ["automanaged"],
deps = ["//pkg/client/unversioned/auth:go_default_library"],
)

View file

@ -1,77 +0,0 @@
/*
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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apimachinery/registered"
"k8s.io/kubernetes/pkg/apis/authentication"
"k8s.io/kubernetes/pkg/client/restclient"
)
type AuthenticationInterface interface {
TokenReviewsInterface
}
// AuthenticationClient is used to interact with Kubernetes authentication features.
type AuthenticationClient struct {
*restclient.RESTClient
}
func (c *AuthenticationClient) TokenReviews() TokenReviewInterface {
return newTokenReviews(c)
}
func NewAuthentication(c *restclient.Config) (*AuthenticationClient, error) {
config := *c
if err := setAuthenticationDefaults(&config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &AuthenticationClient{client}, nil
}
func NewAuthenticationOrDie(c *restclient.Config) *AuthenticationClient {
client, err := NewAuthentication(c)
if err != nil {
panic(err)
}
return client
}
func setAuthenticationDefaults(config *restclient.Config) error {
// if authentication group is not registered, return an error
g, err := registered.Group(authentication.GroupName)
if err != nil {
return err
}
config.APIPath = defaultAPIPath
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
return nil
}

View file

@ -1,77 +0,0 @@
/*
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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apimachinery/registered"
"k8s.io/kubernetes/pkg/apis/authorization"
"k8s.io/kubernetes/pkg/client/restclient"
)
type AuthorizationInterface interface {
SubjectAccessReviewsInterface
}
// AuthorizationClient is used to interact with Kubernetes authorization features.
type AuthorizationClient struct {
*restclient.RESTClient
}
func (c *AuthorizationClient) SubjectAccessReviews() SubjectAccessReviewInterface {
return newSubjectAccessReviews(c)
}
func NewAuthorization(c *restclient.Config) (*AuthorizationClient, error) {
config := *c
if err := setAuthorizationDefaults(&config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &AuthorizationClient{client}, nil
}
func NewAuthorizationOrDie(c *restclient.Config) *AuthorizationClient {
client, err := NewAuthorization(c)
if err != nil {
panic(err)
}
return client
}
func setAuthorizationDefaults(config *restclient.Config) error {
// if authorization group is not registered, return an error
g, err := registered.Group(authorization.GroupName)
if err != nil {
return err
}
config.APIPath = defaultAPIPath
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
return nil
}

View file

@ -1,55 +0,0 @@
/*
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 (
"k8s.io/kubernetes/pkg/apis/autoscaling"
"k8s.io/kubernetes/pkg/client/restclient"
)
type AutoscalingInterface interface {
HorizontalPodAutoscalersNamespacer
}
// AutoscalingClient is used to interact with Kubernetes autoscaling features.
type AutoscalingClient struct {
*restclient.RESTClient
}
func (c *AutoscalingClient) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface {
return newHorizontalPodAutoscalers(c, namespace)
}
func NewAutoscaling(c *restclient.Config) (*AutoscalingClient, error) {
config := *c
if err := setGroupDefaults(autoscaling.GroupName, &config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &AutoscalingClient{client}, nil
}
func NewAutoscalingOrDie(c *restclient.Config) *AutoscalingClient {
client, err := NewAutoscaling(c)
if err != nil {
panic(err)
}
return client
}

View file

@ -1,60 +0,0 @@
/*
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 (
"k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/client/restclient"
)
type BatchInterface interface {
JobsNamespacer
ScheduledJobsNamespacer
}
// BatchClient is used to interact with Kubernetes batch features.
type BatchClient struct {
*restclient.RESTClient
}
func (c *BatchClient) Jobs(namespace string) JobInterface {
return newJobsV1(c, namespace)
}
func (c *BatchClient) ScheduledJobs(namespace string) ScheduledJobInterface {
return newScheduledJobs(c, namespace)
}
func NewBatch(c *restclient.Config) (*BatchClient, error) {
config := *c
if err := setGroupDefaults(batch.GroupName, &config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &BatchClient{client}, nil
}
func NewBatchOrDie(c *restclient.Config) *BatchClient {
client, err := NewBatch(c)
if err != nil {
panic(err)
}
return client
}

View file

@ -1,69 +0,0 @@
/*
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 (
"k8s.io/kubernetes/pkg/apis/certificates"
"k8s.io/kubernetes/pkg/client/restclient"
)
// Interface holds the methods for clients of Kubernetes to allow mock testing.
type CertificatesInterface interface {
CertificateSigningRequests() CertificateSigningRequestInterface
}
type CertificatesClient struct {
*restclient.RESTClient
}
func (c *CertificatesClient) CertificateSigningRequests() CertificateSigningRequestInterface {
return newCertificateSigningRequests(c)
}
// NewCertificates creates a new CertificatesClient for the given config.
func NewCertificates(c *restclient.Config) (*CertificatesClient, error) {
config := *c
if err := setCertificatesDefaults(&config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &CertificatesClient{client}, nil
}
// NewCertificatesOrDie creates a new CertificatesClient for the given config and
// panics if there is an error in the config.
func NewCertificatesOrDie(c *restclient.Config) *CertificatesClient {
client, err := NewCertificates(c)
if err != nil {
panic(err)
}
return client
}
func setCertificatesDefaults(config *restclient.Config) error {
setGroupDefaults(certificates.GroupName, config)
if config.QPS == 0 {
config.QPS = 5
}
if config.Burst == 0 {
config.Burst = 10
}
return nil
}

View file

@ -1,104 +0,0 @@
/*
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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/certificates"
"k8s.io/kubernetes/pkg/watch"
)
// CertificateSigningRequestInterface has methods to work with CertificateSigningRequest resources.
type CertificateSigningRequestInterface interface {
List(opts api.ListOptions) (*certificates.CertificateSigningRequestList, error)
Get(name string) (*certificates.CertificateSigningRequest, error)
Delete(name string, options *api.DeleteOptions) error
Create(certificateSigningRequest *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error)
Update(certificateSigningRequest *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error)
UpdateStatus(certificateSigningRequest *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error)
UpdateApproval(certificateSigningRequest *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error)
Watch(opts api.ListOptions) (watch.Interface, error)
}
// certificateSigningRequests implements CertificateSigningRequestsNamespacer interface
type certificateSigningRequests struct {
client *CertificatesClient
}
// newCertificateSigningRequests returns a certificateSigningRequests
func newCertificateSigningRequests(c *CertificatesClient) *certificateSigningRequests {
return &certificateSigningRequests{
client: c,
}
}
// List takes label and field selectors, and returns the list of certificateSigningRequests that match those selectors.
func (c *certificateSigningRequests) List(opts api.ListOptions) (result *certificates.CertificateSigningRequestList, err error) {
result = &certificates.CertificateSigningRequestList{}
err = c.client.Get().Resource("certificatesigningrequests").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get takes the name of the certificateSigningRequest, and returns the corresponding CertificateSigningRequest object, and an error if it occurs
func (c *certificateSigningRequests) Get(name string) (result *certificates.CertificateSigningRequest, err error) {
result = &certificates.CertificateSigningRequest{}
err = c.client.Get().Resource("certificatesigningrequests").Name(name).Do().Into(result)
return
}
// Delete takes the name of the certificateSigningRequest and deletes it. Returns an error if one occurs.
func (c *certificateSigningRequests) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().Resource("certificatesigningrequests").Name(name).Body(options).Do().Error()
}
// Create takes the representation of a certificateSigningRequest and creates it. Returns the server's representation of the certificateSigningRequest, and an error, if it occurs.
func (c *certificateSigningRequests) Create(certificateSigningRequest *certificates.CertificateSigningRequest) (result *certificates.CertificateSigningRequest, err error) {
result = &certificates.CertificateSigningRequest{}
err = c.client.Post().Resource("certificatesigningrequests").Body(certificateSigningRequest).Do().Into(result)
return
}
// Update takes the representation of a certificateSigningRequest and updates it. Returns the server's representation of the certificateSigningRequest, and an error, if it occurs.
func (c *certificateSigningRequests) Update(certificateSigningRequest *certificates.CertificateSigningRequest) (result *certificates.CertificateSigningRequest, err error) {
result = &certificates.CertificateSigningRequest{}
err = c.client.Put().Resource("certificatesigningrequests").Name(certificateSigningRequest.Name).Body(certificateSigningRequest).Do().Into(result)
return
}
// UpdateStatus takes the representation of a certificateSigningRequest and updates it. Returns the server's representation of the certificateSigningRequest, and an error, if it occurs.
func (c *certificateSigningRequests) UpdateStatus(certificateSigningRequest *certificates.CertificateSigningRequest) (result *certificates.CertificateSigningRequest, err error) {
result = &certificates.CertificateSigningRequest{}
err = c.client.Put().Resource("certificatesigningrequests").Name(certificateSigningRequest.Name).SubResource("status").Body(certificateSigningRequest).Do().Into(result)
return
}
// UpdateApproval takes the representation of a certificateSigningRequest and updates it. Returns the server's representation of the certificateSigningRequest, and an error, if it occurs.
func (c *certificateSigningRequests) UpdateApproval(certificateSigningRequest *certificates.CertificateSigningRequest) (result *certificates.CertificateSigningRequest, err error) {
result = &certificates.CertificateSigningRequest{}
err = c.client.Put().Resource("certificatesigningrequests").Name(certificateSigningRequest.Name).SubResource("approval").Body(certificateSigningRequest).Do().Into(result)
return
}
// Watch returns a watch.Interface that watches the requested certificateSigningRequests.
func (c *certificateSigningRequests) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(api.NamespaceAll).
Resource("certificatesigningrequests").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,202 +0,0 @@
/*
Copyright 2014 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 (
"net"
"net/url"
"strings"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/client/typed/discovery"
)
// Interface holds the methods for clients of Kubernetes,
// an interface to allow mock testing.
type Interface interface {
PodsNamespacer
PodTemplatesNamespacer
ReplicationControllersNamespacer
ServicesNamespacer
EndpointsNamespacer
NodesInterface
EventNamespacer
LimitRangesNamespacer
ResourceQuotasNamespacer
ServiceAccountsNamespacer
SecretsNamespacer
NamespacesInterface
PersistentVolumesInterface
PersistentVolumeClaimsNamespacer
ComponentStatusesInterface
ConfigMapsNamespacer
Apps() AppsInterface
Authorization() AuthorizationInterface
Autoscaling() AutoscalingInterface
Authentication() AuthenticationInterface
Batch() BatchInterface
Extensions() ExtensionsInterface
Rbac() RbacInterface
Discovery() discovery.DiscoveryInterface
Certificates() CertificatesInterface
Storage() StorageInterface
}
func (c *Client) ReplicationControllers(namespace string) ReplicationControllerInterface {
return newReplicationControllers(c, namespace)
}
func (c *Client) Nodes() NodeInterface {
return newNodes(c)
}
func (c *Client) Events(namespace string) EventInterface {
return newEvents(c, namespace)
}
func (c *Client) Endpoints(namespace string) EndpointsInterface {
return newEndpoints(c, namespace)
}
func (c *Client) Pods(namespace string) PodInterface {
return newPods(c, namespace)
}
func (c *Client) PodTemplates(namespace string) PodTemplateInterface {
return newPodTemplates(c, namespace)
}
func (c *Client) Services(namespace string) ServiceInterface {
return newServices(c, namespace)
}
func (c *Client) LimitRanges(namespace string) LimitRangeInterface {
return newLimitRanges(c, namespace)
}
func (c *Client) ResourceQuotas(namespace string) ResourceQuotaInterface {
return newResourceQuotas(c, namespace)
}
func (c *Client) ServiceAccounts(namespace string) ServiceAccountsInterface {
return newServiceAccounts(c, namespace)
}
func (c *Client) Secrets(namespace string) SecretsInterface {
return newSecrets(c, namespace)
}
func (c *Client) Namespaces() NamespaceInterface {
return newNamespaces(c)
}
func (c *Client) PersistentVolumes() PersistentVolumeInterface {
return newPersistentVolumes(c)
}
func (c *Client) PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface {
return newPersistentVolumeClaims(c, namespace)
}
func (c *Client) ComponentStatuses() ComponentStatusInterface {
return newComponentStatuses(c)
}
func (c *Client) ConfigMaps(namespace string) ConfigMapsInterface {
return newConfigMaps(c, namespace)
}
// Client is the implementation of a Kubernetes client.
type Client struct {
*restclient.RESTClient
*AuthorizationClient
*AutoscalingClient
*AuthenticationClient
*BatchClient
*ExtensionsClient
*AppsClient
*PolicyClient
*RbacClient
*discovery.DiscoveryClient
*CertificatesClient
*StorageClient
}
// IsTimeout tests if this is a timeout error in the underlying transport.
// This is unbelievably ugly.
// See: http://stackoverflow.com/questions/23494950/specifically-check-for-timeout-error for details
func IsTimeout(err error) bool {
if err == nil {
return false
}
switch err := err.(type) {
case *url.Error:
if err, ok := err.Err.(net.Error); ok {
return err.Timeout()
}
case net.Error:
return err.Timeout()
}
if strings.Contains(err.Error(), "use of closed network connection") {
return true
}
return false
}
func (c *Client) Authorization() AuthorizationInterface {
return c.AuthorizationClient
}
func (c *Client) Autoscaling() AutoscalingInterface {
return c.AutoscalingClient
}
func (c *Client) Authentication() AuthenticationInterface {
return c.AuthenticationClient
}
func (c *Client) Batch() BatchInterface {
return c.BatchClient
}
func (c *Client) Extensions() ExtensionsInterface {
return c.ExtensionsClient
}
func (c *Client) Apps() AppsInterface {
return c.AppsClient
}
func (c *Client) Rbac() RbacInterface {
return c.RbacClient
}
func (c *Client) Policy() PolicyInterface {
return c.PolicyClient
}
func (c *Client) Discovery() discovery.DiscoveryInterface {
return c.DiscoveryClient
}
func (c *Client) Certificates() CertificatesInterface {
return c.CertificatesClient
}
func (c *Client) Storage() StorageInterface {
return c.StorageClient
}

View file

@ -0,0 +1,63 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
"go_test",
"cgo_library",
)
go_library(
name = "go_default_library",
srcs = [
"auth_loaders.go",
"client_config.go",
"config.go",
"doc.go",
"loader.go",
"merged_client_builder.go",
"overrides.go",
"validation.go",
],
tags = ["automanaged"],
deps = [
"//pkg/api:go_default_library",
"//pkg/api/unversioned:go_default_library",
"//pkg/client/restclient:go_default_library",
"//pkg/client/unversioned/auth:go_default_library",
"//pkg/client/unversioned/clientcmd/api:go_default_library",
"//pkg/client/unversioned/clientcmd/api/latest:go_default_library",
"//pkg/runtime:go_default_library",
"//pkg/util/errors:go_default_library",
"//pkg/util/homedir:go_default_library",
"//pkg/util/validation:go_default_library",
"//vendor:github.com/golang/glog",
"//vendor:github.com/howeyc/gopass",
"//vendor:github.com/imdario/mergo",
"//vendor:github.com/spf13/pflag",
],
)
go_test(
name = "go_default_test",
srcs = [
"client_config_test.go",
"loader_test.go",
"merged_client_builder_test.go",
"validation_test.go",
],
library = "go_default_library",
tags = ["automanaged"],
deps = [
"//pkg/client/restclient:go_default_library",
"//pkg/client/unversioned/clientcmd/api:go_default_library",
"//pkg/client/unversioned/clientcmd/api/latest:go_default_library",
"//pkg/runtime:go_default_library",
"//pkg/util/errors:go_default_library",
"//vendor:github.com/ghodss/yaml",
"//vendor:github.com/imdario/mergo",
],
)

View file

@ -0,0 +1,36 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
"go_test",
"cgo_library",
)
go_library(
name = "go_default_library",
srcs = [
"helpers.go",
"register.go",
"types.go",
],
tags = ["automanaged"],
deps = [
"//pkg/api/unversioned:go_default_library",
"//pkg/runtime:go_default_library",
],
)
go_test(
name = "go_default_test",
srcs = [
"helpers_test.go",
"types_test.go",
],
library = "go_default_library",
tags = ["automanaged"],
deps = ["//vendor:github.com/ghodss/yaml"],
)

View file

@ -0,0 +1,25 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
"go_test",
"cgo_library",
)
go_library(
name = "go_default_library",
srcs = ["latest.go"],
tags = ["automanaged"],
deps = [
"//pkg/api/unversioned:go_default_library",
"//pkg/client/unversioned/clientcmd/api:go_default_library",
"//pkg/client/unversioned/clientcmd/api/v1:go_default_library",
"//pkg/runtime:go_default_library",
"//pkg/runtime/serializer/json:go_default_library",
"//pkg/runtime/serializer/versioning:go_default_library",
],
)

View file

@ -56,7 +56,7 @@ func init() {
panic(err)
}
yamlSerializer := json.NewYAMLSerializer(json.DefaultMetaFactory, Scheme, Scheme)
Codec = versioning.NewCodecForScheme(
Codec = versioning.NewDefaultingCodecForScheme(
Scheme,
yamlSerializer,
yamlSerializer,

View file

@ -28,12 +28,14 @@ import (
type Config struct {
// Legacy field from pkg/api/types.go TypeMeta.
// TODO(jlowdermilk): remove this after eliminating downstream dependencies.
// +optional
Kind string `json:"kind,omitempty"`
// DEPRECATED: APIVersion is the preferred api version for communicating with the kubernetes cluster (v1, v2, etc).
// Because a cluster can run multiple API groups and potentially multiple versions of each, it no longer makes sense to specify
// a single value for the cluster version.
// This field isn't really needed anyway, so we are deprecating it without replacement.
// It will be ignored if it is present.
// +optional
APIVersion string `json:"apiVersion,omitempty"`
// Preferences holds general information to be use for cli interactions
Preferences Preferences `json:"preferences"`
@ -46,13 +48,16 @@ type Config struct {
// CurrentContext is the name of the context that you would like to use by default
CurrentContext string `json:"current-context"`
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
// +optional
Extensions map[string]runtime.Object `json:"extensions,omitempty"`
}
// IMPORTANT if you add fields to this struct, please update IsConfigEmpty()
type Preferences struct {
// +optional
Colors bool `json:"colors,omitempty"`
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
// +optional
Extensions map[string]runtime.Object `json:"extensions,omitempty"`
}
@ -63,14 +68,19 @@ type Cluster struct {
// Server is the address of the kubernetes cluster (https://hostname:port).
Server string `json:"server"`
// APIVersion is the preferred api version for communicating with the kubernetes cluster (v1, v2, etc).
// +optional
APIVersion string `json:"api-version,omitempty"`
// InsecureSkipTLSVerify skips the validity check for the server's certificate. This will make your HTTPS connections insecure.
// +optional
InsecureSkipTLSVerify bool `json:"insecure-skip-tls-verify,omitempty"`
// CertificateAuthority is the path to a cert file for the certificate authority.
// +optional
CertificateAuthority string `json:"certificate-authority,omitempty"`
// CertificateAuthorityData contains PEM-encoded certificate authority certificates. Overrides CertificateAuthority
// +optional
CertificateAuthorityData []byte `json:"certificate-authority-data,omitempty"`
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
// +optional
Extensions map[string]runtime.Object `json:"extensions,omitempty"`
}
@ -79,26 +89,37 @@ type AuthInfo struct {
// LocationOfOrigin indicates where this object came from. It is used for round tripping config post-merge, but never serialized.
LocationOfOrigin string
// ClientCertificate is the path to a client cert file for TLS.
// +optional
ClientCertificate string `json:"client-certificate,omitempty"`
// ClientCertificateData contains PEM-encoded data from a client cert file for TLS. Overrides ClientCertificate
// +optional
ClientCertificateData []byte `json:"client-certificate-data,omitempty"`
// ClientKey is the path to a client key file for TLS.
// +optional
ClientKey string `json:"client-key,omitempty"`
// ClientKeyData contains PEM-encoded data from a client key file for TLS. Overrides ClientKey
// +optional
ClientKeyData []byte `json:"client-key-data,omitempty"`
// Token is the bearer token for authentication to the kubernetes cluster.
// +optional
Token string `json:"token,omitempty"`
// TokenFile is a pointer to a file that contains a bearer token (as described above). If both Token and TokenFile are present, Token takes precedence.
// +optional
TokenFile string `json:"tokenFile,omitempty"`
// Impersonate is the username to act-as.
// +optional
Impersonate string `json:"act-as,omitempty"`
// Username is the username for basic authentication to the kubernetes cluster.
// +optional
Username string `json:"username,omitempty"`
// Password is the password for basic authentication to the kubernetes cluster.
// +optional
Password string `json:"password,omitempty"`
// AuthProvider specifies a custom authentication plugin for the kubernetes cluster.
// +optional
AuthProvider *AuthProviderConfig `json:"auth-provider,omitempty"`
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
// +optional
Extensions map[string]runtime.Object `json:"extensions,omitempty"`
}
@ -111,14 +132,17 @@ type Context struct {
// AuthInfo is the name of the authInfo for this context
AuthInfo string `json:"user"`
// Namespace is the default namespace to use on unspecified requests
// +optional
Namespace string `json:"namespace,omitempty"`
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
// +optional
Extensions map[string]runtime.Object `json:"extensions,omitempty"`
}
// AuthProviderConfig holds the configuration for a specified auth provider.
type AuthProviderConfig struct {
Name string `json:"name"`
Name string `json:"name"`
// +optional
Config map[string]string `json:"config,omitempty"`
}

View file

@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
"go_test",
"cgo_library",
)
go_library(
name = "go_default_library",
srcs = [
"conversion.go",
"register.go",
"types.go",
],
tags = ["automanaged"],
deps = [
"//pkg/api/unversioned:go_default_library",
"//pkg/client/unversioned/clientcmd/api:go_default_library",
"//pkg/conversion:go_default_library",
"//pkg/runtime:go_default_library",
],
)

View file

@ -27,12 +27,14 @@ import (
type Config struct {
// Legacy field from pkg/api/types.go TypeMeta.
// TODO(jlowdermilk): remove this after eliminating downstream dependencies.
// +optional
Kind string `json:"kind,omitempty"`
// DEPRECATED: APIVersion is the preferred api version for communicating with the kubernetes cluster (v1, v2, etc).
// Because a cluster can run multiple API groups and potentially multiple versions of each, it no longer makes sense to specify
// a single value for the cluster version.
// This field isn't really needed anyway, so we are deprecating it without replacement.
// It will be ignored if it is present.
// +optional
APIVersion string `json:"apiVersion,omitempty"`
// Preferences holds general information to be use for cli interactions
Preferences Preferences `json:"preferences"`
@ -45,12 +47,15 @@ type Config struct {
// CurrentContext is the name of the context that you would like to use by default
CurrentContext string `json:"current-context"`
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
// +optional
Extensions []NamedExtension `json:"extensions,omitempty"`
}
type Preferences struct {
// +optional
Colors bool `json:"colors,omitempty"`
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
// +optional
Extensions []NamedExtension `json:"extensions,omitempty"`
}
@ -59,40 +64,56 @@ type Cluster struct {
// Server is the address of the kubernetes cluster (https://hostname:port).
Server string `json:"server"`
// APIVersion is the preferred api version for communicating with the kubernetes cluster (v1, v2, etc).
// +optional
APIVersion string `json:"api-version,omitempty"`
// InsecureSkipTLSVerify skips the validity check for the server's certificate. This will make your HTTPS connections insecure.
// +optional
InsecureSkipTLSVerify bool `json:"insecure-skip-tls-verify,omitempty"`
// CertificateAuthority is the path to a cert file for the certificate authority.
// +optional
CertificateAuthority string `json:"certificate-authority,omitempty"`
// CertificateAuthorityData contains PEM-encoded certificate authority certificates. Overrides CertificateAuthority
// +optional
CertificateAuthorityData []byte `json:"certificate-authority-data,omitempty"`
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
// +optional
Extensions []NamedExtension `json:"extensions,omitempty"`
}
// AuthInfo contains information that describes identity information. This is use to tell the kubernetes cluster who you are.
type AuthInfo struct {
// ClientCertificate is the path to a client cert file for TLS.
// +optional
ClientCertificate string `json:"client-certificate,omitempty"`
// ClientCertificateData contains PEM-encoded data from a client cert file for TLS. Overrides ClientCertificate
// +optional
ClientCertificateData []byte `json:"client-certificate-data,omitempty"`
// ClientKey is the path to a client key file for TLS.
// +optional
ClientKey string `json:"client-key,omitempty"`
// ClientKeyData contains PEM-encoded data from a client key file for TLS. Overrides ClientKey
// +optional
ClientKeyData []byte `json:"client-key-data,omitempty"`
// Token is the bearer token for authentication to the kubernetes cluster.
// +optional
Token string `json:"token,omitempty"`
// TokenFile is a pointer to a file that contains a bearer token (as described above). If both Token and TokenFile are present, Token takes precedence.
// +optional
TokenFile string `json:"tokenFile,omitempty"`
// Impersonate is the username to imperonate. The name matches the flag.
// +optional
Impersonate string `json:"as,omitempty"`
// Username is the username for basic authentication to the kubernetes cluster.
// +optional
Username string `json:"username,omitempty"`
// Password is the password for basic authentication to the kubernetes cluster.
// +optional
Password string `json:"password,omitempty"`
// AuthProvider specifies a custom authentication plugin for the kubernetes cluster.
// +optional
AuthProvider *AuthProviderConfig `json:"auth-provider,omitempty"`
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
// +optional
Extensions []NamedExtension `json:"extensions,omitempty"`
}
@ -103,8 +124,10 @@ type Context struct {
// AuthInfo is the name of the authInfo for this context
AuthInfo string `json:"user"`
// Namespace is the default namespace to use on unspecified requests
// +optional
Namespace string `json:"namespace,omitempty"`
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
// +optional
Extensions []NamedExtension `json:"extensions,omitempty"`
}

View file

@ -23,6 +23,7 @@ import (
"io/ioutil"
"os"
"github.com/howeyc/gopass"
clientauth "k8s.io/kubernetes/pkg/client/unversioned/auth"
)
@ -46,10 +47,13 @@ type PromptingAuthLoader struct {
// LoadAuth parses an AuthInfo object from a file path. It prompts user and creates file if it doesn't exist.
func (a *PromptingAuthLoader) LoadAuth(path string) (*clientauth.Info, error) {
var auth clientauth.Info
// Prompt for user/pass and write a file if none exists.
if _, err := os.Stat(path); os.IsNotExist(err) {
auth = *a.Prompt()
authPtr, err := a.Prompt()
auth := *authPtr
if err != nil {
return nil, err
}
data, err := json.Marshal(auth)
if err != nil {
return &auth, err
@ -65,19 +69,30 @@ func (a *PromptingAuthLoader) LoadAuth(path string) (*clientauth.Info, error) {
}
// Prompt pulls the user and password from a reader
func (a *PromptingAuthLoader) Prompt() *clientauth.Info {
func (a *PromptingAuthLoader) Prompt() (*clientauth.Info, error) {
var err error
auth := &clientauth.Info{}
auth.User = promptForString("Username", a.reader)
auth.Password = promptForString("Password", a.reader)
return auth
auth.User, err = promptForString("Username", a.reader, true)
if err != nil {
return nil, err
}
auth.Password, err = promptForString("Password", nil, false)
if err != nil {
return nil, err
}
return auth, nil
}
func promptForString(field string, r io.Reader) string {
func promptForString(field string, r io.Reader, show bool) (result string, err error) {
fmt.Printf("Please enter %s: ", field)
var result string
fmt.Fscan(r, &result)
return result
if show {
_, err = fmt.Fscan(r, &result)
} else {
var data []byte
data, err = gopass.GetPasswdMasked()
result = string(data)
}
return result, err
}
// NewPromptingAuthLoader is an AuthLoader that parses an AuthInfo object from a file path. It prompts user and creates file if it doesn't exist.

View file

@ -27,6 +27,9 @@ import (
"github.com/golang/glog"
"github.com/imdario/mergo"
"strconv"
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/restclient"
clientauth "k8s.io/kubernetes/pkg/client/unversioned/auth"
@ -34,16 +37,25 @@ import (
)
var (
// DefaultCluster is the cluster config used when no other config is specified
// TODO: eventually apiserver should start on 443 and be secure by default
DefaultCluster = clientcmdapi.Cluster{Server: "http://localhost:8080"}
// EnvVarCluster allows overriding the DefaultCluster using an envvar for the server name
EnvVarCluster = clientcmdapi.Cluster{Server: os.Getenv("KUBERNETES_MASTER")}
DefaultClientConfig = DirectClientConfig{*clientcmdapi.NewConfig(), "", &ConfigOverrides{}, nil, NewDefaultClientConfigLoadingRules()}
// ClusterDefaults has the same behavior as the old EnvVar and DefaultCluster fields
// DEPRECATED will be replaced
ClusterDefaults = clientcmdapi.Cluster{Server: getDefaultServer()}
// DefaultClientConfig represents the legacy behavior of this package for defaulting
// DEPRECATED will be replace
DefaultClientConfig = DirectClientConfig{*clientcmdapi.NewConfig(), "", &ConfigOverrides{
ClusterDefaults: ClusterDefaults,
}, nil, NewDefaultClientConfigLoadingRules()}
)
// getDefaultServer returns a default setting for DefaultClientConfig
// DEPRECATED
func getDefaultServer() string {
if server := os.Getenv("KUBERNETES_MASTER"); len(server) > 0 {
return server
}
return "http://localhost:8080"
}
// ClientConfig is used to make it easy to get an api server client
type ClientConfig interface {
// RawConfig returns the merged result of all overrides
@ -90,15 +102,42 @@ func (config *DirectClientConfig) RawConfig() (clientcmdapi.Config, error) {
// ClientConfig implements ClientConfig
func (config *DirectClientConfig) ClientConfig() (*restclient.Config, error) {
// check that getAuthInfo, getContext, and getCluster do not return an error.
// Do this before checking if the curent config is usable in the event that an
// AuthInfo, Context, or Cluster config with user-defined names are not found.
// This provides a user with the immediate cause for error if one is found
configAuthInfo, err := config.getAuthInfo()
if err != nil {
return nil, err
}
_, err = config.getContext()
if err != nil {
return nil, err
}
configClusterInfo, err := config.getCluster()
if err != nil {
return nil, err
}
if err := config.ConfirmUsable(); err != nil {
return nil, err
}
configAuthInfo := config.getAuthInfo()
configClusterInfo := config.getCluster()
clientConfig := &restclient.Config{}
clientConfig.Host = configClusterInfo.Server
if len(config.overrides.Timeout) > 0 {
if i, err := strconv.ParseInt(config.overrides.Timeout, 10, 64); err == nil && i >= 0 {
clientConfig.Timeout = time.Duration(i) * time.Second
} else if requestTimeout, err := time.ParseDuration(config.overrides.Timeout); err == nil {
clientConfig.Timeout = requestTimeout
} else {
return nil, fmt.Errorf("Invalid value for option '--request-timeout'. Value must be a single integer, or an integer followed by a corresponding time unit (e.g. 1s | 2m | 3h)")
}
}
if u, err := url.ParseRequestURI(clientConfig.Host); err == nil && u.Opaque == "" && len(u.Path) > 1 {
u.RawQuery = ""
u.Fragment = ""
@ -117,7 +156,8 @@ func (config *DirectClientConfig) ClientConfig() (*restclient.Config, error) {
// Our mergo.Merge version is older than this change.
var persister restclient.AuthProviderConfigPersister
if config.configAccess != nil {
persister = PersisterForUser(config.configAccess, config.getAuthInfoName())
authInfoName, _ := config.getAuthInfoName()
persister = PersisterForUser(config.configAccess, authInfoName)
}
userAuthPartialConfig, err := getUserIdentificationPartialConfig(configAuthInfo, config.fallbackReader, persister)
if err != nil {
@ -195,8 +235,10 @@ func getUserIdentificationPartialConfig(configAuthInfo clientcmdapi.AuthInfo, fa
// if there still isn't enough information to authenticate the user, try prompting
if !canIdentifyUser(*mergedConfig) && (fallbackReader != nil) {
prompter := NewPromptingAuthLoader(fallbackReader)
promptedAuthInfo := prompter.Prompt()
promptedAuthInfo, err := prompter.Prompt()
if err != nil {
return nil, err
}
promptedConfig := makeUserIdentificationConfig(*promptedAuthInfo)
previouslyMergedConfig := mergedConfig
mergedConfig = &restclient.Config{}
@ -241,7 +283,10 @@ func (config *DirectClientConfig) Namespace() (string, bool, error) {
return "", false, err
}
configContext := config.getContext()
configContext, err := config.getContext()
if err != nil {
return "", false, err
}
if len(configContext.Namespace) == 0 {
return api.NamespaceDefault, false, nil
@ -263,8 +308,27 @@ func (config *DirectClientConfig) ConfigAccess() ConfigAccess {
// but no errors in the sections requested or referenced. It does not return early so that it can find as many errors as possible.
func (config *DirectClientConfig) ConfirmUsable() error {
validationErrors := make([]error, 0)
validationErrors = append(validationErrors, validateAuthInfo(config.getAuthInfoName(), config.getAuthInfo())...)
validationErrors = append(validationErrors, validateClusterInfo(config.getClusterName(), config.getCluster())...)
var contextName string
if len(config.contextName) != 0 {
contextName = config.contextName
} else {
contextName = config.config.CurrentContext
}
if len(contextName) > 0 {
_, exists := config.config.Contexts[contextName]
if !exists {
validationErrors = append(validationErrors, &errContextNotFound{contextName})
}
}
authInfoName, _ := config.getAuthInfoName()
authInfo, _ := config.getAuthInfo()
validationErrors = append(validationErrors, validateAuthInfo(authInfoName, authInfo)...)
clusterName, _ := config.getClusterName()
cluster, _ := config.getCluster()
validationErrors = append(validationErrors, validateClusterInfo(clusterName, cluster)...)
// when direct client config is specified, and our only error is that no server is defined, we should
// return a standard "no config" error
if len(validationErrors) == 1 && validationErrors[0] == ErrEmptyCluster {
@ -273,66 +337,84 @@ func (config *DirectClientConfig) ConfirmUsable() error {
return newErrConfigurationInvalid(validationErrors)
}
func (config *DirectClientConfig) getContextName() string {
// getContextName returns the default, or user-set context name, and a boolean that indicates
// whether the default context name has been overwritten by a user-set flag, or left as its default value
func (config *DirectClientConfig) getContextName() (string, bool) {
if len(config.overrides.CurrentContext) != 0 {
return config.overrides.CurrentContext
return config.overrides.CurrentContext, true
}
if len(config.contextName) != 0 {
return config.contextName
return config.contextName, false
}
return config.config.CurrentContext
return config.config.CurrentContext, false
}
func (config *DirectClientConfig) getAuthInfoName() string {
// getAuthInfoName returns a string containing the current authinfo name for the current context,
// and a boolean indicating whether the default authInfo name is overwritten by a user-set flag, or
// left as its default value
func (config *DirectClientConfig) getAuthInfoName() (string, bool) {
if len(config.overrides.Context.AuthInfo) != 0 {
return config.overrides.Context.AuthInfo
return config.overrides.Context.AuthInfo, true
}
return config.getContext().AuthInfo
context, _ := config.getContext()
return context.AuthInfo, false
}
func (config *DirectClientConfig) getClusterName() string {
// getClusterName returns a string containing the default, or user-set cluster name, and a boolean
// indicating whether the default clusterName has been overwritten by a user-set flag, or left as
// its default value
func (config *DirectClientConfig) getClusterName() (string, bool) {
if len(config.overrides.Context.Cluster) != 0 {
return config.overrides.Context.Cluster
return config.overrides.Context.Cluster, true
}
return config.getContext().Cluster
context, _ := config.getContext()
return context.Cluster, false
}
func (config *DirectClientConfig) getContext() clientcmdapi.Context {
// getContext returns the clientcmdapi.Context, or an error if a required context is not found.
func (config *DirectClientConfig) getContext() (clientcmdapi.Context, error) {
contexts := config.config.Contexts
contextName := config.getContextName()
contextName, required := config.getContextName()
var mergedContext clientcmdapi.Context
if configContext, exists := contexts[contextName]; exists {
mergo.Merge(&mergedContext, configContext)
} else if required {
return clientcmdapi.Context{}, fmt.Errorf("context %q does not exist", contextName)
}
mergo.Merge(&mergedContext, config.overrides.Context)
return mergedContext
return mergedContext, nil
}
func (config *DirectClientConfig) getAuthInfo() clientcmdapi.AuthInfo {
// getAuthInfo returns the clientcmdapi.AuthInfo, or an error if a required auth info is not found.
func (config *DirectClientConfig) getAuthInfo() (clientcmdapi.AuthInfo, error) {
authInfos := config.config.AuthInfos
authInfoName := config.getAuthInfoName()
authInfoName, required := config.getAuthInfoName()
var mergedAuthInfo clientcmdapi.AuthInfo
if configAuthInfo, exists := authInfos[authInfoName]; exists {
mergo.Merge(&mergedAuthInfo, configAuthInfo)
} else if required {
return clientcmdapi.AuthInfo{}, fmt.Errorf("auth info %q does not exist", authInfoName)
}
mergo.Merge(&mergedAuthInfo, config.overrides.AuthInfo)
return mergedAuthInfo
return mergedAuthInfo, nil
}
func (config *DirectClientConfig) getCluster() clientcmdapi.Cluster {
// getCluster returns the clientcmdapi.Cluster, or an error if a required cluster is not found.
func (config *DirectClientConfig) getCluster() (clientcmdapi.Cluster, error) {
clusterInfos := config.config.Clusters
clusterInfoName := config.getClusterName()
clusterInfoName, required := config.getClusterName()
var mergedClusterInfo clientcmdapi.Cluster
mergo.Merge(&mergedClusterInfo, config.overrides.ClusterDefaults)
mergo.Merge(&mergedClusterInfo, EnvVarCluster)
if configClusterInfo, exists := clusterInfos[clusterInfoName]; exists {
mergo.Merge(&mergedClusterInfo, configClusterInfo)
} else if required {
return clientcmdapi.Cluster{}, fmt.Errorf("cluster %q does not exist", clusterInfoName)
}
mergo.Merge(&mergedClusterInfo, config.overrides.ClusterInfo)
// An override of --insecure-skip-tls-verify=true and no accompanying CA/CA data should clear already-set CA/CA data
@ -344,7 +426,7 @@ func (config *DirectClientConfig) getCluster() clientcmdapi.Cluster {
mergedClusterInfo.CertificateAuthorityData = nil
}
return mergedClusterInfo
return mergedClusterInfo, nil
}
// inClusterClientConfig makes a config that will work from within a kubernetes cluster container environment.

View file

@ -23,6 +23,7 @@ import (
"os"
"path"
"path/filepath"
"reflect"
goruntime "runtime"
"strings"
@ -30,6 +31,7 @@ import (
"github.com/imdario/mergo"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/restclient"
clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
clientcmdlatest "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/latest"
"k8s.io/kubernetes/pkg/runtime"
@ -65,6 +67,9 @@ func currentMigrationRules() map[string]string {
type ClientConfigLoader interface {
ConfigAccess
// IsDefaultConfig returns true if the returned config matches the defaults.
IsDefaultConfig(*restclient.Config) bool
// Load returns the latest config
Load() (*clientcmdapi.Config, error)
}
@ -96,6 +101,9 @@ func (g *ClientConfigGetter) IsExplicitFile() bool {
func (g *ClientConfigGetter) GetExplicitFile() string {
return ""
}
func (g *ClientConfigGetter) IsDefaultConfig(config *restclient.Config) bool {
return false
}
// ClientConfigLoadingRules is an ExplicitPath and string slice of specific locations that are used for merging together a Config
// Callers can put the chain together however they want, but we'd recommend:
@ -112,6 +120,10 @@ type ClientConfigLoadingRules struct {
// DoNotResolvePaths indicates whether or not to resolve paths with respect to the originating files. This is phrased as a negative so
// that a default object that doesn't set this will usually get the behavior it wants.
DoNotResolvePaths bool
// DefaultClientConfig is an optional field indicating what rules to use to calculate a default configuration.
// This should match the overrides passed in to ClientConfig loader.
DefaultClientConfig ClientConfig
}
// ClientConfigLoadingRules implements the ClientConfigLoader interface.
@ -192,6 +204,7 @@ func (rules *ClientConfigLoadingRules) Load() (*clientcmdapi.Config, error) {
// first merge all of our maps
mapConfig := clientcmdapi.NewConfig()
for _, kubeconfig := range kubeconfigs {
mergo.Merge(mapConfig, kubeconfig)
}
@ -316,6 +329,18 @@ func (rules *ClientConfigLoadingRules) GetExplicitFile() string {
return rules.ExplicitPath
}
// IsDefaultConfig returns true if the provided configuration matches the default
func (rules *ClientConfigLoadingRules) IsDefaultConfig(config *restclient.Config) bool {
if rules.DefaultClientConfig == nil {
return false
}
defaultConfig, err := rules.DefaultClientConfig.ClientConfig()
if err != nil {
return false
}
return reflect.DeepEqual(config, defaultConfig)
}
// LoadFromFile takes a filename and deserializes the contents into Config object
func LoadFromFile(filename string) (*clientcmdapi.Config, error) {
kubeconfigBytes, err := ioutil.ReadFile(filename)

View file

@ -18,9 +18,10 @@ package clientcmd
import (
"io"
"reflect"
"sync"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/client/restclient"
clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
)
@ -103,26 +104,22 @@ func (config *DeferredLoadingClientConfig) ClientConfig() (*restclient.Config, e
// content differs from the default config
mergedConfig, err := mergedClientConfig.ClientConfig()
switch {
case err != nil && !IsEmptyConfig(err):
// return on any error except empty config
return nil, err
case mergedConfig != nil:
// if the configuration has any settings at all, we cannot use ICC
// TODO: we need to discriminate better between "empty due to env" and
// "empty due to defaults"
// TODO: this shouldn't be a global - the client config rules should be
// handling this.
defaultConfig, defErr := DefaultClientConfig.ClientConfig()
if IsConfigurationInvalid(defErr) && !IsEmptyConfig(err) {
return mergedConfig, nil
case err != nil:
if !IsEmptyConfig(err) {
// return on any error except empty config
return nil, err
}
if defErr == nil && !reflect.DeepEqual(mergedConfig, defaultConfig) {
case mergedConfig != nil:
// the configuration is valid, but if this is equal to the defaults we should try
// in-cluster configuration
if !config.loader.IsDefaultConfig(mergedConfig) {
return mergedConfig, nil
}
}
// check for in-cluster configuration and use it
if config.icc.Possible() {
glog.V(4).Infof("Using in-cluster configuration")
return config.icc.ClientConfig()
}
@ -137,7 +134,18 @@ func (config *DeferredLoadingClientConfig) Namespace() (string, bool, error) {
return "", false, err
}
return mergedKubeConfig.Namespace()
ns, ok, err := mergedKubeConfig.Namespace()
// if we get an error and it is not empty config, or if the merged config defined an explicit namespace, or
// if in-cluster config is not possible, return immediately
if (err != nil && !IsEmptyConfig(err)) || ok || !config.icc.Possible() {
// return on any error except empty config
return ns, ok, err
}
glog.V(4).Infof("Using in-cluster namespace")
// allow the namespace from the service account token directory to be used.
return config.icc.Namespace()
}
// ConfigAccess implements ClientConfig

View file

@ -33,6 +33,7 @@ type ConfigOverrides struct {
ClusterInfo clientcmdapi.Cluster
Context clientcmdapi.Context
CurrentContext string
Timeout string
}
// ConfigOverrideFlags holds the flag names to be used for binding command line flags. Notice that this structure tightly
@ -42,6 +43,7 @@ type ConfigOverrideFlags struct {
ClusterOverrideFlags ClusterOverrideFlags
ContextOverrideFlags ContextOverrideFlags
CurrentContext FlagInfo
Timeout FlagInfo
}
// AuthOverrideFlags holds the flag names to be used for binding command line flags for AuthInfo objects
@ -121,6 +123,7 @@ const (
FlagImpersonate = "as"
FlagUsername = "username"
FlagPassword = "password"
FlagTimeout = "request-timeout"
)
// RecommendedAuthOverrideFlags is a convenience method to return recommended flag names prefixed with a string of your choosing
@ -151,7 +154,9 @@ func RecommendedConfigOverrideFlags(prefix string) ConfigOverrideFlags {
AuthOverrideFlags: RecommendedAuthOverrideFlags(prefix),
ClusterOverrideFlags: RecommendedClusterOverrideFlags(prefix),
ContextOverrideFlags: RecommendedContextOverrideFlags(prefix),
CurrentContext: FlagInfo{prefix + FlagContext, "", "", "The name of the kubeconfig context to use"},
CurrentContext: FlagInfo{prefix + FlagContext, "", "", "The name of the kubeconfig context to use"},
Timeout: FlagInfo{prefix + FlagTimeout, "", "0", "The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests."},
}
}
@ -190,6 +195,7 @@ func BindOverrideFlags(overrides *ConfigOverrides, flags *pflag.FlagSet, flagNam
BindClusterFlags(&overrides.ClusterInfo, flags, flagNames.ClusterOverrideFlags)
BindContextFlags(&overrides.Context, flags, flagNames.ContextOverrideFlags)
flagNames.CurrentContext.BindStringFlag(flags, &overrides.CurrentContext)
flagNames.Timeout.BindStringFlag(flags, &overrides.Timeout)
}
// BindFlags is a convenience method to bind the specified flags to their associated variables

View file

@ -1,92 +0,0 @@
/*
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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/watch"
)
// ClusterRoleBindings has methods to work with ClusterRoleBinding resources in a namespace
type ClusterRoleBindings interface {
ClusterRoleBindings() ClusterRoleBindingInterface
}
// ClusterRoleBindingInterface has methods to work with ClusterRoleBinding resources.
type ClusterRoleBindingInterface interface {
List(opts api.ListOptions) (*rbac.ClusterRoleBindingList, error)
Get(name string) (*rbac.ClusterRoleBinding, error)
Delete(name string, options *api.DeleteOptions) error
Create(clusterRoleBinding *rbac.ClusterRoleBinding) (*rbac.ClusterRoleBinding, error)
Update(clusterRoleBinding *rbac.ClusterRoleBinding) (*rbac.ClusterRoleBinding, error)
Watch(opts api.ListOptions) (watch.Interface, error)
}
// clusterRoleBindings implements ClusterRoleBindingsNamespacer interface
type clusterRoleBindings struct {
client *RbacClient
}
// newClusterRoleBindings returns a clusterRoleBindings
func newClusterRoleBindings(c *RbacClient) *clusterRoleBindings {
return &clusterRoleBindings{
client: c,
}
}
// List takes label and field selectors, and returns the list of clusterRoleBindings that match those selectors.
func (c *clusterRoleBindings) List(opts api.ListOptions) (result *rbac.ClusterRoleBindingList, err error) {
result = &rbac.ClusterRoleBindingList{}
err = c.client.Get().Resource("clusterrolebindings").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get takes the name of the clusterRoleBinding, and returns the corresponding ClusterRoleBinding object, and an error if it occurs
func (c *clusterRoleBindings) Get(name string) (result *rbac.ClusterRoleBinding, err error) {
result = &rbac.ClusterRoleBinding{}
err = c.client.Get().Resource("clusterrolebindings").Name(name).Do().Into(result)
return
}
// Delete takes the name of the clusterRoleBinding and deletes it. Returns an error if one occurs.
func (c *clusterRoleBindings) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().Resource("clusterrolebindings").Name(name).Body(options).Do().Error()
}
// Create takes the representation of a clusterRoleBinding and creates it. Returns the server's representation of the clusterRoleBinding, and an error, if it occurs.
func (c *clusterRoleBindings) Create(clusterRoleBinding *rbac.ClusterRoleBinding) (result *rbac.ClusterRoleBinding, err error) {
result = &rbac.ClusterRoleBinding{}
err = c.client.Post().Resource("clusterrolebindings").Body(clusterRoleBinding).Do().Into(result)
return
}
// Update takes the representation of a clusterRoleBinding and updates it. Returns the server's representation of the clusterRoleBinding, and an error, if it occurs.
func (c *clusterRoleBindings) Update(clusterRoleBinding *rbac.ClusterRoleBinding) (result *rbac.ClusterRoleBinding, err error) {
result = &rbac.ClusterRoleBinding{}
err = c.client.Put().Resource("clusterrolebindings").Name(clusterRoleBinding.Name).Body(clusterRoleBinding).Do().Into(result)
return
}
// Watch returns a watch.Interface that watches the requested clusterRoleBindings.
func (c *clusterRoleBindings) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Resource("clusterrolebindings").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,92 +0,0 @@
/*
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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/watch"
)
// ClusterRoles has methods to work with ClusterRole resources in a namespace
type ClusterRoles interface {
ClusterRoles() ClusterRoleInterface
}
// ClusterRoleInterface has methods to work with ClusterRole resources.
type ClusterRoleInterface interface {
List(opts api.ListOptions) (*rbac.ClusterRoleList, error)
Get(name string) (*rbac.ClusterRole, error)
Delete(name string, options *api.DeleteOptions) error
Create(clusterRole *rbac.ClusterRole) (*rbac.ClusterRole, error)
Update(clusterRole *rbac.ClusterRole) (*rbac.ClusterRole, error)
Watch(opts api.ListOptions) (watch.Interface, error)
}
// clusterRoles implements ClusterRolesNamespacer interface
type clusterRoles struct {
client *RbacClient
}
// newClusterRoles returns a clusterRoles
func newClusterRoles(c *RbacClient) *clusterRoles {
return &clusterRoles{
client: c,
}
}
// List takes label and field selectors, and returns the list of clusterRoles that match those selectors.
func (c *clusterRoles) List(opts api.ListOptions) (result *rbac.ClusterRoleList, err error) {
result = &rbac.ClusterRoleList{}
err = c.client.Get().Resource("clusterroles").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get takes the name of the clusterRole, and returns the corresponding ClusterRole object, and an error if it occurs
func (c *clusterRoles) Get(name string) (result *rbac.ClusterRole, err error) {
result = &rbac.ClusterRole{}
err = c.client.Get().Resource("clusterroles").Name(name).Do().Into(result)
return
}
// Delete takes the name of the clusterRole and deletes it. Returns an error if one occurs.
func (c *clusterRoles) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().Resource("clusterroles").Name(name).Body(options).Do().Error()
}
// Create takes the representation of a clusterRole and creates it. Returns the server's representation of the clusterRole, and an error, if it occurs.
func (c *clusterRoles) Create(clusterRole *rbac.ClusterRole) (result *rbac.ClusterRole, err error) {
result = &rbac.ClusterRole{}
err = c.client.Post().Resource("clusterroles").Body(clusterRole).Do().Into(result)
return
}
// Update takes the representation of a clusterRole and updates it. Returns the server's representation of the clusterRole, and an error, if it occurs.
func (c *clusterRoles) Update(clusterRole *rbac.ClusterRole) (result *rbac.ClusterRole, err error) {
result = &rbac.ClusterRole{}
err = c.client.Put().Resource("clusterroles").Name(clusterRole.Name).Body(clusterRole).Do().Into(result)
return
}
// Watch returns a watch.Interface that watches the requested clusterRoles.
func (c *clusterRoles) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Resource("clusterroles").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,60 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/api"
)
type ComponentStatusesInterface interface {
ComponentStatuses() ComponentStatusInterface
}
// ComponentStatusInterface contains methods to retrieve ComponentStatus
type ComponentStatusInterface interface {
List(opts api.ListOptions) (*api.ComponentStatusList, error)
Get(name string) (*api.ComponentStatus, error)
// TODO: It'd be nice to have watch support at some point
//Watch(opts api.ListOptions) (watch.Interface, error)
}
// componentStatuses implements ComponentStatusesInterface
type componentStatuses struct {
client *Client
}
func newComponentStatuses(c *Client) *componentStatuses {
return &componentStatuses{c}
}
func (c *componentStatuses) List(opts api.ListOptions) (result *api.ComponentStatusList, err error) {
result = &api.ComponentStatusList{}
err = c.client.Get().
Resource("componentStatuses").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return result, err
}
func (c *componentStatuses) Get(name string) (result *api.ComponentStatus, err error) {
result = &api.ComponentStatus{}
err = c.client.Get().Resource("componentStatuses").Name(name).Do().Into(result)
return
}

View file

@ -25,20 +25,24 @@ import (
"k8s.io/kubernetes/pkg/apis/apps"
"k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/apis/extensions"
appsclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/apps/internalversion"
batchclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/batch/internalversion"
coreclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
extensionsclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion"
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/pkg/watch"
)
// ControllerHasDesiredReplicas returns a condition that will be true if and only if
// the desired replica count for a controller's ReplicaSelector equals the Replicas count.
func ControllerHasDesiredReplicas(c Interface, controller *api.ReplicationController) wait.ConditionFunc {
func ControllerHasDesiredReplicas(rcClient coreclient.ReplicationControllersGetter, controller *api.ReplicationController) wait.ConditionFunc {
// If we're given a controller where the status lags the spec, it either means that the controller is stale,
// or that the rc manager hasn't noticed the update yet. Polling status.Replicas is not safe in the latter case.
desiredGeneration := controller.Generation
return func() (bool, error) {
ctrl, err := c.ReplicationControllers(controller.Namespace).Get(controller.Name)
ctrl, err := rcClient.ReplicationControllers(controller.Namespace).Get(controller.Name)
if err != nil {
return false, err
}
@ -52,7 +56,7 @@ func ControllerHasDesiredReplicas(c Interface, controller *api.ReplicationContro
// ReplicaSetHasDesiredReplicas returns a condition that will be true if and only if
// the desired replica count for a ReplicaSet's ReplicaSelector equals the Replicas count.
func ReplicaSetHasDesiredReplicas(c ExtensionsInterface, replicaSet *extensions.ReplicaSet) wait.ConditionFunc {
func ReplicaSetHasDesiredReplicas(rsClient extensionsclient.ReplicaSetsGetter, replicaSet *extensions.ReplicaSet) wait.ConditionFunc {
// If we're given a ReplicaSet where the status lags the spec, it either means that the
// ReplicaSet is stale, or that the ReplicaSet manager hasn't noticed the update yet.
@ -60,7 +64,7 @@ func ReplicaSetHasDesiredReplicas(c ExtensionsInterface, replicaSet *extensions.
desiredGeneration := replicaSet.Generation
return func() (bool, error) {
rs, err := c.ReplicaSets(replicaSet.Namespace).Get(replicaSet.Name)
rs, err := rsClient.ReplicaSets(replicaSet.Namespace).Get(replicaSet.Name)
if err != nil {
return false, err
}
@ -73,10 +77,11 @@ func ReplicaSetHasDesiredReplicas(c ExtensionsInterface, replicaSet *extensions.
}
}
func PetSetHasDesiredPets(c AppsInterface, petset *apps.PetSet) wait.ConditionFunc {
// StatefulSetHasDesiredPets returns a conditon that checks the number of petset replicas
func StatefulSetHasDesiredPets(psClient appsclient.StatefulSetsGetter, petset *apps.StatefulSet) wait.ConditionFunc {
// TODO: Differentiate between 0 pets and a really quick scale down using generation.
return func() (bool, error) {
ps, err := c.PetSets(petset.Namespace).Get(petset.Name)
ps, err := psClient.StatefulSets(petset.Namespace).Get(petset.Name)
if err != nil {
return false, err
}
@ -86,10 +91,9 @@ func PetSetHasDesiredPets(c AppsInterface, petset *apps.PetSet) wait.ConditionFu
// JobHasDesiredParallelism returns a condition that will be true if the desired parallelism count
// for a job equals the current active counts or is less by an appropriate successful/unsuccessful count.
func JobHasDesiredParallelism(c BatchInterface, job *batch.Job) wait.ConditionFunc {
func JobHasDesiredParallelism(jobClient batchclient.JobsGetter, job *batch.Job) wait.ConditionFunc {
return func() (bool, error) {
job, err := c.Jobs(job.Namespace).Get(job.Name)
job, err := jobClient.Jobs(job.Namespace).Get(job.Name)
if err != nil {
return false, err
}
@ -101,18 +105,18 @@ func JobHasDesiredParallelism(c BatchInterface, job *batch.Job) wait.ConditionFu
if job.Spec.Completions == nil {
// A job without specified completions needs to wait for Active to reach Parallelism.
return false, nil
} else {
// otherwise count successful
progress := *job.Spec.Completions - job.Status.Active - job.Status.Succeeded
return progress == 0, nil
}
// otherwise count successful
progress := *job.Spec.Completions - job.Status.Active - job.Status.Succeeded
return progress == 0, nil
}
}
// DeploymentHasDesiredReplicas returns a condition that will be true if and only if
// the desired replica count for a deployment equals its updated replicas count.
// (non-terminated pods that have the desired template spec).
func DeploymentHasDesiredReplicas(c ExtensionsInterface, deployment *extensions.Deployment) wait.ConditionFunc {
func DeploymentHasDesiredReplicas(dClient extensionsclient.DeploymentsGetter, deployment *extensions.Deployment) wait.ConditionFunc {
// If we're given a deployment where the status lags the spec, it either
// means that the deployment is stale, or that the deployment manager hasn't
// noticed the update yet. Polling status.Replicas is not safe in the latter
@ -120,7 +124,7 @@ func DeploymentHasDesiredReplicas(c ExtensionsInterface, deployment *extensions.
desiredGeneration := deployment.Generation
return func() (bool, error) {
deployment, err := c.Deployments(deployment.Namespace).Get(deployment.Name)
deployment, err := dClient.Deployments(deployment.Namespace).Get(deployment.Name)
if err != nil {
return false, err
}
@ -238,6 +242,15 @@ func PodContainerRunning(containerName string) watch.ConditionFunc {
}
return s.State.Running != nil, nil
}
for _, s := range t.Status.InitContainerStatuses {
if s.Name != containerName {
continue
}
if s.State.Terminated != nil {
return false, ErrContainerTerminated
}
return s.State.Running != nil, nil
}
return false, nil
}
return false, nil

View file

@ -1,122 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
const (
ConfigMapResourceName string = "configmaps"
)
type ConfigMapsNamespacer interface {
ConfigMaps(namespace string) ConfigMapsInterface
}
type ConfigMapsInterface interface {
Get(string) (*api.ConfigMap, error)
List(opts api.ListOptions) (*api.ConfigMapList, error)
Create(*api.ConfigMap) (*api.ConfigMap, error)
Delete(string) error
Update(*api.ConfigMap) (*api.ConfigMap, error)
Watch(api.ListOptions) (watch.Interface, error)
}
type ConfigMaps struct {
client *Client
namespace string
}
// ConfigMaps should implement ConfigMapsInterface
var _ ConfigMapsInterface = &ConfigMaps{}
func newConfigMaps(c *Client, ns string) *ConfigMaps {
return &ConfigMaps{
client: c,
namespace: ns,
}
}
func (c *ConfigMaps) Get(name string) (*api.ConfigMap, error) {
result := &api.ConfigMap{}
err := c.client.Get().
Namespace(c.namespace).
Resource(ConfigMapResourceName).
Name(name).
Do().
Into(result)
return result, err
}
func (c *ConfigMaps) List(opts api.ListOptions) (*api.ConfigMapList, error) {
result := &api.ConfigMapList{}
err := c.client.Get().
Namespace(c.namespace).
Resource(ConfigMapResourceName).
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return result, err
}
func (c *ConfigMaps) Create(cfg *api.ConfigMap) (*api.ConfigMap, error) {
result := &api.ConfigMap{}
err := c.client.Post().
Namespace(c.namespace).
Resource(ConfigMapResourceName).
Body(cfg).
Do().
Into(result)
return result, err
}
func (c *ConfigMaps) Delete(name string) error {
return c.client.Delete().
Namespace(c.namespace).
Resource(ConfigMapResourceName).
Name(name).
Do().
Error()
}
func (c *ConfigMaps) Update(cfg *api.ConfigMap) (*api.ConfigMap, error) {
result := &api.ConfigMap{}
err := c.client.Put().
Namespace(c.namespace).
Resource(ConfigMapResourceName).
Name(cfg.Name).
Body(cfg).
Do().
Into(result)
return result, err
}
func (c *ConfigMaps) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.namespace).
Resource(ConfigMapResourceName).
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,123 +0,0 @@
/*
Copyright 2014 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 (
"bytes"
"encoding/json"
"fmt"
"io"
"net"
"net/http"
"strconv"
cadvisorapi "github.com/google/cadvisor/info/v1"
)
type ContainerInfoGetter interface {
// GetContainerInfo returns information about a container.
GetContainerInfo(host, podID, containerID string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error)
// GetRootInfo returns information about the root container on a machine.
GetRootInfo(host string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error)
// GetMachineInfo returns the machine's information like number of cores, memory capacity.
GetMachineInfo(host string) (*cadvisorapi.MachineInfo, error)
}
type HTTPContainerInfoGetter struct {
Client *http.Client
Port int
}
func (self *HTTPContainerInfoGetter) GetMachineInfo(host string) (*cadvisorapi.MachineInfo, error) {
request, err := http.NewRequest(
"GET",
fmt.Sprintf("http://%v/spec",
net.JoinHostPort(host, strconv.Itoa(self.Port)),
),
nil,
)
if err != nil {
return nil, err
}
response, err := self.Client.Do(request)
if err != nil {
return nil, err
}
defer response.Body.Close()
if response.StatusCode != http.StatusOK {
return nil, fmt.Errorf("trying to get machine spec from %v; received status %v",
host, response.Status)
}
var minfo cadvisorapi.MachineInfo
err = json.NewDecoder(response.Body).Decode(&minfo)
if err != nil {
return nil, err
}
return &minfo, nil
}
func (self *HTTPContainerInfoGetter) getContainerInfo(host, path string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error) {
var body io.Reader
if req != nil {
content, err := json.Marshal(req)
if err != nil {
return nil, err
}
body = bytes.NewBuffer(content)
}
request, err := http.NewRequest(
"GET",
fmt.Sprintf("http://%v/stats/%v",
net.JoinHostPort(host, strconv.Itoa(self.Port)),
path,
),
body,
)
if err != nil {
return nil, err
}
response, err := self.Client.Do(request)
if err != nil {
return nil, err
}
defer response.Body.Close()
if response.StatusCode != http.StatusOK {
return nil, fmt.Errorf("trying to get info for %v from %v; received status %v",
path, host, response.Status)
}
var cinfo cadvisorapi.ContainerInfo
err = json.NewDecoder(response.Body).Decode(&cinfo)
if err != nil {
return nil, err
}
return &cinfo, nil
}
func (self *HTTPContainerInfoGetter) GetContainerInfo(host, podID, containerID string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error) {
return self.getContainerInfo(
host,
fmt.Sprintf("%v/%v", podID, containerID),
req,
)
}
func (self *HTTPContainerInfoGetter) GetRootInfo(host string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error) {
return self.getContainerInfo(host, "", req)
}

View file

@ -1,100 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/watch"
)
// DaemonsSetsNamespacer has methods to work with DaemonSet resources in a namespace
type DaemonSetsNamespacer interface {
DaemonSets(namespace string) DaemonSetInterface
}
type DaemonSetInterface interface {
List(opts api.ListOptions) (*extensions.DaemonSetList, error)
Get(name string) (*extensions.DaemonSet, error)
Create(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error)
Update(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error)
UpdateStatus(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error)
Delete(name string) error
Watch(opts api.ListOptions) (watch.Interface, error)
}
// daemonSets implements DaemonsSetsNamespacer interface
type daemonSets struct {
r *ExtensionsClient
ns string
}
func newDaemonSets(c *ExtensionsClient, namespace string) *daemonSets {
return &daemonSets{c, namespace}
}
// Ensure statically that daemonSets implements DaemonSetsInterface.
var _ DaemonSetInterface = &daemonSets{}
func (c *daemonSets) List(opts api.ListOptions) (result *extensions.DaemonSetList, err error) {
result = &extensions.DaemonSetList{}
err = c.r.Get().Namespace(c.ns).Resource("daemonsets").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular daemon set.
func (c *daemonSets) Get(name string) (result *extensions.DaemonSet, err error) {
result = &extensions.DaemonSet{}
err = c.r.Get().Namespace(c.ns).Resource("daemonsets").Name(name).Do().Into(result)
return
}
// Create creates a new daemon set.
func (c *daemonSets) Create(daemon *extensions.DaemonSet) (result *extensions.DaemonSet, err error) {
result = &extensions.DaemonSet{}
err = c.r.Post().Namespace(c.ns).Resource("daemonsets").Body(daemon).Do().Into(result)
return
}
// Update updates an existing daemon set.
func (c *daemonSets) Update(daemon *extensions.DaemonSet) (result *extensions.DaemonSet, err error) {
result = &extensions.DaemonSet{}
err = c.r.Put().Namespace(c.ns).Resource("daemonsets").Name(daemon.Name).Body(daemon).Do().Into(result)
return
}
// UpdateStatus updates an existing daemon set status
func (c *daemonSets) UpdateStatus(daemon *extensions.DaemonSet) (result *extensions.DaemonSet, err error) {
result = &extensions.DaemonSet{}
err = c.r.Put().Namespace(c.ns).Resource("daemonsets").Name(daemon.Name).SubResource("status").Body(daemon).Do().Into(result)
return
}
// Delete deletes an existing daemon set.
func (c *daemonSets) Delete(name string) error {
return c.r.Delete().Namespace(c.ns).Resource("daemonsets").Name(name).Do().Error()
}
// Watch returns a watch.Interface that watches the requested daemon sets.
func (c *daemonSets) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("daemonsets").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,111 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/watch"
)
// DeploymentsNamespacer has methods to work with Deployment resources in a namespace
type DeploymentsNamespacer interface {
Deployments(namespace string) DeploymentInterface
}
// DeploymentInterface has methods to work with Deployment resources.
type DeploymentInterface interface {
List(opts api.ListOptions) (*extensions.DeploymentList, error)
Get(name string) (*extensions.Deployment, error)
Delete(name string, options *api.DeleteOptions) error
Create(*extensions.Deployment) (*extensions.Deployment, error)
Update(*extensions.Deployment) (*extensions.Deployment, error)
UpdateStatus(*extensions.Deployment) (*extensions.Deployment, error)
Watch(opts api.ListOptions) (watch.Interface, error)
Rollback(*extensions.DeploymentRollback) error
}
// deployments implements DeploymentInterface
type deployments struct {
client *ExtensionsClient
ns string
}
// Ensure statically that deployments implements DeploymentInterface.
var _ DeploymentInterface = &deployments{}
// newDeployments returns a Deployments
func newDeployments(c *ExtensionsClient, namespace string) *deployments {
return &deployments{
client: c,
ns: namespace,
}
}
// List takes label and field selectors, and returns the list of Deployments that match those selectors.
func (c *deployments) List(opts api.ListOptions) (result *extensions.DeploymentList, err error) {
result = &extensions.DeploymentList{}
err = c.client.Get().Namespace(c.ns).Resource("deployments").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any.
func (c *deployments) Get(name string) (result *extensions.Deployment, err error) {
result = &extensions.Deployment{}
err = c.client.Get().Namespace(c.ns).Resource("deployments").Name(name).Do().Into(result)
return
}
// Delete takes name of the deployment and deletes it. Returns an error if one occurs.
func (c *deployments) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().Namespace(c.ns).Resource("deployments").Name(name).Body(options).Do().Error()
}
// Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any.
func (c *deployments) Create(deployment *extensions.Deployment) (result *extensions.Deployment, err error) {
result = &extensions.Deployment{}
err = c.client.Post().Namespace(c.ns).Resource("deployments").Body(deployment).Do().Into(result)
return
}
// Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any.
func (c *deployments) Update(deployment *extensions.Deployment) (result *extensions.Deployment, err error) {
result = &extensions.Deployment{}
err = c.client.Put().Namespace(c.ns).Resource("deployments").Name(deployment.Name).Body(deployment).Do().Into(result)
return
}
func (c *deployments) UpdateStatus(deployment *extensions.Deployment) (result *extensions.Deployment, err error) {
result = &extensions.Deployment{}
err = c.client.Put().Namespace(c.ns).Resource("deployments").Name(deployment.Name).SubResource("status").Body(deployment).Do().Into(result)
return
}
// Watch returns a watch.Interface that watches the requested deployments.
func (c *deployments) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("deployments").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
// Rollback applied the provided DeploymentRollback to the named deployment in the current namespace.
func (c *deployments) Rollback(deploymentRollback *extensions.DeploymentRollback) error {
return c.client.Post().Namespace(c.ns).Resource("deployments").Name(deploymentRollback.Name).SubResource("rollback").Body(deploymentRollback).Do().Error()
}

View file

@ -1,57 +0,0 @@
/*
Copyright 2014 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 contains the implementation of the client side communication with the
Kubernetes master. The Client class provides methods for reading, creating, updating,
and deleting pods, replication controllers, daemons, services, and nodes.
Most consumers should use the Config object to create a Client:
import (
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/api"
)
[...]
config := &client.Config{
Host: "http://localhost:8080",
Username: "test",
Password: "password",
}
client, err := client.New(config)
if err != nil {
// handle error
}
pods, err := client.Pods(api.NamespaceDefault).List(api.ListOptions{})
if err != nil {
// handle error
}
More advanced consumers may wish to provide their own transport via a http.RoundTripper:
config := &client.Config{
Host: "https://localhost:8080",
Transport: oauthclient.Transport(),
}
client, err := client.New(config)
The RESTClient type implements the Kubernetes API conventions (see `docs/devel/api-conventions.md`)
for a given API path and is intended for use by consumers implementing their own Kubernetes
compatible APIs.
*/
package unversioned

View file

@ -1,101 +0,0 @@
/*
Copyright 2014 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
// EndpointsNamespacer has methods to work with Endpoints resources in a namespace
type EndpointsNamespacer interface {
Endpoints(namespace string) EndpointsInterface
}
// EndpointsInterface has methods to work with Endpoints resources
type EndpointsInterface interface {
Create(endpoints *api.Endpoints) (*api.Endpoints, error)
List(opts api.ListOptions) (*api.EndpointsList, error)
Get(name string) (*api.Endpoints, error)
Delete(name string) error
Update(endpoints *api.Endpoints) (*api.Endpoints, error)
Watch(opts api.ListOptions) (watch.Interface, error)
}
// endpoints implements EndpointsInterface
type endpoints struct {
r *Client
ns string
}
// newEndpoints returns a endpoints
func newEndpoints(c *Client, namespace string) *endpoints {
return &endpoints{c, namespace}
}
// Create creates a new endpoint.
func (c *endpoints) Create(endpoints *api.Endpoints) (*api.Endpoints, error) {
result := &api.Endpoints{}
err := c.r.Post().Namespace(c.ns).Resource("endpoints").Body(endpoints).Do().Into(result)
return result, err
}
// List takes a selector, and returns the list of endpoints that match that selector
func (c *endpoints) List(opts api.ListOptions) (result *api.EndpointsList, err error) {
result = &api.EndpointsList{}
err = c.r.Get().
Namespace(c.ns).
Resource("endpoints").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return
}
// Get returns information about the endpoints for a particular service.
func (c *endpoints) Get(name string) (result *api.Endpoints, err error) {
result = &api.Endpoints{}
err = c.r.Get().Namespace(c.ns).Resource("endpoints").Name(name).Do().Into(result)
return
}
// Delete takes the name of the endpoint, and returns an error if one occurs
func (c *endpoints) Delete(name string) error {
return c.r.Delete().Namespace(c.ns).Resource("endpoints").Name(name).Do().Error()
}
// Watch returns a watch.Interface that watches the requested endpoints for a service.
func (c *endpoints) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("endpoints").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
func (c *endpoints) Update(endpoints *api.Endpoints) (*api.Endpoints, error) {
result := &api.Endpoints{}
err := c.r.Put().
Namespace(c.ns).
Resource("endpoints").
Name(endpoints.Name).
Body(endpoints).
Do().
Into(result)
return result, err
}

View file

@ -1,219 +0,0 @@
/*
Copyright 2014 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 (
"fmt"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/watch"
)
// EventNamespacer can return an EventInterface for the given namespace.
type EventNamespacer interface {
Events(namespace string) EventInterface
}
// EventInterface has methods to work with Event resources
type EventInterface interface {
Create(event *api.Event) (*api.Event, error)
Update(event *api.Event) (*api.Event, error)
Patch(event *api.Event, data []byte) (*api.Event, error)
List(opts api.ListOptions) (*api.EventList, error)
Get(name string) (*api.Event, error)
Watch(opts api.ListOptions) (watch.Interface, error)
// Search finds events about the specified object
Search(objOrRef runtime.Object) (*api.EventList, error)
Delete(name string) error
// DeleteCollection deletes a collection of events.
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
// Returns the appropriate field selector based on the API version being used to communicate with the server.
// The returned field selector can be used with List and Watch to filter desired events.
GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector
}
// events implements Events interface
type events struct {
client *Client
namespace string
}
// newEvents returns a new events object.
func newEvents(c *Client, ns string) *events {
return &events{
client: c,
namespace: ns,
}
}
// Create makes a new event. Returns the copy of the event the server returns,
// or an error. The namespace to create the event within is deduced from the
// event; it must either match this event client's namespace, or this event
// client must have been created with the "" namespace.
func (e *events) Create(event *api.Event) (*api.Event, error) {
if e.namespace != "" && event.Namespace != e.namespace {
return nil, fmt.Errorf("can't create an event with namespace '%v' in namespace '%v'", event.Namespace, e.namespace)
}
result := &api.Event{}
err := e.client.Post().
Namespace(event.Namespace).
Resource("events").
Body(event).
Do().
Into(result)
return result, err
}
// Update modifies an existing event. It returns the copy of the event that the server returns,
// or an error. The namespace and key to update the event within is deduced from the event. The
// namespace must either match this event client's namespace, or this event client must have been
// created with the "" namespace. Update also requires the ResourceVersion to be set in the event
// object.
func (e *events) Update(event *api.Event) (*api.Event, error) {
result := &api.Event{}
err := e.client.Put().
Namespace(event.Namespace).
Resource("events").
Name(event.Name).
Body(event).
Do().
Into(result)
return result, err
}
// Patch modifies an existing event. It returns the copy of the event that the server returns, or an
// error. The namespace and name of the target event is deduced from the incompleteEvent. The
// namespace must either match this event client's namespace, or this event client must have been
// created with the "" namespace.
func (e *events) Patch(incompleteEvent *api.Event, data []byte) (*api.Event, error) {
result := &api.Event{}
err := e.client.Patch(api.StrategicMergePatchType).
Namespace(incompleteEvent.Namespace).
Resource("events").
Name(incompleteEvent.Name).
Body(data).
Do().
Into(result)
return result, err
}
// List returns a list of events matching the selectors.
func (e *events) List(opts api.ListOptions) (*api.EventList, error) {
result := &api.EventList{}
err := e.client.Get().
Namespace(e.namespace).
Resource("events").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return result, err
}
// Get returns the given event, or an error.
func (e *events) Get(name string) (*api.Event, error) {
result := &api.Event{}
err := e.client.Get().
Namespace(e.namespace).
Resource("events").
Name(name).
Do().
Into(result)
return result, err
}
// Watch starts watching for events matching the given selectors.
func (e *events) Watch(opts api.ListOptions) (watch.Interface, error) {
return e.client.Get().
Prefix("watch").
Namespace(e.namespace).
Resource("events").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
// Search finds events about the specified object. The namespace of the
// object must match this event's client namespace unless the event client
// was made with the "" namespace.
func (e *events) Search(objOrRef runtime.Object) (*api.EventList, error) {
ref, err := api.GetReference(objOrRef)
if err != nil {
return nil, err
}
if e.namespace != "" && ref.Namespace != e.namespace {
return nil, fmt.Errorf("won't be able to find any events of namespace '%v' in namespace '%v'", ref.Namespace, e.namespace)
}
stringRefKind := string(ref.Kind)
var refKind *string
if stringRefKind != "" {
refKind = &stringRefKind
}
stringRefUID := string(ref.UID)
var refUID *string
if stringRefUID != "" {
refUID = &stringRefUID
}
fieldSelector := e.GetFieldSelector(&ref.Name, &ref.Namespace, refKind, refUID)
return e.List(api.ListOptions{FieldSelector: fieldSelector})
}
// Delete deletes an existing event.
func (e *events) Delete(name string) error {
return e.client.Delete().
Namespace(e.namespace).
Resource("events").
Name(name).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (e *events) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
return e.client.Delete().
Namespace(e.namespace).
Resource("events").
VersionedParams(&listOptions, api.ParameterCodec).
Body(options).
Do().
Error()
}
// Returns the appropriate field selector based on the API version being used to communicate with the server.
// The returned field selector can be used with List and Watch to filter desired events.
func (e *events) GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector {
apiVersion := e.client.APIVersion().String()
field := fields.Set{}
if involvedObjectName != nil {
field[GetInvolvedObjectNameFieldLabel(apiVersion)] = *involvedObjectName
}
if involvedObjectNamespace != nil {
field["involvedObject.namespace"] = *involvedObjectNamespace
}
if involvedObjectKind != nil {
field["involvedObject.kind"] = *involvedObjectKind
}
if involvedObjectUID != nil {
field["involvedObject.uid"] = *involvedObjectUID
}
return field.AsSelector()
}
// Returns the appropriate field label to use for name of the involved object as per the given API version.
func GetInvolvedObjectNameFieldLabel(version string) string {
return "involvedObject.name"
}

View file

@ -1,109 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/client/restclient"
)
// Interface holds the experimental methods for clients of Kubernetes
// to allow mock testing.
// Features of Extensions group are not supported and may be changed or removed in
// incompatible ways at any time.
type ExtensionsInterface interface {
ScaleNamespacer
DaemonSetsNamespacer
DeploymentsNamespacer
JobsNamespacer
IngressNamespacer
NetworkPolicyNamespacer
ThirdPartyResourceNamespacer
ReplicaSetsNamespacer
PodSecurityPoliciesInterface
}
// ExtensionsClient is used to interact with experimental Kubernetes features.
// Features of Extensions group are not supported and may be changed or removed in
// incompatible ways at any time.
type ExtensionsClient struct {
*restclient.RESTClient
}
func (c *ExtensionsClient) PodSecurityPolicies() PodSecurityPolicyInterface {
return newPodSecurityPolicy(c)
}
func (c *ExtensionsClient) Scales(namespace string) ScaleInterface {
return newScales(c, namespace)
}
func (c *ExtensionsClient) DaemonSets(namespace string) DaemonSetInterface {
return newDaemonSets(c, namespace)
}
func (c *ExtensionsClient) Deployments(namespace string) DeploymentInterface {
return newDeployments(c, namespace)
}
func (c *ExtensionsClient) Jobs(namespace string) JobInterface {
return newJobs(c, namespace)
}
func (c *ExtensionsClient) Ingress(namespace string) IngressInterface {
return newIngress(c, namespace)
}
func (c *ExtensionsClient) NetworkPolicies(namespace string) NetworkPolicyInterface {
return newNetworkPolicies(c, namespace)
}
func (c *ExtensionsClient) ThirdPartyResources() ThirdPartyResourceInterface {
return newThirdPartyResources(c)
}
func (c *ExtensionsClient) ReplicaSets(namespace string) ReplicaSetInterface {
return newReplicaSets(c, namespace)
}
// NewExtensions creates a new ExtensionsClient for the given config. This client
// provides access to experimental Kubernetes features.
// Features of Extensions group are not supported and may be changed or removed in
// incompatible ways at any time.
func NewExtensions(c *restclient.Config) (*ExtensionsClient, error) {
config := *c
if err := setGroupDefaults(extensions.GroupName, &config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &ExtensionsClient{client}, nil
}
// NewExtensionsOrDie creates a new ExtensionsClient for the given config and
// panics if there is an error in the config.
// Features of Extensions group are not supported and may be changed or removed in
// incompatible ways at any time.
func NewExtensionsOrDie(c *restclient.Config) *ExtensionsClient {
client, err := NewExtensions(c)
if err != nil {
panic(err)
}
return client
}

View file

@ -1,31 +0,0 @@
/*
Copyright 2014 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 (
"time"
)
// FlagSet abstracts the flag interface for compatibility with both Golang "flag"
// and cobra pflags (Posix style).
type FlagSet interface {
StringVar(p *string, name, value, usage string)
BoolVar(p *bool, name string, value bool, usage string)
UintVar(p *uint, name string, value uint, usage string)
DurationVar(p *time.Duration, name string, value time.Duration, usage string)
IntVar(p *int, name string, value int, usage string)
}

View file

@ -17,25 +17,9 @@ limitations under the License.
package unversioned
import (
"fmt"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apimachinery/registered"
"k8s.io/kubernetes/pkg/apis/apps"
"k8s.io/kubernetes/pkg/apis/authentication"
"k8s.io/kubernetes/pkg/apis/authorization"
"k8s.io/kubernetes/pkg/apis/autoscaling"
"k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/apis/certificates"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/policy"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/client/typed/discovery"
"k8s.io/kubernetes/pkg/util/sets"
"k8s.io/kubernetes/pkg/version"
// Import solely to initialize client auth plugins.
_ "k8s.io/kubernetes/plugin/pkg/client/auth"
)
@ -45,255 +29,6 @@ const (
defaultAPIPath = "/apis"
)
// New creates a Kubernetes client for the given config. This client works with pods,
// replication controllers, daemons, and services. It allows operations such as list, get, update
// and delete on these objects. An error is returned if the provided configuration
// is not valid.
func New(c *restclient.Config) (*Client, error) {
config := *c
if err := SetKubernetesDefaults(&config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
discoveryConfig := *c
discoveryClient, err := discovery.NewDiscoveryClientForConfig(&discoveryConfig)
if err != nil {
return nil, err
}
var authorizationClient *AuthorizationClient
if registered.IsRegistered(authorization.GroupName) {
authorizationConfig := *c
authorizationClient, err = NewAuthorization(&authorizationConfig)
if err != nil {
return nil, err
}
}
var autoscalingClient *AutoscalingClient
if registered.IsRegistered(autoscaling.GroupName) {
autoscalingConfig := *c
autoscalingClient, err = NewAutoscaling(&autoscalingConfig)
if err != nil {
return nil, err
}
}
var authenticationClient *AuthenticationClient
if registered.IsRegistered(authentication.GroupName) {
authenticationConfig := *c
authenticationClient, err = NewAuthentication(&authenticationConfig)
if err != nil {
return nil, err
}
}
var batchClient *BatchClient
if registered.IsRegistered(batch.GroupName) {
batchConfig := *c
batchClient, err = NewBatch(&batchConfig)
if err != nil {
return nil, err
}
}
var extensionsClient *ExtensionsClient
if registered.IsRegistered(extensions.GroupName) {
extensionsConfig := *c
extensionsClient, err = NewExtensions(&extensionsConfig)
if err != nil {
return nil, err
}
}
var policyClient *PolicyClient
if registered.IsRegistered(policy.GroupName) {
policyConfig := *c
policyClient, err = NewPolicy(&policyConfig)
if err != nil {
return nil, err
}
}
var certsClient *CertificatesClient
if registered.IsRegistered(certificates.GroupName) {
certsConfig := *c
certsClient, err = NewCertificates(&certsConfig)
if err != nil {
return nil, err
}
}
var appsClient *AppsClient
if registered.IsRegistered(apps.GroupName) {
appsConfig := *c
appsClient, err = NewApps(&appsConfig)
if err != nil {
return nil, err
}
}
var rbacClient *RbacClient
if registered.IsRegistered(rbac.GroupName) {
rbacConfig := *c
rbacClient, err = NewRbac(&rbacConfig)
if err != nil {
return nil, err
}
}
var storageClient *StorageClient
if registered.IsRegistered(storage.GroupName) {
storageConfig := *c
storageClient, err = NewStorage(&storageConfig)
if err != nil {
return nil, err
}
}
return &Client{
RESTClient: client,
AppsClient: appsClient,
AuthenticationClient: authenticationClient,
AuthorizationClient: authorizationClient,
AutoscalingClient: autoscalingClient,
BatchClient: batchClient,
CertificatesClient: certsClient,
DiscoveryClient: discoveryClient,
ExtensionsClient: extensionsClient,
PolicyClient: policyClient,
RbacClient: rbacClient,
StorageClient: storageClient,
}, nil
}
// MatchesServerVersion queries the server to compares the build version
// (git hash) of the client with the server's build version. It returns an error
// if it failed to contact the server or if the versions are not an exact match.
func MatchesServerVersion(client *Client, c *restclient.Config) error {
var err error
if client == nil {
client, err = New(c)
if err != nil {
return err
}
}
cVer := version.Get()
sVer, err := client.Discovery().ServerVersion()
if err != nil {
return fmt.Errorf("couldn't read version from server: %v\n", err)
}
// GitVersion includes GitCommit and GitTreeState, but best to be safe?
if cVer.GitVersion != sVer.GitVersion || cVer.GitCommit != sVer.GitCommit || cVer.GitTreeState != sVer.GitTreeState {
return fmt.Errorf("server version (%#v) differs from client version (%#v)!\n", sVer, cVer)
}
return nil
}
// NegotiateVersion queries the server's supported api versions to find
// a version that both client and server support.
// - If no version is provided, try registered client versions in order of
// preference.
// - If version is provided, but not default config (explicitly requested via
// commandline flag), and is unsupported by the server, print a warning to
// stderr and try client's registered versions in order of preference.
// - If version is config default, and the server does not support it,
// return an error.
func NegotiateVersion(client *Client, c *restclient.Config, requestedGV *unversioned.GroupVersion, clientRegisteredGVs []unversioned.GroupVersion) (*unversioned.GroupVersion, error) {
var err error
if client == nil {
client, err = New(c)
if err != nil {
return nil, err
}
}
clientVersions := sets.String{}
for _, gv := range clientRegisteredGVs {
clientVersions.Insert(gv.String())
}
groups, err := client.ServerGroups()
if err != nil {
// This is almost always a connection error, and higher level code should treat this as a generic error,
// not a negotiation specific error.
return nil, err
}
versions := unversioned.ExtractGroupVersions(groups)
serverVersions := sets.String{}
for _, v := range versions {
serverVersions.Insert(v)
}
// If no version requested, use config version (may also be empty).
// make a copy of the original so we don't risk mutating input here or in the returned value
var preferredGV *unversioned.GroupVersion
switch {
case requestedGV != nil:
t := *requestedGV
preferredGV = &t
case c.GroupVersion != nil:
t := *c.GroupVersion
preferredGV = &t
}
// If version explicitly requested verify that both client and server support it.
// If server does not support warn, but try to negotiate a lower version.
if preferredGV != nil {
if !clientVersions.Has(preferredGV.String()) {
return nil, fmt.Errorf("client does not support API version %q; client supported API versions: %v", preferredGV, clientVersions)
}
// If the server supports no versions, then we should just use the preferredGV
// This can happen because discovery fails due to 403 Forbidden errors
if len(serverVersions) == 0 {
return preferredGV, nil
}
if serverVersions.Has(preferredGV.String()) {
return preferredGV, nil
}
// If we are using an explicit config version the server does not support, fail.
if (c.GroupVersion != nil) && (*preferredGV == *c.GroupVersion) {
return nil, fmt.Errorf("server does not support API version %q", preferredGV)
}
}
for _, clientGV := range clientRegisteredGVs {
if serverVersions.Has(clientGV.String()) {
// Version was not explicitly requested in command config (--api-version).
// Ok to fall back to a supported version with a warning.
// TODO: caesarxuchao: enable the warning message when we have
// proper fix. Please refer to issue #14895.
// if len(version) != 0 {
// glog.Warningf("Server does not support API version '%s'. Falling back to '%s'.", version, clientVersion)
// }
t := clientGV
return &t, nil
}
}
return nil, fmt.Errorf("failed to negotiate an api version; server supports: %v, client supports: %v",
serverVersions, clientVersions)
}
// NewOrDie creates a Kubernetes client and panics if the provided API version is not recognized.
func NewOrDie(c *restclient.Config) *Client {
client, err := New(c)
if err != nil {
panic(err)
}
return client
}
// NewInCluster is a shortcut for calling InClusterConfig() and then New().
func NewInCluster() (*Client, error) {
cc, err := restclient.InClusterConfig()
if err != nil {
return nil, err
}
return New(cc)
}
// SetKubernetesDefaults sets default values on the provided client config for accessing the
// Kubernetes API or returns an error if any of the defaults are impossible or invalid.
// TODO: this method needs to be split into one that sets defaults per group, expected to be fix in PR "Refactoring clientcache.go and helper.go #14592"

View file

@ -1,103 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/autoscaling"
"k8s.io/kubernetes/pkg/watch"
)
// HorizontalPodAutoscalersNamespacer has methods to work with HorizontalPodAutoscaler resources in a namespace
type HorizontalPodAutoscalersNamespacer interface {
HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface
}
// HorizontalPodAutoscalerInterface has methods to work with HorizontalPodAutoscaler resources.
type HorizontalPodAutoscalerInterface interface {
List(opts api.ListOptions) (*autoscaling.HorizontalPodAutoscalerList, error)
Get(name string) (*autoscaling.HorizontalPodAutoscaler, error)
Delete(name string, options *api.DeleteOptions) error
Create(horizontalPodAutoscaler *autoscaling.HorizontalPodAutoscaler) (*autoscaling.HorizontalPodAutoscaler, error)
Update(horizontalPodAutoscaler *autoscaling.HorizontalPodAutoscaler) (*autoscaling.HorizontalPodAutoscaler, error)
UpdateStatus(horizontalPodAutoscaler *autoscaling.HorizontalPodAutoscaler) (*autoscaling.HorizontalPodAutoscaler, error)
Watch(opts api.ListOptions) (watch.Interface, error)
}
// horizontalPodAutoscalers implements HorizontalPodAutoscalersNamespacer interface using AutoscalingClient internally
type horizontalPodAutoscalers struct {
client *AutoscalingClient
ns string
}
// newHorizontalPodAutoscalers returns a horizontalPodAutoscalers
func newHorizontalPodAutoscalers(c *AutoscalingClient, namespace string) *horizontalPodAutoscalers {
return &horizontalPodAutoscalers{
client: c,
ns: namespace,
}
}
// List takes label and field selectors, and returns the list of horizontalPodAutoscalers that match those selectors.
func (c *horizontalPodAutoscalers) List(opts api.ListOptions) (result *autoscaling.HorizontalPodAutoscalerList, err error) {
result = &autoscaling.HorizontalPodAutoscalerList{}
err = c.client.Get().Namespace(c.ns).Resource("horizontalPodAutoscalers").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get takes the name of the horizontalPodAutoscaler, and returns the corresponding HorizontalPodAutoscaler object, and an error if it occurs
func (c *horizontalPodAutoscalers) Get(name string) (result *autoscaling.HorizontalPodAutoscaler, err error) {
result = &autoscaling.HorizontalPodAutoscaler{}
err = c.client.Get().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(name).Do().Into(result)
return
}
// Delete takes the name of the horizontalPodAutoscaler and deletes it. Returns an error if one occurs.
func (c *horizontalPodAutoscalers) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(name).Body(options).Do().Error()
}
// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if it occurs.
func (c *horizontalPodAutoscalers) Create(horizontalPodAutoscaler *autoscaling.HorizontalPodAutoscaler) (result *autoscaling.HorizontalPodAutoscaler, err error) {
result = &autoscaling.HorizontalPodAutoscaler{}
err = c.client.Post().Namespace(c.ns).Resource("horizontalPodAutoscalers").Body(horizontalPodAutoscaler).Do().Into(result)
return
}
// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if it occurs.
func (c *horizontalPodAutoscalers) Update(horizontalPodAutoscaler *autoscaling.HorizontalPodAutoscaler) (result *autoscaling.HorizontalPodAutoscaler, err error) {
result = &autoscaling.HorizontalPodAutoscaler{}
err = c.client.Put().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(horizontalPodAutoscaler.Name).Body(horizontalPodAutoscaler).Do().Into(result)
return
}
// UpdateStatus takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if it occurs.
func (c *horizontalPodAutoscalers) UpdateStatus(horizontalPodAutoscaler *autoscaling.HorizontalPodAutoscaler) (result *autoscaling.HorizontalPodAutoscaler, err error) {
result = &autoscaling.HorizontalPodAutoscaler{}
err = c.client.Put().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(horizontalPodAutoscaler.Name).SubResource("status").Body(horizontalPodAutoscaler).Do().Into(result)
return
}
// Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers.
func (c *horizontalPodAutoscalers) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("horizontalPodAutoscalers").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,42 +0,0 @@
/*
Copyright 2015 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
// These imports are the API groups the client will support.
import (
"fmt"
_ "k8s.io/kubernetes/pkg/api/install"
"k8s.io/kubernetes/pkg/apimachinery/registered"
_ "k8s.io/kubernetes/pkg/apis/apps/install"
_ "k8s.io/kubernetes/pkg/apis/authentication/install"
_ "k8s.io/kubernetes/pkg/apis/authorization/install"
_ "k8s.io/kubernetes/pkg/apis/autoscaling/install"
_ "k8s.io/kubernetes/pkg/apis/batch/install"
_ "k8s.io/kubernetes/pkg/apis/certificates/install"
_ "k8s.io/kubernetes/pkg/apis/componentconfig/install"
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
_ "k8s.io/kubernetes/pkg/apis/policy/install"
_ "k8s.io/kubernetes/pkg/apis/rbac/install"
_ "k8s.io/kubernetes/pkg/apis/storage/install"
)
func init() {
if missingVersions := registered.ValidateEnvRequestedVersions(); len(missingVersions) != 0 {
panic(fmt.Sprintf("KUBE_API_VERSIONS contains versions that are not installed: %q.", missingVersions))
}
}

View file

@ -1,100 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/watch"
)
// IngressNamespacer has methods to work with Ingress resources in a namespace
type IngressNamespacer interface {
Ingress(namespace string) IngressInterface
}
// IngressInterface exposes methods to work on Ingress resources.
type IngressInterface interface {
List(opts api.ListOptions) (*extensions.IngressList, error)
Get(name string) (*extensions.Ingress, error)
Create(ingress *extensions.Ingress) (*extensions.Ingress, error)
Update(ingress *extensions.Ingress) (*extensions.Ingress, error)
Delete(name string, options *api.DeleteOptions) error
Watch(opts api.ListOptions) (watch.Interface, error)
UpdateStatus(ingress *extensions.Ingress) (*extensions.Ingress, error)
}
// ingress implements IngressNamespacer interface
type ingress struct {
r *ExtensionsClient
ns string
}
// newIngress returns a ingress
func newIngress(c *ExtensionsClient, namespace string) *ingress {
return &ingress{c, namespace}
}
// List returns a list of ingress that match the label and field selectors.
func (c *ingress) List(opts api.ListOptions) (result *extensions.IngressList, err error) {
result = &extensions.IngressList{}
err = c.r.Get().Namespace(c.ns).Resource("ingresses").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular ingress.
func (c *ingress) Get(name string) (result *extensions.Ingress, err error) {
result = &extensions.Ingress{}
err = c.r.Get().Namespace(c.ns).Resource("ingresses").Name(name).Do().Into(result)
return
}
// Create creates a new ingress.
func (c *ingress) Create(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {
result = &extensions.Ingress{}
err = c.r.Post().Namespace(c.ns).Resource("ingresses").Body(ingress).Do().Into(result)
return
}
// Update updates an existing ingress.
func (c *ingress) Update(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {
result = &extensions.Ingress{}
err = c.r.Put().Namespace(c.ns).Resource("ingresses").Name(ingress.Name).Body(ingress).Do().Into(result)
return
}
// Delete deletes a ingress, returns error if one occurs.
func (c *ingress) Delete(name string, options *api.DeleteOptions) (err error) {
return c.r.Delete().Namespace(c.ns).Resource("ingresses").Name(name).Body(options).Do().Error()
}
// Watch returns a watch.Interface that watches the requested ingress.
func (c *ingress) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("ingresses").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
// UpdateStatus takes the name of the ingress and the new status. Returns the server's representation of the ingress, and an error, if it occurs.
func (c *ingress) UpdateStatus(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {
result = &extensions.Ingress{}
err = c.r.Put().Namespace(c.ns).Resource("ingresses").Name(ingress.Name).SubResource("status").Body(ingress).Do().Into(result)
return
}

View file

@ -1,167 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/watch"
)
// JobsNamespacer has methods to work with Job resources in a namespace
type JobsNamespacer interface {
Jobs(namespace string) JobInterface
}
// JobInterface exposes methods to work on Job resources.
type JobInterface interface {
List(opts api.ListOptions) (*batch.JobList, error)
Get(name string) (*batch.Job, error)
Create(job *batch.Job) (*batch.Job, error)
Update(job *batch.Job) (*batch.Job, error)
Delete(name string, options *api.DeleteOptions) error
Watch(opts api.ListOptions) (watch.Interface, error)
UpdateStatus(job *batch.Job) (*batch.Job, error)
}
// jobs implements JobsNamespacer interface
type jobs struct {
r *ExtensionsClient
ns string
}
// newJobs returns a jobs
func newJobs(c *ExtensionsClient, namespace string) *jobs {
return &jobs{c, namespace}
}
// Ensure statically that jobs implements JobInterface.
var _ JobInterface = &jobs{}
// List returns a list of jobs that match the label and field selectors.
func (c *jobs) List(opts api.ListOptions) (result *batch.JobList, err error) {
result = &batch.JobList{}
err = c.r.Get().Namespace(c.ns).Resource("jobs").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular job.
func (c *jobs) Get(name string) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.r.Get().Namespace(c.ns).Resource("jobs").Name(name).Do().Into(result)
return
}
// Create creates a new job.
func (c *jobs) Create(job *batch.Job) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.r.Post().Namespace(c.ns).Resource("jobs").Body(job).Do().Into(result)
return
}
// Update updates an existing job.
func (c *jobs) Update(job *batch.Job) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.r.Put().Namespace(c.ns).Resource("jobs").Name(job.Name).Body(job).Do().Into(result)
return
}
// Delete deletes a job, returns error if one occurs.
func (c *jobs) Delete(name string, options *api.DeleteOptions) (err error) {
return c.r.Delete().Namespace(c.ns).Resource("jobs").Name(name).Body(options).Do().Error()
}
// Watch returns a watch.Interface that watches the requested jobs.
func (c *jobs) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("jobs").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
// UpdateStatus takes the name of the job and the new status. Returns the server's representation of the job, and an error, if it occurs.
func (c *jobs) UpdateStatus(job *batch.Job) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.r.Put().Namespace(c.ns).Resource("jobs").Name(job.Name).SubResource("status").Body(job).Do().Into(result)
return
}
// jobsV1 implements JobsNamespacer interface using BatchClient internally
type jobsV1 struct {
r *BatchClient
ns string
}
// newJobsV1 returns a jobsV1
func newJobsV1(c *BatchClient, namespace string) *jobsV1 {
return &jobsV1{c, namespace}
}
// Ensure statically that jobsV1 implements JobInterface.
var _ JobInterface = &jobsV1{}
// List returns a list of jobs that match the label and field selectors.
func (c *jobsV1) List(opts api.ListOptions) (result *batch.JobList, err error) {
result = &batch.JobList{}
err = c.r.Get().Namespace(c.ns).Resource("jobs").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular job.
func (c *jobsV1) Get(name string) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.r.Get().Namespace(c.ns).Resource("jobs").Name(name).Do().Into(result)
return
}
// Create creates a new job.
func (c *jobsV1) Create(job *batch.Job) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.r.Post().Namespace(c.ns).Resource("jobs").Body(job).Do().Into(result)
return
}
// Update updates an existing job.
func (c *jobsV1) Update(job *batch.Job) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.r.Put().Namespace(c.ns).Resource("jobs").Name(job.Name).Body(job).Do().Into(result)
return
}
// Delete deletes a job, returns error if one occurs.
func (c *jobsV1) Delete(name string, options *api.DeleteOptions) (err error) {
return c.r.Delete().Namespace(c.ns).Resource("jobs").Name(name).Body(options).Do().Error()
}
// Watch returns a watch.Interface that watches the requested jobs.
func (c *jobsV1) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("jobs").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
// UpdateStatus takes the name of the job and the new status. Returns the server's representation of the job, and an error, if it occurs.
func (c *jobsV1) UpdateStatus(job *batch.Job) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.r.Put().Namespace(c.ns).Resource("jobs").Name(job.Name).SubResource("status").Body(job).Do().Into(result)
return
}

View file

@ -1,94 +0,0 @@
/*
Copyright 2014 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
// LimitRangesNamespacer has methods to work with LimitRange resources in a namespace
type LimitRangesNamespacer interface {
LimitRanges(namespace string) LimitRangeInterface
}
// LimitRangeInterface has methods to work with LimitRange resources.
type LimitRangeInterface interface {
List(opts api.ListOptions) (*api.LimitRangeList, error)
Get(name string) (*api.LimitRange, error)
Delete(name string) error
Create(limitRange *api.LimitRange) (*api.LimitRange, error)
Update(limitRange *api.LimitRange) (*api.LimitRange, error)
Watch(opts api.ListOptions) (watch.Interface, error)
}
// limitRanges implements LimitRangesNamespacer interface
type limitRanges struct {
r *Client
ns string
}
// newLimitRanges returns a limitRanges
func newLimitRanges(c *Client, namespace string) *limitRanges {
return &limitRanges{
r: c,
ns: namespace,
}
}
// List takes a selector, and returns the list of limitRanges that match that selector.
func (c *limitRanges) List(opts api.ListOptions) (result *api.LimitRangeList, err error) {
result = &api.LimitRangeList{}
err = c.r.Get().Namespace(c.ns).Resource("limitRanges").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get takes the name of the limitRange, and returns the corresponding Pod object, and an error if it occurs
func (c *limitRanges) Get(name string) (result *api.LimitRange, err error) {
result = &api.LimitRange{}
err = c.r.Get().Namespace(c.ns).Resource("limitRanges").Name(name).Do().Into(result)
return
}
// Delete takes the name of the limitRange, and returns an error if one occurs
func (c *limitRanges) Delete(name string) error {
return c.r.Delete().Namespace(c.ns).Resource("limitRanges").Name(name).Do().Error()
}
// Create takes the representation of a limitRange. Returns the server's representation of the limitRange, and an error, if it occurs.
func (c *limitRanges) Create(limitRange *api.LimitRange) (result *api.LimitRange, err error) {
result = &api.LimitRange{}
err = c.r.Post().Namespace(c.ns).Resource("limitRanges").Body(limitRange).Do().Into(result)
return
}
// Update takes the representation of a limitRange to update. Returns the server's representation of the limitRange, and an error, if it occurs.
func (c *limitRanges) Update(limitRange *api.LimitRange) (result *api.LimitRange, err error) {
result = &api.LimitRange{}
err = c.r.Put().Namespace(c.ns).Resource("limitRanges").Name(limitRange.Name).Body(limitRange).Do().Into(result)
return
}
// Watch returns a watch.Interface that watches the requested resource
func (c *limitRanges) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("limitRanges").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,116 +0,0 @@
/*
Copyright 2014 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 (
"fmt"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
type NamespacesInterface interface {
Namespaces() NamespaceInterface
}
type NamespaceInterface interface {
Create(item *api.Namespace) (*api.Namespace, error)
Get(name string) (result *api.Namespace, err error)
List(opts api.ListOptions) (*api.NamespaceList, error)
Delete(name string) error
Update(item *api.Namespace) (*api.Namespace, error)
Watch(opts api.ListOptions) (watch.Interface, error)
Finalize(item *api.Namespace) (*api.Namespace, error)
Status(item *api.Namespace) (*api.Namespace, error)
}
// namespaces implements NamespacesInterface
type namespaces struct {
r *Client
}
// newNamespaces returns a namespaces object.
func newNamespaces(c *Client) *namespaces {
return &namespaces{r: c}
}
// Create creates a new namespace.
func (c *namespaces) Create(namespace *api.Namespace) (*api.Namespace, error) {
result := &api.Namespace{}
err := c.r.Post().Resource("namespaces").Body(namespace).Do().Into(result)
return result, err
}
// List lists all the namespaces in the cluster.
func (c *namespaces) List(opts api.ListOptions) (*api.NamespaceList, error) {
result := &api.NamespaceList{}
err := c.r.Get().
Resource("namespaces").
VersionedParams(&opts, api.ParameterCodec).
Do().Into(result)
return result, err
}
// Update takes the representation of a namespace to update. Returns the server's representation of the namespace, and an error, if it occurs.
func (c *namespaces) Update(namespace *api.Namespace) (result *api.Namespace, err error) {
result = &api.Namespace{}
err = c.r.Put().Resource("namespaces").Name(namespace.Name).Body(namespace).Do().Into(result)
return
}
// Finalize takes the representation of a namespace to update. Returns the server's representation of the namespace, and an error, if it occurs.
func (c *namespaces) Finalize(namespace *api.Namespace) (result *api.Namespace, err error) {
result = &api.Namespace{}
if len(namespace.ResourceVersion) == 0 {
err = fmt.Errorf("invalid update object, missing resource version: %v", namespace)
return
}
err = c.r.Put().Resource("namespaces").Name(namespace.Name).SubResource("finalize").Body(namespace).Do().Into(result)
return
}
// Status takes the representation of a namespace to update. Returns the server's representation of the namespace, and an error, if it occurs.
func (c *namespaces) Status(namespace *api.Namespace) (result *api.Namespace, err error) {
result = &api.Namespace{}
if len(namespace.ResourceVersion) == 0 {
err = fmt.Errorf("invalid update object, missing resource version: %v", namespace)
return
}
err = c.r.Put().Resource("namespaces").Name(namespace.Name).SubResource("status").Body(namespace).Do().Into(result)
return
}
// Get gets an existing namespace
func (c *namespaces) Get(name string) (*api.Namespace, error) {
result := &api.Namespace{}
err := c.r.Get().Resource("namespaces").Name(name).Do().Into(result)
return result, err
}
// Delete deletes an existing namespace.
func (c *namespaces) Delete(name string) error {
return c.r.Delete().Resource("namespaces").Name(name).Do().Error()
}
// Watch returns a watch.Interface that watches the requested namespaces.
func (c *namespaces) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Resource("namespaces").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,92 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/watch"
)
// NetworkPolicyNamespacer has methods to work with NetworkPolicy resources in a namespace
type NetworkPolicyNamespacer interface {
NetworkPolicies(namespace string) NetworkPolicyInterface
}
// NetworkPolicyInterface exposes methods to work on NetworkPolicy resources.
type NetworkPolicyInterface interface {
List(opts api.ListOptions) (*extensions.NetworkPolicyList, error)
Get(name string) (*extensions.NetworkPolicy, error)
Create(networkPolicy *extensions.NetworkPolicy) (*extensions.NetworkPolicy, error)
Update(networkPolicy *extensions.NetworkPolicy) (*extensions.NetworkPolicy, error)
Delete(name string, options *api.DeleteOptions) error
Watch(opts api.ListOptions) (watch.Interface, error)
}
// NetworkPolicies implements NetworkPolicyNamespacer interface
type NetworkPolicies struct {
r *ExtensionsClient
ns string
}
// newNetworkPolicies returns a NetworkPolicies
func newNetworkPolicies(c *ExtensionsClient, namespace string) *NetworkPolicies {
return &NetworkPolicies{c, namespace}
}
// List returns a list of networkPolicy that match the label and field selectors.
func (c *NetworkPolicies) List(opts api.ListOptions) (result *extensions.NetworkPolicyList, err error) {
result = &extensions.NetworkPolicyList{}
err = c.r.Get().Namespace(c.ns).Resource("networkpolicies").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular networkPolicy.
func (c *NetworkPolicies) Get(name string) (result *extensions.NetworkPolicy, err error) {
result = &extensions.NetworkPolicy{}
err = c.r.Get().Namespace(c.ns).Resource("networkpolicies").Name(name).Do().Into(result)
return
}
// Create creates a new networkPolicy.
func (c *NetworkPolicies) Create(networkPolicy *extensions.NetworkPolicy) (result *extensions.NetworkPolicy, err error) {
result = &extensions.NetworkPolicy{}
err = c.r.Post().Namespace(c.ns).Resource("networkpolicies").Body(networkPolicy).Do().Into(result)
return
}
// Update updates an existing networkPolicy.
func (c *NetworkPolicies) Update(networkPolicy *extensions.NetworkPolicy) (result *extensions.NetworkPolicy, err error) {
result = &extensions.NetworkPolicy{}
err = c.r.Put().Namespace(c.ns).Resource("networkpolicies").Name(networkPolicy.Name).Body(networkPolicy).Do().Into(result)
return
}
// Delete deletes a networkPolicy, returns error if one occurs.
func (c *NetworkPolicies) Delete(name string, options *api.DeleteOptions) (err error) {
return c.r.Delete().Namespace(c.ns).Resource("networkpolicies").Name(name).Body(options).Do().Error()
}
// Watch returns a watch.Interface that watches the requested networkPolicy.
func (c *NetworkPolicies) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("networkpolicies").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,111 +0,0 @@
/*
Copyright 2014 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
type NodesInterface interface {
Nodes() NodeInterface
}
type NodeInterface interface {
Get(name string) (result *api.Node, err error)
Create(node *api.Node) (*api.Node, error)
List(opts api.ListOptions) (*api.NodeList, error)
Delete(name string) error
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
Update(*api.Node) (*api.Node, error)
UpdateStatus(*api.Node) (*api.Node, error)
Watch(opts api.ListOptions) (watch.Interface, error)
}
// nodes implements NodesInterface
type nodes struct {
r *Client
}
// newNodes returns a nodes object.
func newNodes(c *Client) *nodes {
return &nodes{c}
}
// resourceName returns node's URL resource name.
func (c *nodes) resourceName() string {
return "nodes"
}
// Create creates a new node.
func (c *nodes) Create(node *api.Node) (*api.Node, error) {
result := &api.Node{}
err := c.r.Post().Resource(c.resourceName()).Body(node).Do().Into(result)
return result, err
}
// List takes a selector, and returns the list of nodes that match that selector in the cluster.
func (c *nodes) List(opts api.ListOptions) (*api.NodeList, error) {
result := &api.NodeList{}
err := c.r.Get().Resource(c.resourceName()).VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return result, err
}
// Get gets an existing node.
func (c *nodes) Get(name string) (*api.Node, error) {
result := &api.Node{}
err := c.r.Get().Resource(c.resourceName()).Name(name).Do().Into(result)
return result, err
}
// Delete deletes an existing node.
func (c *nodes) Delete(name string) error {
return c.r.Delete().Resource(c.resourceName()).Name(name).Do().Error()
}
// DeleteCollection deletes a collection of nodes.
func (c *nodes) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
return c.r.Delete().
Resource(c.resourceName()).
VersionedParams(&listOptions, api.ParameterCodec).
Body(options).
Do().
Error()
}
// Update updates an existing node.
func (c *nodes) Update(node *api.Node) (*api.Node, error) {
result := &api.Node{}
err := c.r.Put().Resource(c.resourceName()).Name(node.Name).Body(node).Do().Into(result)
return result, err
}
func (c *nodes) UpdateStatus(node *api.Node) (*api.Node, error) {
result := &api.Node{}
err := c.r.Put().Resource(c.resourceName()).Name(node.Name).SubResource("status").Body(node).Do().Into(result)
return result, err
}
// Watch returns a watch.Interface that watches the requested nodes.
func (c *nodes) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(api.NamespaceAll).
Resource(c.resourceName()).
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,99 +0,0 @@
/*
Copyright 2014 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
// PersistentVolumeClaimsNamespacer has methods to work with PersistentVolumeClaim resources in a namespace
type PersistentVolumeClaimsNamespacer interface {
PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface
}
// PersistentVolumeClaimInterface has methods to work with PersistentVolumeClaim resources.
type PersistentVolumeClaimInterface interface {
List(opts api.ListOptions) (*api.PersistentVolumeClaimList, error)
Get(name string) (*api.PersistentVolumeClaim, error)
Create(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)
Update(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)
UpdateStatus(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)
Delete(name string) error
Watch(opts api.ListOptions) (watch.Interface, error)
}
// persistentVolumeClaims implements PersistentVolumeClaimsNamespacer interface
type persistentVolumeClaims struct {
client *Client
namespace string
}
// newPersistentVolumeClaims returns a PodsClient
func newPersistentVolumeClaims(c *Client, namespace string) *persistentVolumeClaims {
return &persistentVolumeClaims{c, namespace}
}
func (c *persistentVolumeClaims) List(opts api.ListOptions) (result *api.PersistentVolumeClaimList, err error) {
result = &api.PersistentVolumeClaimList{}
err = c.client.Get().
Namespace(c.namespace).
Resource("persistentVolumeClaims").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return result, err
}
func (c *persistentVolumeClaims) Get(name string) (result *api.PersistentVolumeClaim, err error) {
result = &api.PersistentVolumeClaim{}
err = c.client.Get().Namespace(c.namespace).Resource("persistentVolumeClaims").Name(name).Do().Into(result)
return
}
func (c *persistentVolumeClaims) Create(claim *api.PersistentVolumeClaim) (result *api.PersistentVolumeClaim, err error) {
result = &api.PersistentVolumeClaim{}
err = c.client.Post().Namespace(c.namespace).Resource("persistentVolumeClaims").Body(claim).Do().Into(result)
return
}
func (c *persistentVolumeClaims) Update(claim *api.PersistentVolumeClaim) (result *api.PersistentVolumeClaim, err error) {
result = &api.PersistentVolumeClaim{}
err = c.client.Put().Namespace(c.namespace).Resource("persistentVolumeClaims").Name(claim.Name).Body(claim).Do().Into(result)
return
}
func (c *persistentVolumeClaims) UpdateStatus(claim *api.PersistentVolumeClaim) (result *api.PersistentVolumeClaim, err error) {
result = &api.PersistentVolumeClaim{}
err = c.client.Put().Namespace(c.namespace).Resource("persistentVolumeClaims").Name(claim.Name).SubResource("status").Body(claim).Do().Into(result)
return
}
func (c *persistentVolumeClaims) Delete(name string) error {
return c.client.Delete().Namespace(c.namespace).Resource("persistentVolumeClaims").Name(name).Do().Error()
}
func (c *persistentVolumeClaims) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.namespace).
Resource("persistentVolumeClaims").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,93 +0,0 @@
/*
Copyright 2014 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
type PersistentVolumesInterface interface {
PersistentVolumes() PersistentVolumeInterface
}
// PersistentVolumeInterface has methods to work with PersistentVolume resources.
type PersistentVolumeInterface interface {
List(opts api.ListOptions) (*api.PersistentVolumeList, error)
Get(name string) (*api.PersistentVolume, error)
Create(volume *api.PersistentVolume) (*api.PersistentVolume, error)
Update(volume *api.PersistentVolume) (*api.PersistentVolume, error)
UpdateStatus(persistentVolume *api.PersistentVolume) (*api.PersistentVolume, error)
Delete(name string) error
Watch(opts api.ListOptions) (watch.Interface, error)
}
// persistentVolumes implements PersistentVolumesInterface
type persistentVolumes struct {
client *Client
}
func newPersistentVolumes(c *Client) *persistentVolumes {
return &persistentVolumes{c}
}
func (c *persistentVolumes) List(opts api.ListOptions) (result *api.PersistentVolumeList, err error) {
result = &api.PersistentVolumeList{}
err = c.client.Get().
Resource("persistentVolumes").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return result, err
}
func (c *persistentVolumes) Get(name string) (result *api.PersistentVolume, err error) {
result = &api.PersistentVolume{}
err = c.client.Get().Resource("persistentVolumes").Name(name).Do().Into(result)
return
}
func (c *persistentVolumes) Create(volume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
result = &api.PersistentVolume{}
err = c.client.Post().Resource("persistentVolumes").Body(volume).Do().Into(result)
return
}
func (c *persistentVolumes) Update(volume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
result = &api.PersistentVolume{}
err = c.client.Put().Resource("persistentVolumes").Name(volume.Name).Body(volume).Do().Into(result)
return
}
func (c *persistentVolumes) UpdateStatus(volume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
result = &api.PersistentVolume{}
err = c.client.Put().Resource("persistentVolumes").Name(volume.Name).SubResource("status").Body(volume).Do().Into(result)
return
}
func (c *persistentVolumes) Delete(name string) error {
return c.client.Delete().Resource("persistentVolumes").Name(name).Do().Error()
}
func (c *persistentVolumes) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Resource("persistentVolumes").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,100 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/apps"
"k8s.io/kubernetes/pkg/watch"
)
// PetSetNamespacer has methods to work with PetSet resources in a namespace
type PetSetNamespacer interface {
PetSets(namespace string) PetSetInterface
}
// PetSetInterface exposes methods to work on PetSet resources.
type PetSetInterface interface {
List(opts api.ListOptions) (*apps.PetSetList, error)
Get(name string) (*apps.PetSet, error)
Create(petSet *apps.PetSet) (*apps.PetSet, error)
Update(petSet *apps.PetSet) (*apps.PetSet, error)
Delete(name string, options *api.DeleteOptions) error
Watch(opts api.ListOptions) (watch.Interface, error)
UpdateStatus(petSet *apps.PetSet) (*apps.PetSet, error)
}
// petSet implements PetSetNamespacer interface
type petSet struct {
r *AppsClient
ns string
}
// newPetSet returns a petSet
func newPetSet(c *AppsClient, namespace string) *petSet {
return &petSet{c, namespace}
}
// List returns a list of petSet that match the label and field selectors.
func (c *petSet) List(opts api.ListOptions) (result *apps.PetSetList, err error) {
result = &apps.PetSetList{}
err = c.r.Get().Namespace(c.ns).Resource("petsets").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular petSet.
func (c *petSet) Get(name string) (result *apps.PetSet, err error) {
result = &apps.PetSet{}
err = c.r.Get().Namespace(c.ns).Resource("petsets").Name(name).Do().Into(result)
return
}
// Create creates a new petSet.
func (c *petSet) Create(petSet *apps.PetSet) (result *apps.PetSet, err error) {
result = &apps.PetSet{}
err = c.r.Post().Namespace(c.ns).Resource("petsets").Body(petSet).Do().Into(result)
return
}
// Update updates an existing petSet.
func (c *petSet) Update(petSet *apps.PetSet) (result *apps.PetSet, err error) {
result = &apps.PetSet{}
err = c.r.Put().Namespace(c.ns).Resource("petsets").Name(petSet.Name).Body(petSet).Do().Into(result)
return
}
// Delete deletes a petSet, returns error if one occurs.
func (c *petSet) Delete(name string, options *api.DeleteOptions) (err error) {
return c.r.Delete().Namespace(c.ns).Resource("petsets").Name(name).Body(options).Do().Error()
}
// Watch returns a watch.Interface that watches the requested petSet.
func (c *petSet) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("petsets").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
// UpdateStatus takes the name of the petSet and the new status. Returns the server's representation of the petSet, and an error, if it occurs.
func (c *petSet) UpdateStatus(petSet *apps.PetSet) (result *apps.PetSet, err error) {
result = &apps.PetSet{}
err = c.r.Put().Namespace(c.ns).Resource("petsets").Name(petSet.Name).SubResource("status").Body(petSet).Do().Into(result)
return
}

View file

@ -1,100 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/policy"
"k8s.io/kubernetes/pkg/watch"
)
// PodDisruptionBudgetNamespacer has methods to work with PodDisruptionBudget resources in a namespace
type PodDisruptionBudgetNamespacer interface {
PodDisruptionBudgets(namespace string) PodDisruptionBudgetInterface
}
// PodDisruptionBudgetInterface exposes methods to work on PodDisruptionBudget resources.
type PodDisruptionBudgetInterface interface {
List(opts api.ListOptions) (*policy.PodDisruptionBudgetList, error)
Get(name string) (*policy.PodDisruptionBudget, error)
Create(podDisruptionBudget *policy.PodDisruptionBudget) (*policy.PodDisruptionBudget, error)
Update(podDisruptionBudget *policy.PodDisruptionBudget) (*policy.PodDisruptionBudget, error)
Delete(name string, options *api.DeleteOptions) error
Watch(opts api.ListOptions) (watch.Interface, error)
UpdateStatus(podDisruptionBudget *policy.PodDisruptionBudget) (*policy.PodDisruptionBudget, error)
}
// podDisruptionBudget implements PodDisruptionBudgetNamespacer interface
type podDisruptionBudget struct {
r *PolicyClient
ns string
}
// newPodDisruptionBudget returns a podDisruptionBudget
func newPodDisruptionBudget(c *PolicyClient, namespace string) *podDisruptionBudget {
return &podDisruptionBudget{c, namespace}
}
// List returns a list of podDisruptionBudget that match the label and field selectors.
func (c *podDisruptionBudget) List(opts api.ListOptions) (result *policy.PodDisruptionBudgetList, err error) {
result = &policy.PodDisruptionBudgetList{}
err = c.r.Get().Namespace(c.ns).Resource("poddisruptionbudgets").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular podDisruptionBudget.
func (c *podDisruptionBudget) Get(name string) (result *policy.PodDisruptionBudget, err error) {
result = &policy.PodDisruptionBudget{}
err = c.r.Get().Namespace(c.ns).Resource("poddisruptionbudgets").Name(name).Do().Into(result)
return
}
// Create creates a new podDisruptionBudget.
func (c *podDisruptionBudget) Create(podDisruptionBudget *policy.PodDisruptionBudget) (result *policy.PodDisruptionBudget, err error) {
result = &policy.PodDisruptionBudget{}
err = c.r.Post().Namespace(c.ns).Resource("poddisruptionbudgets").Body(podDisruptionBudget).Do().Into(result)
return
}
// Update updates an existing podDisruptionBudget.
func (c *podDisruptionBudget) Update(podDisruptionBudget *policy.PodDisruptionBudget) (result *policy.PodDisruptionBudget, err error) {
result = &policy.PodDisruptionBudget{}
err = c.r.Put().Namespace(c.ns).Resource("poddisruptionbudgets").Name(podDisruptionBudget.Name).Body(podDisruptionBudget).Do().Into(result)
return
}
// Delete deletes a podDisruptionBudget, returns error if one occurs.
func (c *podDisruptionBudget) Delete(name string, options *api.DeleteOptions) (err error) {
return c.r.Delete().Namespace(c.ns).Resource("poddisruptionbudgets").Name(name).Body(options).Do().Error()
}
// Watch returns a watch.Interface that watches the requested podDisruptionBudget.
func (c *podDisruptionBudget) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("poddisruptionbudgets").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
// UpdateStatus takes the name of the podDisruptionBudget and the new status. Returns the server's representation of the podDisruptionBudget, and an error, if it occurs.
func (c *podDisruptionBudget) UpdateStatus(podDisruptionBudget *policy.PodDisruptionBudget) (result *policy.PodDisruptionBudget, err error) {
result = &policy.PodDisruptionBudget{}
err = c.r.Put().Namespace(c.ns).Resource("poddisruptionbudgets").Name(podDisruptionBudget.Name).SubResource("status").Body(podDisruptionBudget).Do().Into(result)
return
}

View file

@ -1,94 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
// PodTemplatesNamespacer has methods to work with PodTemplate resources in a namespace
type PodTemplatesNamespacer interface {
PodTemplates(namespace string) PodTemplateInterface
}
// PodTemplateInterface has methods to work with PodTemplate resources.
type PodTemplateInterface interface {
List(opts api.ListOptions) (*api.PodTemplateList, error)
Get(name string) (*api.PodTemplate, error)
Delete(name string, options *api.DeleteOptions) error
Create(podTemplate *api.PodTemplate) (*api.PodTemplate, error)
Update(podTemplate *api.PodTemplate) (*api.PodTemplate, error)
Watch(opts api.ListOptions) (watch.Interface, error)
}
// podTemplates implements PodTemplatesNamespacer interface
type podTemplates struct {
r *Client
ns string
}
// newPodTemplates returns a podTemplates
func newPodTemplates(c *Client, namespace string) *podTemplates {
return &podTemplates{
r: c,
ns: namespace,
}
}
// List takes label and field selectors, and returns the list of podTemplates that match those selectors.
func (c *podTemplates) List(opts api.ListOptions) (result *api.PodTemplateList, err error) {
result = &api.PodTemplateList{}
err = c.r.Get().Namespace(c.ns).Resource("podTemplates").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get takes the name of the podTemplate, and returns the corresponding PodTemplate object, and an error if it occurs
func (c *podTemplates) Get(name string) (result *api.PodTemplate, err error) {
result = &api.PodTemplate{}
err = c.r.Get().Namespace(c.ns).Resource("podTemplates").Name(name).Do().Into(result)
return
}
// Delete takes the name of the podTemplate, and returns an error if one occurs
func (c *podTemplates) Delete(name string, options *api.DeleteOptions) error {
return c.r.Delete().Namespace(c.ns).Resource("podTemplates").Name(name).Body(options).Do().Error()
}
// Create takes the representation of a podTemplate. Returns the server's representation of the podTemplate, and an error, if it occurs.
func (c *podTemplates) Create(podTemplate *api.PodTemplate) (result *api.PodTemplate, err error) {
result = &api.PodTemplate{}
err = c.r.Post().Namespace(c.ns).Resource("podTemplates").Body(podTemplate).Do().Into(result)
return
}
// Update takes the representation of a podTemplate to update. Returns the server's representation of the podTemplate, and an error, if it occurs.
func (c *podTemplates) Update(podTemplate *api.PodTemplate) (result *api.PodTemplate, err error) {
result = &api.PodTemplate{}
err = c.r.Put().Namespace(c.ns).Resource("podTemplates").Name(podTemplate.Name).Body(podTemplate).Do().Into(result)
return
}
// Watch returns a watch.Interface that watches the requested podTemplates.
func (c *podTemplates) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("podTemplates").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,115 +0,0 @@
/*
Copyright 2014 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/watch"
)
// PodsNamespacer has methods to work with Pod resources in a namespace
type PodsNamespacer interface {
Pods(namespace string) PodInterface
}
// PodInterface has methods to work with Pod resources.
type PodInterface interface {
List(opts api.ListOptions) (*api.PodList, error)
Get(name string) (*api.Pod, error)
Delete(name string, options *api.DeleteOptions) error
Create(pod *api.Pod) (*api.Pod, error)
Update(pod *api.Pod) (*api.Pod, error)
Watch(opts api.ListOptions) (watch.Interface, error)
Bind(binding *api.Binding) error
UpdateStatus(pod *api.Pod) (*api.Pod, error)
GetLogs(name string, opts *api.PodLogOptions) *restclient.Request
}
// pods implements PodsNamespacer interface
type pods struct {
r *Client
ns string
}
// newPods returns a pods
func newPods(c *Client, namespace string) *pods {
return &pods{
r: c,
ns: namespace,
}
}
// List takes label and field selectors, and returns the list of pods that match those selectors.
func (c *pods) List(opts api.ListOptions) (result *api.PodList, err error) {
result = &api.PodList{}
err = c.r.Get().Namespace(c.ns).Resource("pods").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get takes the name of the pod, and returns the corresponding Pod object, and an error if it occurs
func (c *pods) Get(name string) (result *api.Pod, err error) {
result = &api.Pod{}
err = c.r.Get().Namespace(c.ns).Resource("pods").Name(name).Do().Into(result)
return
}
// Delete takes the name of the pod, and returns an error if one occurs
func (c *pods) Delete(name string, options *api.DeleteOptions) error {
return c.r.Delete().Namespace(c.ns).Resource("pods").Name(name).Body(options).Do().Error()
}
// Create takes the representation of a pod. Returns the server's representation of the pod, and an error, if it occurs.
func (c *pods) Create(pod *api.Pod) (result *api.Pod, err error) {
result = &api.Pod{}
err = c.r.Post().Namespace(c.ns).Resource("pods").Body(pod).Do().Into(result)
return
}
// Update takes the representation of a pod to update. Returns the server's representation of the pod, and an error, if it occurs.
func (c *pods) Update(pod *api.Pod) (result *api.Pod, err error) {
result = &api.Pod{}
err = c.r.Put().Namespace(c.ns).Resource("pods").Name(pod.Name).Body(pod).Do().Into(result)
return
}
// Watch returns a watch.Interface that watches the requested pods.
func (c *pods) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("pods").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
// Bind applies the provided binding to the named pod in the current namespace (binding.Namespace is ignored).
func (c *pods) Bind(binding *api.Binding) error {
return c.r.Post().Namespace(c.ns).Resource("pods").Name(binding.Name).SubResource("binding").Body(binding).Do().Error()
}
// UpdateStatus takes the name of the pod and the new status. Returns the server's representation of the pod, and an error, if it occurs.
func (c *pods) UpdateStatus(pod *api.Pod) (result *api.Pod, err error) {
result = &api.Pod{}
err = c.r.Put().Namespace(c.ns).Resource("pods").Name(pod.Name).SubResource("status").Body(pod).Do().Into(result)
return
}
// Get constructs a request for getting the logs for a pod
func (c *pods) GetLogs(name string, opts *api.PodLogOptions) *restclient.Request {
return c.r.Get().Namespace(c.ns).Name(name).Resource("pods").SubResource("log").VersionedParams(opts, api.ParameterCodec)
}

View file

@ -1,111 +0,0 @@
/*
Copyright 2014 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/watch"
)
type PodSecurityPoliciesInterface interface {
PodSecurityPolicies() PodSecurityPolicyInterface
}
type PodSecurityPolicyInterface interface {
Get(name string) (result *extensions.PodSecurityPolicy, err error)
Create(psp *extensions.PodSecurityPolicy) (*extensions.PodSecurityPolicy, error)
List(opts api.ListOptions) (*extensions.PodSecurityPolicyList, error)
Delete(name string) error
Update(*extensions.PodSecurityPolicy) (*extensions.PodSecurityPolicy, error)
Watch(opts api.ListOptions) (watch.Interface, error)
}
// podSecurityPolicy implements PodSecurityPolicyInterface
type podSecurityPolicy struct {
client *ExtensionsClient
}
// newPodSecurityPolicy returns a podSecurityPolicy object.
func newPodSecurityPolicy(c *ExtensionsClient) *podSecurityPolicy {
return &podSecurityPolicy{c}
}
func (s *podSecurityPolicy) Create(psp *extensions.PodSecurityPolicy) (*extensions.PodSecurityPolicy, error) {
result := &extensions.PodSecurityPolicy{}
err := s.client.Post().
Resource("podsecuritypolicies").
Body(psp).
Do().
Into(result)
return result, err
}
// List returns a list of PodSecurityPolicies matching the selectors.
func (s *podSecurityPolicy) List(opts api.ListOptions) (*extensions.PodSecurityPolicyList, error) {
result := &extensions.PodSecurityPolicyList{}
err := s.client.Get().
Resource("podsecuritypolicies").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return result, err
}
// Get returns the given PodSecurityPolicy, or an error.
func (s *podSecurityPolicy) Get(name string) (*extensions.PodSecurityPolicy, error) {
result := &extensions.PodSecurityPolicy{}
err := s.client.Get().
Resource("podsecuritypolicies").
Name(name).
Do().
Into(result)
return result, err
}
// Watch starts watching for PodSecurityPolicies matching the given selectors.
func (s *podSecurityPolicy) Watch(opts api.ListOptions) (watch.Interface, error) {
return s.client.Get().
Prefix("watch").
Resource("podsecuritypolicies").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
func (s *podSecurityPolicy) Delete(name string) error {
return s.client.Delete().
Resource("podsecuritypolicies").
Name(name).
Do().
Error()
}
func (s *podSecurityPolicy) Update(psp *extensions.PodSecurityPolicy) (result *extensions.PodSecurityPolicy, err error) {
result = &extensions.PodSecurityPolicy{}
err = s.client.Put().
Resource("podsecuritypolicies").
Name(psp.Name).
Body(psp).
Do().
Into(result)
return
}

View file

@ -1,55 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/apis/policy"
"k8s.io/kubernetes/pkg/client/restclient"
)
type PolicyInterface interface {
PodDisruptionBudgetNamespacer
}
// PolicyClient is used to interact with Kubernetes batch features.
type PolicyClient struct {
*restclient.RESTClient
}
func (c *PolicyClient) PodDisruptionBudgets(namespace string) PodDisruptionBudgetInterface {
return newPodDisruptionBudget(c, namespace)
}
func NewPolicy(c *restclient.Config) (*PolicyClient, error) {
config := *c
if err := setGroupDefaults(policy.GroupName, &config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &PolicyClient{client}, nil
}
func NewPolicyOrDie(c *restclient.Config) *PolicyClient {
client, err := NewPolicy(c)
if err != nil {
panic(err)
}
return client
}

View file

@ -1,73 +0,0 @@
/*
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 (
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/client/restclient"
)
// Interface holds the methods for clients of Kubernetes to allow mock testing.
type RbacInterface interface {
RoleBindingsNamespacer
RolesNamespacer
ClusterRoleBindings
ClusterRoles
}
type RbacClient struct {
*restclient.RESTClient
}
func (c *RbacClient) RoleBindings(namespace string) RoleBindingInterface {
return newRoleBindings(c, namespace)
}
func (c *RbacClient) Roles(namespace string) RoleInterface {
return newRoles(c, namespace)
}
func (c *RbacClient) ClusterRoleBindings() ClusterRoleBindingInterface {
return newClusterRoleBindings(c)
}
func (c *RbacClient) ClusterRoles() ClusterRoleInterface {
return newClusterRoles(c)
}
// NewRbac creates a new RbacClient for the given config.
func NewRbac(c *restclient.Config) (*RbacClient, error) {
config := *c
if err := setGroupDefaults(rbac.GroupName, &config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &RbacClient{client}, nil
}
// NewRbacOrDie creates a new RbacClient for the given config and
// panics if there is an error in the config.
func NewRbacOrDie(c *restclient.Config) *RbacClient {
client, err := NewRbac(c)
if err != nil {
panic(err)
}
return client
}

View file

@ -1,100 +0,0 @@
/*
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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/watch"
)
// ReplicaSetsNamespacer has methods to work with ReplicaSet resources in a namespace
type ReplicaSetsNamespacer interface {
ReplicaSets(namespace string) ReplicaSetInterface
}
// ReplicaSetInterface has methods to work with ReplicaSet resources.
type ReplicaSetInterface interface {
List(opts api.ListOptions) (*extensions.ReplicaSetList, error)
Get(name string) (*extensions.ReplicaSet, error)
Create(ctrl *extensions.ReplicaSet) (*extensions.ReplicaSet, error)
Update(ctrl *extensions.ReplicaSet) (*extensions.ReplicaSet, error)
UpdateStatus(ctrl *extensions.ReplicaSet) (*extensions.ReplicaSet, error)
Delete(name string, options *api.DeleteOptions) error
Watch(opts api.ListOptions) (watch.Interface, error)
}
// replicaSets implements ReplicaSetsNamespacer interface
type replicaSets struct {
client *ExtensionsClient
ns string
}
// newReplicaSets returns a ReplicaSetClient
func newReplicaSets(c *ExtensionsClient, namespace string) *replicaSets {
return &replicaSets{c, namespace}
}
// List takes a selector, and returns the list of ReplicaSets that match that selector.
func (c *replicaSets) List(opts api.ListOptions) (result *extensions.ReplicaSetList, err error) {
result = &extensions.ReplicaSetList{}
err = c.client.Get().Namespace(c.ns).Resource("replicasets").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular ReplicaSet.
func (c *replicaSets) Get(name string) (result *extensions.ReplicaSet, err error) {
result = &extensions.ReplicaSet{}
err = c.client.Get().Namespace(c.ns).Resource("replicasets").Name(name).Do().Into(result)
return
}
// Create creates a new ReplicaSet.
func (c *replicaSets) Create(rs *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) {
result = &extensions.ReplicaSet{}
err = c.client.Post().Namespace(c.ns).Resource("replicasets").Body(rs).Do().Into(result)
return
}
// Update updates an existing ReplicaSet.
func (c *replicaSets) Update(rs *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) {
result = &extensions.ReplicaSet{}
err = c.client.Put().Namespace(c.ns).Resource("replicasets").Name(rs.Name).Body(rs).Do().Into(result)
return
}
// UpdateStatus updates an existing ReplicaSet status
func (c *replicaSets) UpdateStatus(rs *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) {
result = &extensions.ReplicaSet{}
err = c.client.Put().Namespace(c.ns).Resource("replicasets").Name(rs.Name).SubResource("status").Body(rs).Do().Into(result)
return
}
// Delete deletes an existing ReplicaSet.
func (c *replicaSets) Delete(name string, options *api.DeleteOptions) (err error) {
return c.client.Delete().Namespace(c.ns).Resource("replicasets").Name(name).Body(options).Do().Error()
}
// Watch returns a watch.Interface that watches the requested ReplicaSets.
func (c *replicaSets) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("replicasets").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,99 +0,0 @@
/*
Copyright 2014 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
// ReplicationControllersNamespacer has methods to work with ReplicationController resources in a namespace
type ReplicationControllersNamespacer interface {
ReplicationControllers(namespace string) ReplicationControllerInterface
}
// ReplicationControllerInterface has methods to work with ReplicationController resources.
type ReplicationControllerInterface interface {
List(opts api.ListOptions) (*api.ReplicationControllerList, error)
Get(name string) (*api.ReplicationController, error)
Create(ctrl *api.ReplicationController) (*api.ReplicationController, error)
Update(ctrl *api.ReplicationController) (*api.ReplicationController, error)
UpdateStatus(ctrl *api.ReplicationController) (*api.ReplicationController, error)
Delete(name string, options *api.DeleteOptions) error
Watch(opts api.ListOptions) (watch.Interface, error)
}
// replicationControllers implements ReplicationControllersNamespacer interface
type replicationControllers struct {
r *Client
ns string
}
// newReplicationControllers returns a PodsClient
func newReplicationControllers(c *Client, namespace string) *replicationControllers {
return &replicationControllers{c, namespace}
}
// List takes a selector, and returns the list of replication controllers that match that selector.
func (c *replicationControllers) List(opts api.ListOptions) (result *api.ReplicationControllerList, err error) {
result = &api.ReplicationControllerList{}
err = c.r.Get().Namespace(c.ns).Resource("replicationControllers").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular replication controller.
func (c *replicationControllers) Get(name string) (result *api.ReplicationController, err error) {
result = &api.ReplicationController{}
err = c.r.Get().Namespace(c.ns).Resource("replicationControllers").Name(name).Do().Into(result)
return
}
// Create creates a new replication controller.
func (c *replicationControllers) Create(controller *api.ReplicationController) (result *api.ReplicationController, err error) {
result = &api.ReplicationController{}
err = c.r.Post().Namespace(c.ns).Resource("replicationControllers").Body(controller).Do().Into(result)
return
}
// Update updates an existing replication controller.
func (c *replicationControllers) Update(controller *api.ReplicationController) (result *api.ReplicationController, err error) {
result = &api.ReplicationController{}
err = c.r.Put().Namespace(c.ns).Resource("replicationControllers").Name(controller.Name).Body(controller).Do().Into(result)
return
}
// UpdateStatus updates an existing replication controller status
func (c *replicationControllers) UpdateStatus(controller *api.ReplicationController) (result *api.ReplicationController, err error) {
result = &api.ReplicationController{}
err = c.r.Put().Namespace(c.ns).Resource("replicationControllers").Name(controller.Name).SubResource("status").Body(controller).Do().Into(result)
return
}
// Delete deletes an existing replication controller.
func (c *replicationControllers) Delete(name string, options *api.DeleteOptions) error {
return c.r.Delete().Namespace(c.ns).Resource("replicationControllers").Name(name).Body(options).Do().Error()
}
// Watch returns a watch.Interface that watches the requested controllers.
func (c *replicationControllers) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("replicationControllers").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,102 +0,0 @@
/*
Copyright 2014 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
// ResourceQuotasNamespacer has methods to work with ResourceQuota resources in a namespace
type ResourceQuotasNamespacer interface {
ResourceQuotas(namespace string) ResourceQuotaInterface
}
// ResourceQuotaInterface has methods to work with ResourceQuota resources.
type ResourceQuotaInterface interface {
List(opts api.ListOptions) (*api.ResourceQuotaList, error)
Get(name string) (*api.ResourceQuota, error)
Delete(name string) error
Create(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)
Update(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)
UpdateStatus(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)
Watch(opts api.ListOptions) (watch.Interface, error)
}
// resourceQuotas implements ResourceQuotasNamespacer interface
type resourceQuotas struct {
r *Client
ns string
}
// newResourceQuotas returns a resourceQuotas
func newResourceQuotas(c *Client, namespace string) *resourceQuotas {
return &resourceQuotas{
r: c,
ns: namespace,
}
}
// List takes a selector, and returns the list of resourceQuotas that match that selector.
func (c *resourceQuotas) List(opts api.ListOptions) (result *api.ResourceQuotaList, err error) {
result = &api.ResourceQuotaList{}
err = c.r.Get().Namespace(c.ns).Resource("resourceQuotas").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get takes the name of the resourceQuota, and returns the corresponding ResourceQuota object, and an error if it occurs
func (c *resourceQuotas) Get(name string) (result *api.ResourceQuota, err error) {
result = &api.ResourceQuota{}
err = c.r.Get().Namespace(c.ns).Resource("resourceQuotas").Name(name).Do().Into(result)
return
}
// Delete takes the name of the resourceQuota, and returns an error if one occurs
func (c *resourceQuotas) Delete(name string) error {
return c.r.Delete().Namespace(c.ns).Resource("resourceQuotas").Name(name).Do().Error()
}
// Create takes the representation of a resourceQuota. Returns the server's representation of the resourceQuota, and an error, if it occurs.
func (c *resourceQuotas) Create(resourceQuota *api.ResourceQuota) (result *api.ResourceQuota, err error) {
result = &api.ResourceQuota{}
err = c.r.Post().Namespace(c.ns).Resource("resourceQuotas").Body(resourceQuota).Do().Into(result)
return
}
// Update takes the representation of a resourceQuota to update spec. Returns the server's representation of the resourceQuota, and an error, if it occurs.
func (c *resourceQuotas) Update(resourceQuota *api.ResourceQuota) (result *api.ResourceQuota, err error) {
result = &api.ResourceQuota{}
err = c.r.Put().Namespace(c.ns).Resource("resourceQuotas").Name(resourceQuota.Name).Body(resourceQuota).Do().Into(result)
return
}
// Status takes the representation of a resourceQuota to update status. Returns the server's representation of the resourceQuota, and an error, if it occurs.
func (c *resourceQuotas) UpdateStatus(resourceQuota *api.ResourceQuota) (result *api.ResourceQuota, err error) {
result = &api.ResourceQuota{}
err = c.r.Put().Namespace(c.ns).Resource("resourceQuotas").Name(resourceQuota.Name).SubResource("status").Body(resourceQuota).Do().Into(result)
return
}
// Watch returns a watch.Interface that watches the requested resource
func (c *resourceQuotas) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("resourceQuotas").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,95 +0,0 @@
/*
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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/watch"
)
// RoleBindingsNamespacer has methods to work with RoleBinding resources in a namespace
type RoleBindingsNamespacer interface {
RoleBindings(namespace string) RoleBindingInterface
}
// RoleBindingInterface has methods to work with RoleBinding resources.
type RoleBindingInterface interface {
List(opts api.ListOptions) (*rbac.RoleBindingList, error)
Get(name string) (*rbac.RoleBinding, error)
Delete(name string, options *api.DeleteOptions) error
Create(roleBinding *rbac.RoleBinding) (*rbac.RoleBinding, error)
Update(roleBinding *rbac.RoleBinding) (*rbac.RoleBinding, error)
Watch(opts api.ListOptions) (watch.Interface, error)
}
// roleBindings implements RoleBindingsNamespacer interface
type roleBindings struct {
client *RbacClient
ns string
}
// newRoleBindings returns a roleBindings
func newRoleBindings(c *RbacClient, namespace string) *roleBindings {
return &roleBindings{
client: c,
ns: namespace,
}
}
// List takes label and field selectors, and returns the list of roleBindings that match those selectors.
func (c *roleBindings) List(opts api.ListOptions) (result *rbac.RoleBindingList, err error) {
result = &rbac.RoleBindingList{}
err = c.client.Get().Namespace(c.ns).Resource("rolebindings").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get takes the name of the roleBinding, and returns the corresponding RoleBinding object, and an error if it occurs
func (c *roleBindings) Get(name string) (result *rbac.RoleBinding, err error) {
result = &rbac.RoleBinding{}
err = c.client.Get().Namespace(c.ns).Resource("rolebindings").Name(name).Do().Into(result)
return
}
// Delete takes the name of the roleBinding and deletes it. Returns an error if one occurs.
func (c *roleBindings) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().Namespace(c.ns).Resource("rolebindings").Name(name).Body(options).Do().Error()
}
// Create takes the representation of a roleBinding and creates it. Returns the server's representation of the roleBinding, and an error, if it occurs.
func (c *roleBindings) Create(roleBinding *rbac.RoleBinding) (result *rbac.RoleBinding, err error) {
result = &rbac.RoleBinding{}
err = c.client.Post().Namespace(c.ns).Resource("rolebindings").Body(roleBinding).Do().Into(result)
return
}
// Update takes the representation of a roleBinding and updates it. Returns the server's representation of the roleBinding, and an error, if it occurs.
func (c *roleBindings) Update(roleBinding *rbac.RoleBinding) (result *rbac.RoleBinding, err error) {
result = &rbac.RoleBinding{}
err = c.client.Put().Namespace(c.ns).Resource("rolebindings").Name(roleBinding.Name).Body(roleBinding).Do().Into(result)
return
}
// Watch returns a watch.Interface that watches the requested roleBindings.
func (c *roleBindings) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("rolebindings").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,95 +0,0 @@
/*
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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/watch"
)
// RolesNamespacer has methods to work with Role resources in a namespace
type RolesNamespacer interface {
Roles(namespace string) RoleInterface
}
// RoleInterface has methods to work with Role resources.
type RoleInterface interface {
List(opts api.ListOptions) (*rbac.RoleList, error)
Get(name string) (*rbac.Role, error)
Delete(name string, options *api.DeleteOptions) error
Create(role *rbac.Role) (*rbac.Role, error)
Update(role *rbac.Role) (*rbac.Role, error)
Watch(opts api.ListOptions) (watch.Interface, error)
}
// roles implements RolesNamespacer interface
type roles struct {
client *RbacClient
ns string
}
// newRoles returns a roles
func newRoles(c *RbacClient, namespace string) *roles {
return &roles{
client: c,
ns: namespace,
}
}
// List takes label and field selectors, and returns the list of roles that match those selectors.
func (c *roles) List(opts api.ListOptions) (result *rbac.RoleList, err error) {
result = &rbac.RoleList{}
err = c.client.Get().Namespace(c.ns).Resource("roles").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get takes the name of the role, and returns the corresponding Role object, and an error if it occurs
func (c *roles) Get(name string) (result *rbac.Role, err error) {
result = &rbac.Role{}
err = c.client.Get().Namespace(c.ns).Resource("roles").Name(name).Do().Into(result)
return
}
// Delete takes the name of the role and deletes it. Returns an error if one occurs.
func (c *roles) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().Namespace(c.ns).Resource("roles").Name(name).Body(options).Do().Error()
}
// Create takes the representation of a role and creates it. Returns the server's representation of the role, and an error, if it occurs.
func (c *roles) Create(role *rbac.Role) (result *rbac.Role, err error) {
result = &rbac.Role{}
err = c.client.Post().Namespace(c.ns).Resource("roles").Body(role).Do().Into(result)
return
}
// Update takes the representation of a role and updates it. Returns the server's representation of the role, and an error, if it occurs.
func (c *roles) Update(role *rbac.Role) (result *rbac.Role, err error) {
result = &rbac.Role{}
err = c.client.Put().Namespace(c.ns).Resource("roles").Name(role.Name).Body(role).Do().Into(result)
return
}
// Watch returns a watch.Interface that watches the requested roles.
func (c *roles) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("roles").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,77 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/extensions"
)
type ScaleNamespacer interface {
Scales(namespace string) ScaleInterface
}
// ScaleInterface has methods to work with Scale (sub)resources.
type ScaleInterface interface {
Get(string, string) (*extensions.Scale, error)
Update(string, *extensions.Scale) (*extensions.Scale, error)
}
// horizontalPodAutoscalers implements HorizontalPodAutoscalersNamespacer interface
type scales struct {
client *ExtensionsClient
ns string
}
// newHorizontalPodAutoscalers returns a horizontalPodAutoscalers
func newScales(c *ExtensionsClient, namespace string) *scales {
return &scales{
client: c,
ns: namespace,
}
}
// Get takes the reference to scale subresource and returns the subresource or error, if one occurs.
func (c *scales) Get(kind string, name string) (result *extensions.Scale, err error) {
result = &extensions.Scale{}
// TODO this method needs to take a proper unambiguous kind
fullyQualifiedKind := unversioned.GroupVersionKind{Kind: kind}
resource, _ := meta.KindToResource(fullyQualifiedKind)
err = c.client.Get().Namespace(c.ns).Resource(resource.Resource).Name(name).SubResource("scale").Do().Into(result)
return
}
func (c *scales) Update(kind string, scale *extensions.Scale) (result *extensions.Scale, err error) {
result = &extensions.Scale{}
// TODO this method needs to take a proper unambiguous kind
fullyQualifiedKind := unversioned.GroupVersionKind{Kind: kind}
resource, _ := meta.KindToResource(fullyQualifiedKind)
err = c.client.Put().
Namespace(scale.Namespace).
Resource(resource.Resource).
Name(scale.Name).
SubResource("scale").
Body(scale).
Do().
Into(result)
return
}

View file

@ -1,103 +0,0 @@
/*
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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/watch"
)
// ScheduledJobsNamespacer has methods to work with ScheduledJob resources in a namespace
type ScheduledJobsNamespacer interface {
ScheduledJobs(namespace string) ScheduledJobInterface
}
// ScheduledJobInterface exposes methods to work on ScheduledJob resources.
type ScheduledJobInterface interface {
List(opts api.ListOptions) (*batch.ScheduledJobList, error)
Get(name string) (*batch.ScheduledJob, error)
Create(scheduledJob *batch.ScheduledJob) (*batch.ScheduledJob, error)
Update(scheduledJob *batch.ScheduledJob) (*batch.ScheduledJob, error)
Delete(name string, options *api.DeleteOptions) error
Watch(opts api.ListOptions) (watch.Interface, error)
UpdateStatus(scheduledJob *batch.ScheduledJob) (*batch.ScheduledJob, error)
}
// scheduledJobs implements ScheduledJobsNamespacer interface
type scheduledJobs struct {
r *BatchClient
ns string
}
// newScheduledJobs returns a scheduledJobs
func newScheduledJobs(c *BatchClient, namespace string) *scheduledJobs {
return &scheduledJobs{c, namespace}
}
// Ensure statically that scheduledJobs implements ScheduledJobInterface.
var _ ScheduledJobInterface = &scheduledJobs{}
// List returns a list of scheduled jobs that match the label and field selectors.
func (c *scheduledJobs) List(opts api.ListOptions) (result *batch.ScheduledJobList, err error) {
result = &batch.ScheduledJobList{}
err = c.r.Get().Namespace(c.ns).Resource("scheduledjobs").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular scheduled job.
func (c *scheduledJobs) Get(name string) (result *batch.ScheduledJob, err error) {
result = &batch.ScheduledJob{}
err = c.r.Get().Namespace(c.ns).Resource("scheduledjobs").Name(name).Do().Into(result)
return
}
// Create creates a new scheduled job.
func (c *scheduledJobs) Create(job *batch.ScheduledJob) (result *batch.ScheduledJob, err error) {
result = &batch.ScheduledJob{}
err = c.r.Post().Namespace(c.ns).Resource("scheduledjobs").Body(job).Do().Into(result)
return
}
// Update updates an existing scheduled job.
func (c *scheduledJobs) Update(job *batch.ScheduledJob) (result *batch.ScheduledJob, err error) {
result = &batch.ScheduledJob{}
err = c.r.Put().Namespace(c.ns).Resource("scheduledjobs").Name(job.Name).Body(job).Do().Into(result)
return
}
// Delete deletes a scheduled job, returns error if one occurs.
func (c *scheduledJobs) Delete(name string, options *api.DeleteOptions) (err error) {
return c.r.Delete().Namespace(c.ns).Resource("scheduledjobs").Name(name).Body(options).Do().Error()
}
// Watch returns a watch.Interface that watches the requested scheduled jobs.
func (c *scheduledJobs) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("scheduledjobs").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
// UpdateStatus takes the name of the scheduled job and the new status. Returns the server's representation of the scheduled job, and an error, if it occurs.
func (c *scheduledJobs) UpdateStatus(job *batch.ScheduledJob) (result *batch.ScheduledJob, err error) {
result = &batch.ScheduledJob{}
err = c.r.Put().Namespace(c.ns).Resource("scheduledjobs").Name(job.Name).SubResource("status").Body(job).Do().Into(result)
return
}

View file

@ -1,120 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
type SecretsNamespacer interface {
Secrets(namespace string) SecretsInterface
}
type SecretsInterface interface {
Create(secret *api.Secret) (*api.Secret, error)
Update(secret *api.Secret) (*api.Secret, error)
Delete(name string) error
List(opts api.ListOptions) (*api.SecretList, error)
Get(name string) (*api.Secret, error)
Watch(opts api.ListOptions) (watch.Interface, error)
}
// events implements Secrets interface
type secrets struct {
client *Client
namespace string
}
// newSecrets returns a new secrets object.
func newSecrets(c *Client, ns string) *secrets {
return &secrets{
client: c,
namespace: ns,
}
}
func (s *secrets) Create(secret *api.Secret) (*api.Secret, error) {
result := &api.Secret{}
err := s.client.Post().
Namespace(s.namespace).
Resource("secrets").
Body(secret).
Do().
Into(result)
return result, err
}
// List returns a list of secrets matching the selectors.
func (s *secrets) List(opts api.ListOptions) (*api.SecretList, error) {
result := &api.SecretList{}
err := s.client.Get().
Namespace(s.namespace).
Resource("secrets").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return result, err
}
// Get returns the given secret, or an error.
func (s *secrets) Get(name string) (*api.Secret, error) {
result := &api.Secret{}
err := s.client.Get().
Namespace(s.namespace).
Resource("secrets").
Name(name).
Do().
Into(result)
return result, err
}
// Watch starts watching for secrets matching the given selectors.
func (s *secrets) Watch(opts api.ListOptions) (watch.Interface, error) {
return s.client.Get().
Prefix("watch").
Namespace(s.namespace).
Resource("secrets").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
func (s *secrets) Delete(name string) error {
return s.client.Delete().
Namespace(s.namespace).
Resource("secrets").
Name(name).
Do().
Error()
}
func (s *secrets) Update(secret *api.Secret) (result *api.Secret, err error) {
result = &api.Secret{}
err = s.client.Put().
Namespace(s.namespace).
Resource("secrets").
Name(secret.Name).
Body(secret).
Do().
Into(result)
return
}

View file

@ -1,120 +0,0 @@
/*
Copyright 2014 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
type ServiceAccountsNamespacer interface {
ServiceAccounts(namespace string) ServiceAccountsInterface
}
type ServiceAccountsInterface interface {
Create(serviceAccount *api.ServiceAccount) (*api.ServiceAccount, error)
Update(serviceAccount *api.ServiceAccount) (*api.ServiceAccount, error)
Delete(name string) error
List(opts api.ListOptions) (*api.ServiceAccountList, error)
Get(name string) (*api.ServiceAccount, error)
Watch(opts api.ListOptions) (watch.Interface, error)
}
// serviceAccounts implements ServiceAccounts interface
type serviceAccounts struct {
client *Client
namespace string
}
// newServiceAccounts returns a new serviceAccounts object.
func newServiceAccounts(c *Client, ns string) ServiceAccountsInterface {
return &serviceAccounts{
client: c,
namespace: ns,
}
}
func (s *serviceAccounts) Create(serviceAccount *api.ServiceAccount) (*api.ServiceAccount, error) {
result := &api.ServiceAccount{}
err := s.client.Post().
Namespace(s.namespace).
Resource("serviceAccounts").
Body(serviceAccount).
Do().
Into(result)
return result, err
}
// List returns a list of serviceAccounts matching the selectors.
func (s *serviceAccounts) List(opts api.ListOptions) (*api.ServiceAccountList, error) {
result := &api.ServiceAccountList{}
err := s.client.Get().
Namespace(s.namespace).
Resource("serviceAccounts").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return result, err
}
// Get returns the given serviceAccount, or an error.
func (s *serviceAccounts) Get(name string) (*api.ServiceAccount, error) {
result := &api.ServiceAccount{}
err := s.client.Get().
Namespace(s.namespace).
Resource("serviceAccounts").
Name(name).
Do().
Into(result)
return result, err
}
// Watch starts watching for serviceAccounts matching the given selectors.
func (s *serviceAccounts) Watch(opts api.ListOptions) (watch.Interface, error) {
return s.client.Get().
Prefix("watch").
Namespace(s.namespace).
Resource("serviceAccounts").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
func (s *serviceAccounts) Delete(name string) error {
return s.client.Delete().
Namespace(s.namespace).
Resource("serviceAccounts").
Name(name).
Do().
Error()
}
func (s *serviceAccounts) Update(serviceAccount *api.ServiceAccount) (result *api.ServiceAccount, err error) {
result = &api.ServiceAccount{}
err = s.client.Put().
Namespace(s.namespace).
Resource("serviceAccounts").
Name(serviceAccount.Name).
Body(serviceAccount).
Do().
Into(result)
return
}

View file

@ -1,121 +0,0 @@
/*
Copyright 2014 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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/util/net"
"k8s.io/kubernetes/pkg/watch"
)
// ServicesNamespacer has methods to work with Service resources in a namespace
type ServicesNamespacer interface {
Services(namespace string) ServiceInterface
}
// ServiceInterface has methods to work with Service resources.
type ServiceInterface interface {
List(opts api.ListOptions) (*api.ServiceList, error)
Get(name string) (*api.Service, error)
Create(srv *api.Service) (*api.Service, error)
Update(srv *api.Service) (*api.Service, error)
UpdateStatus(srv *api.Service) (*api.Service, error)
Delete(name string) error
Watch(opts api.ListOptions) (watch.Interface, error)
ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper
}
// services implements ServicesNamespacer interface
type services struct {
r *Client
ns string
}
// newServices returns a services
func newServices(c *Client, namespace string) *services {
return &services{c, namespace}
}
// List takes a selector, and returns the list of services that match that selector
func (c *services) List(opts api.ListOptions) (result *api.ServiceList, err error) {
result = &api.ServiceList{}
err = c.r.Get().
Namespace(c.ns).
Resource("services").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return
}
// Get returns information about a particular service.
func (c *services) Get(name string) (result *api.Service, err error) {
result = &api.Service{}
err = c.r.Get().Namespace(c.ns).Resource("services").Name(name).Do().Into(result)
return
}
// Create creates a new service.
func (c *services) Create(svc *api.Service) (result *api.Service, err error) {
result = &api.Service{}
err = c.r.Post().Namespace(c.ns).Resource("services").Body(svc).Do().Into(result)
return
}
// Update updates an existing service.
func (c *services) Update(svc *api.Service) (result *api.Service, err error) {
result = &api.Service{}
err = c.r.Put().Namespace(c.ns).Resource("services").Name(svc.Name).Body(svc).Do().Into(result)
return
}
// UpdateStatus takes a Service object with the new status and applies it as an update to the existing Service.
func (c *services) UpdateStatus(service *api.Service) (result *api.Service, err error) {
result = &api.Service{}
err = c.r.Put().Namespace(c.ns).Resource("services").Name(service.Name).SubResource("status").Body(service).Do().Into(result)
return
}
// Delete deletes an existing service.
func (c *services) Delete(name string) error {
return c.r.Delete().Namespace(c.ns).Resource("services").Name(name).Do().Error()
}
// Watch returns a watch.Interface that watches the requested services.
func (c *services) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("services").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
// ProxyGet returns a response of the service by calling it through the proxy.
func (c *services) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper {
request := c.r.Get().
Namespace(c.ns).
Resource("services").
SubResource("proxy").
Name(net.JoinSchemeNamePort(scheme, name, port)).
Suffix(path)
for k, v := range params {
request = request.Param(k, v)
}
return request
}

View file

@ -1,77 +0,0 @@
/*
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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apimachinery/registered"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/client/restclient"
)
type StorageInterface interface {
StorageClassesInterface
}
// StorageClient is used to interact with Kubernetes storage features.
type StorageClient struct {
*restclient.RESTClient
}
func (c *StorageClient) StorageClasses() StorageClassInterface {
return newStorageClasses(c)
}
func NewStorage(c *restclient.Config) (*StorageClient, error) {
config := *c
if err := setStorageDefaults(&config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &StorageClient{client}, nil
}
func NewStorageOrDie(c *restclient.Config) *StorageClient {
client, err := NewStorage(c)
if err != nil {
panic(err)
}
return client
}
func setStorageDefaults(config *restclient.Config) error {
// if storage group is not registered, return an error
g, err := registered.Group(storage.GroupName)
if err != nil {
return err
}
config.APIPath = defaultAPIPath
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
return nil
}

View file

@ -1,87 +0,0 @@
/*
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 (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/watch"
)
type StorageClassesInterface interface {
StorageClasses() StorageClassInterface
}
// StorageClassInterface has methods to work with StorageClass resources.
type StorageClassInterface interface {
List(opts api.ListOptions) (*storage.StorageClassList, error)
Get(name string) (*storage.StorageClass, error)
Create(storageClass *storage.StorageClass) (*storage.StorageClass, error)
Update(storageClass *storage.StorageClass) (*storage.StorageClass, error)
Delete(name string) error
Watch(opts api.ListOptions) (watch.Interface, error)
}
// storageClasses implements StorageClassInterface
type storageClasses struct {
client *StorageClient
}
func newStorageClasses(c *StorageClient) *storageClasses {
return &storageClasses{c}
}
func (c *storageClasses) List(opts api.ListOptions) (result *storage.StorageClassList, err error) {
result = &storage.StorageClassList{}
err = c.client.Get().
Resource("storageclasses").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return result, err
}
func (c *storageClasses) Get(name string) (result *storage.StorageClass, err error) {
result = &storage.StorageClass{}
err = c.client.Get().Resource("storageClasses").Name(name).Do().Into(result)
return
}
func (c *storageClasses) Create(storageClass *storage.StorageClass) (result *storage.StorageClass, err error) {
result = &storage.StorageClass{}
err = c.client.Post().Resource("storageClasses").Body(storageClass).Do().Into(result)
return
}
func (c *storageClasses) Update(storageClass *storage.StorageClass) (result *storage.StorageClass, err error) {
result = &storage.StorageClass{}
err = c.client.Put().Resource("storageClasses").Name(storageClass.Name).Body(storageClass).Do().Into(result)
return
}
func (c *storageClasses) Delete(name string) error {
return c.client.Delete().Resource("storageClasses").Name(name).Do().Error()
}
func (c *storageClasses) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Resource("storageClasses").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}

View file

@ -1,45 +0,0 @@
/*
Copyright 2015 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 (
"k8s.io/kubernetes/pkg/apis/authorization"
)
type SubjectAccessReviewsInterface interface {
SubjectAccessReviews() SubjectAccessReviewInterface
}
type SubjectAccessReviewInterface interface {
Create(subjectAccessReview *authorization.SubjectAccessReview) (*authorization.SubjectAccessReview, error)
}
type subjectAccessReviews struct {
client *AuthorizationClient
}
func newSubjectAccessReviews(c *AuthorizationClient) *subjectAccessReviews {
return &subjectAccessReviews{
client: c,
}
}
func (c *subjectAccessReviews) Create(subjectAccessReview *authorization.SubjectAccessReview) (result *authorization.SubjectAccessReview, err error) {
result = &authorization.SubjectAccessReview{}
err = c.client.Post().Resource("subjectAccessReviews").Body(subjectAccessReview).Do().Into(result)
return
}

View file

@ -1,446 +0,0 @@
/*
Copyright 2015 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 testclient
import (
"strings"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
)
func NewRootGetAction(resource, name string) GetActionImpl {
action := GetActionImpl{}
action.Verb = "get"
action.Resource = resource
action.Name = name
return action
}
func NewGetAction(resource, namespace, name string) GetActionImpl {
action := GetActionImpl{}
action.Verb = "get"
action.Resource = resource
action.Namespace = namespace
action.Name = name
return action
}
func NewRootListAction(resource string, opts api.ListOptions) ListActionImpl {
action := ListActionImpl{}
action.Verb = "list"
action.Resource = resource
labelSelector := opts.LabelSelector
if labelSelector == nil {
labelSelector = labels.Everything()
}
fieldSelector := opts.FieldSelector
if fieldSelector == nil {
fieldSelector = fields.Everything()
}
action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
return action
}
func NewListAction(resource, namespace string, opts api.ListOptions) ListActionImpl {
action := ListActionImpl{}
action.Verb = "list"
action.Resource = resource
action.Namespace = namespace
labelSelector := opts.LabelSelector
if labelSelector == nil {
labelSelector = labels.Everything()
}
fieldSelector := opts.FieldSelector
if fieldSelector == nil {
fieldSelector = fields.Everything()
}
action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
return action
}
func NewRootCreateAction(resource string, object runtime.Object) CreateActionImpl {
action := CreateActionImpl{}
action.Verb = "create"
action.Resource = resource
action.Object = object
return action
}
func NewCreateAction(resource, namespace string, object runtime.Object) CreateActionImpl {
action := CreateActionImpl{}
action.Verb = "create"
action.Resource = resource
action.Namespace = namespace
action.Object = object
return action
}
func NewRootUpdateAction(resource string, object runtime.Object) UpdateActionImpl {
action := UpdateActionImpl{}
action.Verb = "update"
action.Resource = resource
action.Object = object
return action
}
func NewUpdateAction(resource, namespace string, object runtime.Object) UpdateActionImpl {
action := UpdateActionImpl{}
action.Verb = "update"
action.Resource = resource
action.Namespace = namespace
action.Object = object
return action
}
func NewRootPatchAction(resource string, object runtime.Object) PatchActionImpl {
action := PatchActionImpl{}
action.Verb = "patch"
action.Resource = resource
action.Object = object
return action
}
func NewPatchAction(resource, namespace string, object runtime.Object) PatchActionImpl {
action := PatchActionImpl{}
action.Verb = "patch"
action.Resource = resource
action.Namespace = namespace
action.Object = object
return action
}
func NewUpdateSubresourceAction(resource, subresource, namespace string, object runtime.Object) UpdateActionImpl {
action := UpdateActionImpl{}
action.Verb = "update"
action.Resource = resource
action.Subresource = subresource
action.Namespace = namespace
action.Object = object
return action
}
func NewRootDeleteAction(resource, name string) DeleteActionImpl {
action := DeleteActionImpl{}
action.Verb = "delete"
action.Resource = resource
action.Name = name
return action
}
func NewDeleteAction(resource, namespace, name string) DeleteActionImpl {
action := DeleteActionImpl{}
action.Verb = "delete"
action.Resource = resource
action.Namespace = namespace
action.Name = name
return action
}
func NewRootDeleteCollectionAction(resource string, opts api.ListOptions) DeleteCollectionActionImpl {
action := DeleteCollectionActionImpl{}
action.Verb = "delete-collection"
action.Resource = resource
labelSelector := opts.LabelSelector
if labelSelector == nil {
labelSelector = labels.Everything()
}
fieldSelector := opts.FieldSelector
if fieldSelector == nil {
fieldSelector = fields.Everything()
}
action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
return action
}
func NewDeleteCollectionAction(resource, namespace string, opts api.ListOptions) DeleteCollectionActionImpl {
action := DeleteCollectionActionImpl{}
action.Verb = "delete-collection"
action.Resource = resource
action.Namespace = namespace
labelSelector := opts.LabelSelector
if labelSelector == nil {
labelSelector = labels.Everything()
}
fieldSelector := opts.FieldSelector
if fieldSelector == nil {
fieldSelector = fields.Everything()
}
action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
return action
}
func NewRootWatchAction(resource string, opts api.ListOptions) WatchActionImpl {
action := WatchActionImpl{}
action.Verb = "watch"
action.Resource = resource
labelSelector := opts.LabelSelector
if labelSelector == nil {
labelSelector = labels.Everything()
}
fieldSelector := opts.FieldSelector
if fieldSelector == nil {
fieldSelector = fields.Everything()
}
action.WatchRestrictions = WatchRestrictions{labelSelector, fieldSelector, opts.ResourceVersion}
return action
}
func NewWatchAction(resource, namespace string, opts api.ListOptions) WatchActionImpl {
action := WatchActionImpl{}
action.Verb = "watch"
action.Resource = resource
action.Namespace = namespace
labelSelector := opts.LabelSelector
if labelSelector == nil {
labelSelector = labels.Everything()
}
fieldSelector := opts.FieldSelector
if fieldSelector == nil {
fieldSelector = fields.Everything()
}
action.WatchRestrictions = WatchRestrictions{labelSelector, fieldSelector, opts.ResourceVersion}
return action
}
func NewProxyGetAction(resource, namespace, scheme, name, port, path string, params map[string]string) ProxyGetActionImpl {
action := ProxyGetActionImpl{}
action.Verb = "get"
action.Resource = resource
action.Namespace = namespace
action.Scheme = scheme
action.Name = name
action.Port = port
action.Path = path
action.Params = params
return action
}
type ListRestrictions struct {
Labels labels.Selector
Fields fields.Selector
}
type WatchRestrictions struct {
Labels labels.Selector
Fields fields.Selector
ResourceVersion string
}
type Action interface {
GetNamespace() string
GetVerb() string
GetResource() string
GetSubresource() string
Matches(verb, resource string) bool
}
type GenericAction interface {
Action
GetValue() interface{}
}
type GetAction interface {
Action
GetName() string
}
type ListAction interface {
Action
GetListRestrictions() ListRestrictions
}
type CreateAction interface {
Action
GetObject() runtime.Object
}
type UpdateAction interface {
Action
GetObject() runtime.Object
}
type DeleteAction interface {
Action
GetName() string
}
type WatchAction interface {
Action
GetWatchRestrictions() WatchRestrictions
}
type ProxyGetAction interface {
Action
GetScheme() string
GetName() string
GetPort() string
GetPath() string
GetParams() map[string]string
}
type ActionImpl struct {
Namespace string
Verb string
Resource string
Subresource string
}
func (a ActionImpl) GetNamespace() string {
return a.Namespace
}
func (a ActionImpl) GetVerb() string {
return a.Verb
}
func (a ActionImpl) GetResource() string {
return a.Resource
}
func (a ActionImpl) GetSubresource() string {
return a.Subresource
}
func (a ActionImpl) Matches(verb, resource string) bool {
return strings.ToLower(verb) == strings.ToLower(a.Verb) &&
strings.ToLower(resource) == strings.ToLower(a.Resource)
}
type GenericActionImpl struct {
ActionImpl
Value interface{}
}
func (a GenericActionImpl) GetValue() interface{} {
return a.Value
}
type GetActionImpl struct {
ActionImpl
Name string
}
func (a GetActionImpl) GetName() string {
return a.Name
}
type ListActionImpl struct {
ActionImpl
ListRestrictions ListRestrictions
}
func (a ListActionImpl) GetListRestrictions() ListRestrictions {
return a.ListRestrictions
}
type CreateActionImpl struct {
ActionImpl
Object runtime.Object
}
func (a CreateActionImpl) GetObject() runtime.Object {
return a.Object
}
type UpdateActionImpl struct {
ActionImpl
Object runtime.Object
}
func (a UpdateActionImpl) GetObject() runtime.Object {
return a.Object
}
type PatchActionImpl struct {
ActionImpl
Object runtime.Object
}
func (a PatchActionImpl) GetObject() runtime.Object {
return a.Object
}
type DeleteActionImpl struct {
ActionImpl
Name string
}
func (a DeleteActionImpl) GetName() string {
return a.Name
}
type DeleteCollectionActionImpl struct {
ActionImpl
ListRestrictions ListRestrictions
}
func (a DeleteCollectionActionImpl) GetListRestrictions() ListRestrictions {
return a.ListRestrictions
}
type WatchActionImpl struct {
ActionImpl
WatchRestrictions WatchRestrictions
}
func (a WatchActionImpl) GetWatchRestrictions() WatchRestrictions {
return a.WatchRestrictions
}
type ProxyGetActionImpl struct {
ActionImpl
Scheme string
Name string
Port string
Path string
Params map[string]string
}
func (a ProxyGetActionImpl) GetScheme() string {
return a.Scheme
}
func (a ProxyGetActionImpl) GetName() string {
return a.Name
}
func (a ProxyGetActionImpl) GetPort() string {
return a.Port
}
func (a ProxyGetActionImpl) GetPath() string {
return a.Path
}
func (a ProxyGetActionImpl) GetParams() map[string]string {
return a.Params
}

View file

@ -1,107 +0,0 @@
/*
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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/certificates"
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/watch"
)
// NewSimpleFakeCertificate returns a client that will respond with the provided objects
func NewSimpleFakeCertificates(objects ...runtime.Object) *FakeCertificates {
return &FakeCertificates{Fake: NewSimpleFake(objects...)}
}
// FakeCertificates implements CertificatesInterface. 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 FakeCertificates struct {
*Fake
}
func (c *FakeCertificates) CertificateSigningRequests() unversioned.CertificateSigningRequestInterface {
return &FakeCertificateSigningRequest{Fake: c}
}
// FakeCertificateSigningRequest implements CertificateSigningRequestInterface
type FakeCertificateSigningRequest struct {
Fake *FakeCertificates
}
func (c *FakeCertificateSigningRequest) Get(name string) (*certificates.CertificateSigningRequest, error) {
obj, err := c.Fake.Invokes(NewRootGetAction("certificatesigningrequests", name), &certificates.CertificateSigningRequest{})
if obj == nil {
return nil, err
}
return obj.(*certificates.CertificateSigningRequest), err
}
func (c *FakeCertificateSigningRequest) List(opts api.ListOptions) (*certificates.CertificateSigningRequestList, error) {
obj, err := c.Fake.Invokes(NewRootListAction("certificatesigningrequests", opts), &certificates.CertificateSigningRequestList{})
if obj == nil {
return nil, err
}
return obj.(*certificates.CertificateSigningRequestList), err
}
func (c *FakeCertificateSigningRequest) Create(csr *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error) {
obj, err := c.Fake.Invokes(NewRootCreateAction("certificatesigningrequests", csr), csr)
if obj == nil {
return nil, err
}
return obj.(*certificates.CertificateSigningRequest), err
}
func (c *FakeCertificateSigningRequest) Update(csr *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error) {
obj, err := c.Fake.Invokes(NewRootUpdateAction("certificatesigningrequests", csr), csr)
if obj == nil {
return nil, err
}
return obj.(*certificates.CertificateSigningRequest), err
}
func (c *FakeCertificateSigningRequest) UpdateStatus(csr *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("certificatesigningrequests", "status", api.NamespaceAll, csr), csr)
if obj == nil {
return nil, err
}
return obj.(*certificates.CertificateSigningRequest), err
}
func (c *FakeCertificateSigningRequest) UpdateApproval(csr *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("certificatesigningrequests", "approval", api.NamespaceAll, csr), csr)
if obj == nil {
return nil, err
}
return obj.(*certificates.CertificateSigningRequest), err
}
func (c *FakeCertificateSigningRequest) Delete(name string, opts *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewRootDeleteAction("certificatesigningrequests", name), &certificates.CertificateSigningRequest{})
return err
}
func (c *FakeCertificateSigningRequest) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewRootWatchAction("certificatesigningrequests", opts))
}

View file

@ -1,73 +0,0 @@
/*
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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/watch"
)
// FakeClusterRoleBindings implements ClusterRoleBindingInterface
type FakeClusterRoleBindings struct {
Fake *FakeRbac
}
func (c *FakeClusterRoleBindings) Get(name string) (*rbac.ClusterRoleBinding, error) {
obj, err := c.Fake.Invokes(NewRootGetAction("clusterrolebindings", name), &rbac.ClusterRoleBinding{})
if obj == nil {
return nil, err
}
return obj.(*rbac.ClusterRoleBinding), err
}
func (c *FakeClusterRoleBindings) List(opts api.ListOptions) (*rbac.ClusterRoleBindingList, error) {
obj, err := c.Fake.Invokes(NewRootListAction("clusterrolebindings", opts), &rbac.ClusterRoleBindingList{})
if obj == nil {
return nil, err
}
return obj.(*rbac.ClusterRoleBindingList), err
}
func (c *FakeClusterRoleBindings) Create(csr *rbac.ClusterRoleBinding) (*rbac.ClusterRoleBinding, error) {
obj, err := c.Fake.Invokes(NewRootCreateAction("clusterrolebindings", csr), csr)
if obj == nil {
return nil, err
}
return obj.(*rbac.ClusterRoleBinding), err
}
func (c *FakeClusterRoleBindings) Update(csr *rbac.ClusterRoleBinding) (*rbac.ClusterRoleBinding, error) {
obj, err := c.Fake.Invokes(NewRootUpdateAction("clusterrolebindings", csr), csr)
if obj == nil {
return nil, err
}
return obj.(*rbac.ClusterRoleBinding), err
}
func (c *FakeClusterRoleBindings) Delete(name string, opts *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewRootDeleteAction("clusterrolebindings", name), &rbac.ClusterRoleBinding{})
return err
}
func (c *FakeClusterRoleBindings) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewRootWatchAction("clusterrolebindings", opts))
}

View file

@ -1,73 +0,0 @@
/*
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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/watch"
)
// FakeClusterRoles implements ClusterRoleInterface
type FakeClusterRoles struct {
Fake *FakeRbac
}
func (c *FakeClusterRoles) Get(name string) (*rbac.ClusterRole, error) {
obj, err := c.Fake.Invokes(NewRootGetAction("clusterroles", name), &rbac.ClusterRole{})
if obj == nil {
return nil, err
}
return obj.(*rbac.ClusterRole), err
}
func (c *FakeClusterRoles) List(opts api.ListOptions) (*rbac.ClusterRoleList, error) {
obj, err := c.Fake.Invokes(NewRootListAction("clusterroles", opts), &rbac.ClusterRoleList{})
if obj == nil {
return nil, err
}
return obj.(*rbac.ClusterRoleList), err
}
func (c *FakeClusterRoles) Create(csr *rbac.ClusterRole) (*rbac.ClusterRole, error) {
obj, err := c.Fake.Invokes(NewRootCreateAction("clusterroles", csr), csr)
if obj == nil {
return nil, err
}
return obj.(*rbac.ClusterRole), err
}
func (c *FakeClusterRoles) Update(csr *rbac.ClusterRole) (*rbac.ClusterRole, error) {
obj, err := c.Fake.Invokes(NewRootUpdateAction("clusterroles", csr), csr)
if obj == nil {
return nil, err
}
return obj.(*rbac.ClusterRole), err
}
func (c *FakeClusterRoles) Delete(name string, opts *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewRootDeleteAction("clusterroles", name), &rbac.ClusterRole{})
return err
}
func (c *FakeClusterRoles) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewRootWatchAction("clusterroles", opts))
}

View file

@ -1,44 +0,0 @@
/*
Copyright 2015 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
)
// Fake implements ComponentStatusInterface.
type FakeComponentStatuses struct {
Fake *Fake
}
func (c *FakeComponentStatuses) Get(name string) (*api.ComponentStatus, error) {
obj, err := c.Fake.Invokes(NewRootGetAction("componentstatuses", name), &api.ComponentStatus{})
if obj == nil {
return nil, err
}
return obj.(*api.ComponentStatus), err
}
func (c *FakeComponentStatuses) List(opts api.ListOptions) (result *api.ComponentStatusList, err error) {
obj, err := c.Fake.Invokes(NewRootListAction("componentstatuses", opts), &api.ComponentStatusList{})
if obj == nil {
return nil, err
}
return obj.(*api.ComponentStatusList), err
}

View file

@ -1,78 +0,0 @@
/*
Copyright 2015 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
const (
configMapResourceName string = "configMaps"
)
// FakeConfigMaps implements ConfigMapInterface. 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 FakeConfigMaps struct {
Fake *Fake
Namespace string
}
func (c *FakeConfigMaps) Get(name string) (*api.ConfigMap, error) {
obj, err := c.Fake.Invokes(NewGetAction(configMapResourceName, c.Namespace, name), &api.ConfigMap{})
if obj == nil {
return nil, err
}
return obj.(*api.ConfigMap), err
}
func (c *FakeConfigMaps) List(opts api.ListOptions) (*api.ConfigMapList, error) {
obj, err := c.Fake.Invokes(NewListAction(configMapResourceName, c.Namespace, opts), &api.ConfigMapList{})
if obj == nil {
return nil, err
}
return obj.(*api.ConfigMapList), err
}
func (c *FakeConfigMaps) Create(cfg *api.ConfigMap) (*api.ConfigMap, error) {
obj, err := c.Fake.Invokes(NewCreateAction(configMapResourceName, c.Namespace, cfg), cfg)
if obj == nil {
return nil, err
}
return obj.(*api.ConfigMap), err
}
func (c *FakeConfigMaps) Update(cfg *api.ConfigMap) (*api.ConfigMap, error) {
obj, err := c.Fake.Invokes(NewUpdateAction(configMapResourceName, c.Namespace, cfg), cfg)
if obj == nil {
return nil, err
}
return obj.(*api.ConfigMap), err
}
func (c *FakeConfigMaps) Delete(name string) error {
_, err := c.Fake.Invokes(NewDeleteAction(configMapResourceName, c.Namespace, name), &api.ConfigMap{})
return err
}
func (c *FakeConfigMaps) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction(configMapResourceName, c.Namespace, opts))
}

View file

@ -1,83 +0,0 @@
/*
Copyright 2015 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
kclientlib "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/watch"
)
// FakeDaemonSet implements DaemonInterface. 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 FakeDaemonSets struct {
Fake *FakeExperimental
Namespace string
}
// Ensure statically that FakeDaemonSets implements DaemonInterface.
var _ kclientlib.DaemonSetInterface = &FakeDaemonSets{}
func (c *FakeDaemonSets) Get(name string) (*extensions.DaemonSet, error) {
obj, err := c.Fake.Invokes(NewGetAction("daemonsets", c.Namespace, name), &extensions.DaemonSet{})
if obj == nil {
return nil, err
}
return obj.(*extensions.DaemonSet), err
}
func (c *FakeDaemonSets) List(opts api.ListOptions) (*extensions.DaemonSetList, error) {
obj, err := c.Fake.Invokes(NewListAction("daemonsets", c.Namespace, opts), &extensions.DaemonSetList{})
if obj == nil {
return nil, err
}
return obj.(*extensions.DaemonSetList), err
}
func (c *FakeDaemonSets) Create(daemon *extensions.DaemonSet) (*extensions.DaemonSet, error) {
obj, err := c.Fake.Invokes(NewCreateAction("daemonsets", c.Namespace, daemon), &extensions.DaemonSet{})
if obj == nil {
return nil, err
}
return obj.(*extensions.DaemonSet), err
}
func (c *FakeDaemonSets) Update(daemon *extensions.DaemonSet) (*extensions.DaemonSet, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("daemonsets", c.Namespace, daemon), &extensions.DaemonSet{})
if obj == nil {
return nil, err
}
return obj.(*extensions.DaemonSet), err
}
func (c *FakeDaemonSets) UpdateStatus(daemon *extensions.DaemonSet) (*extensions.DaemonSet, error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("daemonsets", "status", c.Namespace, daemon), &extensions.DaemonSet{})
if obj == nil {
return nil, err
}
return obj.(*extensions.DaemonSet), err
}
func (c *FakeDaemonSets) Delete(name string) error {
_, err := c.Fake.Invokes(NewDeleteAction("daemonsets", c.Namespace, name), &extensions.DaemonSet{})
return err
}
func (c *FakeDaemonSets) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("daemonsets", c.Namespace, opts))
}

View file

@ -1,109 +0,0 @@
/*
Copyright 2015 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
kclientlib "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/watch"
)
// FakeDeployments implements DeploymentInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the methods you want to test easier.
type FakeDeployments struct {
Fake *FakeExperimental
Namespace string
}
// Ensure statically that FakeDeployments implements DeploymentInterface.
var _ kclientlib.DeploymentInterface = &FakeDeployments{}
func (c *FakeDeployments) Get(name string) (*extensions.Deployment, error) {
obj, err := c.Fake.Invokes(NewGetAction("deployments", c.Namespace, name), &extensions.Deployment{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Deployment), err
}
func (c *FakeDeployments) List(opts api.ListOptions) (*extensions.DeploymentList, error) {
obj, err := c.Fake.Invokes(NewListAction("deployments", c.Namespace, opts), &extensions.DeploymentList{})
if obj == nil {
return nil, err
}
label := opts.LabelSelector
if label == nil {
label = labels.Everything()
}
list := &extensions.DeploymentList{}
for _, deployment := range obj.(*extensions.DeploymentList).Items {
if label.Matches(labels.Set(deployment.Labels)) {
list.Items = append(list.Items, deployment)
}
}
return list, err
}
func (c *FakeDeployments) Create(deployment *extensions.Deployment) (*extensions.Deployment, error) {
obj, err := c.Fake.Invokes(NewCreateAction("deployments", c.Namespace, deployment), deployment)
if obj == nil {
return nil, err
}
return obj.(*extensions.Deployment), err
}
func (c *FakeDeployments) Update(deployment *extensions.Deployment) (*extensions.Deployment, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("deployments", c.Namespace, deployment), deployment)
if obj == nil {
return nil, err
}
return obj.(*extensions.Deployment), err
}
func (c *FakeDeployments) UpdateStatus(deployment *extensions.Deployment) (*extensions.Deployment, error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("deployments", "status", c.Namespace, deployment), deployment)
if obj == nil {
return nil, err
}
return obj.(*extensions.Deployment), err
}
func (c *FakeDeployments) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("deployments", c.Namespace, name), &extensions.Deployment{})
return err
}
func (c *FakeDeployments) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("deployments", c.Namespace, opts))
}
func (c *FakeDeployments) Rollback(deploymentRollback *extensions.DeploymentRollback) error {
action := CreateActionImpl{}
action.Verb = "create"
action.Resource = "deployments"
action.Subresource = "rollback"
action.Object = deploymentRollback
_, err := c.Fake.Invokes(action, deploymentRollback)
return err
}

View file

@ -1,74 +0,0 @@
/*
Copyright 2014 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
// FakeEndpoints implements EndpointInterface. 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 FakeEndpoints struct {
Fake *Fake
Namespace string
}
func (c *FakeEndpoints) Get(name string) (*api.Endpoints, error) {
obj, err := c.Fake.Invokes(NewGetAction("endpoints", c.Namespace, name), &api.Endpoints{})
if obj == nil {
return nil, err
}
return obj.(*api.Endpoints), err
}
func (c *FakeEndpoints) List(opts api.ListOptions) (*api.EndpointsList, error) {
obj, err := c.Fake.Invokes(NewListAction("endpoints", c.Namespace, opts), &api.EndpointsList{})
if obj == nil {
return nil, err
}
return obj.(*api.EndpointsList), err
}
func (c *FakeEndpoints) Create(endpoints *api.Endpoints) (*api.Endpoints, error) {
obj, err := c.Fake.Invokes(NewCreateAction("endpoints", c.Namespace, endpoints), endpoints)
if obj == nil {
return nil, err
}
return obj.(*api.Endpoints), err
}
func (c *FakeEndpoints) Update(endpoints *api.Endpoints) (*api.Endpoints, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("endpoints", c.Namespace, endpoints), endpoints)
if obj == nil {
return nil, err
}
return obj.(*api.Endpoints), err
}
func (c *FakeEndpoints) Delete(name string) error {
_, err := c.Fake.Invokes(NewDeleteAction("endpoints", c.Namespace, name), &api.Endpoints{})
return err
}
func (c *FakeEndpoints) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("endpoints", c.Namespace, opts))
}

View file

@ -1,151 +0,0 @@
/*
Copyright 2014 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/watch"
)
// FakeEvents implements EventInterface. 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 FakeEvents struct {
Fake *Fake
Namespace string
}
// Get returns the given event, or an error.
func (c *FakeEvents) Get(name string) (*api.Event, error) {
action := NewRootGetAction("events", name)
if c.Namespace != "" {
action = NewGetAction("events", c.Namespace, name)
}
obj, err := c.Fake.Invokes(action, &api.Event{})
if obj == nil {
return nil, err
}
return obj.(*api.Event), err
}
// List returns a list of events matching the selectors.
func (c *FakeEvents) List(opts api.ListOptions) (*api.EventList, error) {
action := NewRootListAction("events", opts)
if c.Namespace != "" {
action = NewListAction("events", c.Namespace, opts)
}
obj, err := c.Fake.Invokes(action, &api.EventList{})
if obj == nil {
return nil, err
}
return obj.(*api.EventList), err
}
// Create makes a new event. Returns the copy of the event the server returns, or an error.
func (c *FakeEvents) Create(event *api.Event) (*api.Event, error) {
action := NewRootCreateAction("events", event)
if c.Namespace != "" {
action = NewCreateAction("events", c.Namespace, event)
}
obj, err := c.Fake.Invokes(action, event)
if obj == nil {
return nil, err
}
return obj.(*api.Event), err
}
// Update replaces an existing event. Returns the copy of the event the server returns, or an error.
func (c *FakeEvents) Update(event *api.Event) (*api.Event, error) {
action := NewRootUpdateAction("events", event)
if c.Namespace != "" {
action = NewUpdateAction("events", c.Namespace, event)
}
obj, err := c.Fake.Invokes(action, event)
if obj == nil {
return nil, err
}
return obj.(*api.Event), err
}
// Patch patches an existing event. Returns the copy of the event the server returns, or an error.
func (c *FakeEvents) Patch(event *api.Event, data []byte) (*api.Event, error) {
action := NewRootPatchAction("events", event)
if c.Namespace != "" {
action = NewPatchAction("events", c.Namespace, event)
}
obj, err := c.Fake.Invokes(action, event)
if obj == nil {
return nil, err
}
return obj.(*api.Event), err
}
func (c *FakeEvents) Delete(name string) error {
action := NewRootDeleteAction("events", name)
if c.Namespace != "" {
action = NewDeleteAction("events", c.Namespace, name)
}
_, err := c.Fake.Invokes(action, &api.Event{})
return err
}
func (c *FakeEvents) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := NewRootDeleteCollectionAction("events", listOptions)
if c.Namespace != "" {
action = NewDeleteCollectionAction("events", c.Namespace, listOptions)
}
_, err := c.Fake.Invokes(action, &api.EventList{})
return err
}
// Watch starts watching for events matching the given selectors.
func (c *FakeEvents) Watch(opts api.ListOptions) (watch.Interface, error) {
action := NewRootWatchAction("events", opts)
if c.Namespace != "" {
action = NewWatchAction("events", c.Namespace, opts)
}
return c.Fake.InvokesWatch(action)
}
// Search returns a list of events matching the specified object.
func (c *FakeEvents) Search(objOrRef runtime.Object) (*api.EventList, error) {
action := NewRootListAction("events", api.ListOptions{})
if c.Namespace != "" {
action = NewListAction("events", c.Namespace, api.ListOptions{})
}
obj, err := c.Fake.Invokes(action, &api.EventList{})
if obj == nil {
return nil, err
}
return obj.(*api.EventList), err
}
func (c *FakeEvents) GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector {
action := GenericActionImpl{}
action.Verb = "get-field-selector"
action.Resource = "events"
c.Fake.Invokes(action, nil)
return fields.Everything()
}

View file

@ -1,93 +0,0 @@
/*
Copyright 2015 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/autoscaling"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/watch"
)
// FakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the methods you want to test easier.
type FakeHorizontalPodAutoscalers struct {
Fake *FakeAutoscaling
Namespace string
}
func (c *FakeHorizontalPodAutoscalers) Get(name string) (*autoscaling.HorizontalPodAutoscaler, error) {
obj, err := c.Fake.Invokes(NewGetAction("horizontalpodautoscalers", c.Namespace, name), &autoscaling.HorizontalPodAutoscaler{})
if obj == nil {
return nil, err
}
return obj.(*autoscaling.HorizontalPodAutoscaler), err
}
func (c *FakeHorizontalPodAutoscalers) List(opts api.ListOptions) (*autoscaling.HorizontalPodAutoscalerList, error) {
obj, err := c.Fake.Invokes(NewListAction("horizontalpodautoscalers", c.Namespace, opts), &autoscaling.HorizontalPodAutoscalerList{})
if obj == nil {
return nil, err
}
label := opts.LabelSelector
if label == nil {
label = labels.Everything()
}
list := &autoscaling.HorizontalPodAutoscalerList{}
for _, a := range obj.(*autoscaling.HorizontalPodAutoscalerList).Items {
if label.Matches(labels.Set(a.Labels)) {
list.Items = append(list.Items, a)
}
}
return list, err
}
func (c *FakeHorizontalPodAutoscalers) Create(a *autoscaling.HorizontalPodAutoscaler) (*autoscaling.HorizontalPodAutoscaler, error) {
obj, err := c.Fake.Invokes(NewCreateAction("horizontalpodautoscalers", c.Namespace, a), a)
if obj == nil {
return nil, err
}
return obj.(*autoscaling.HorizontalPodAutoscaler), err
}
func (c *FakeHorizontalPodAutoscalers) Update(a *autoscaling.HorizontalPodAutoscaler) (*autoscaling.HorizontalPodAutoscaler, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("horizontalpodautoscalers", c.Namespace, a), a)
if obj == nil {
return nil, err
}
return obj.(*autoscaling.HorizontalPodAutoscaler), err
}
func (c *FakeHorizontalPodAutoscalers) UpdateStatus(a *autoscaling.HorizontalPodAutoscaler) (*autoscaling.HorizontalPodAutoscaler, error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("horizontalpodautoscalers", "status", c.Namespace, a), &autoscaling.HorizontalPodAutoscaler{})
if obj == nil {
return nil, err
}
return obj.(*autoscaling.HorizontalPodAutoscaler), err
}
func (c *FakeHorizontalPodAutoscalers) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("horizontalpodautoscalers", c.Namespace, name), &autoscaling.HorizontalPodAutoscaler{})
return err
}
func (c *FakeHorizontalPodAutoscalers) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("horizontalpodautoscalers", c.Namespace, opts))
}

View file

@ -1,84 +0,0 @@
/*
Copyright 2015 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/watch"
)
// FakeIngress implements IngressInterface. 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 FakeIngress struct {
Fake *FakeExperimental
Namespace string
}
func (c *FakeIngress) Get(name string) (*extensions.Ingress, error) {
obj, err := c.Fake.Invokes(NewGetAction("ingresses", c.Namespace, name), &extensions.Ingress{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Ingress), err
}
func (c *FakeIngress) List(opts api.ListOptions) (*extensions.IngressList, error) {
obj, err := c.Fake.Invokes(NewListAction("ingresses", c.Namespace, opts), &extensions.IngressList{})
if obj == nil {
return nil, err
}
return obj.(*extensions.IngressList), err
}
func (c *FakeIngress) Create(ingress *extensions.Ingress) (*extensions.Ingress, error) {
obj, err := c.Fake.Invokes(NewCreateAction("ingresses", c.Namespace, ingress), ingress)
if obj == nil {
return nil, err
}
return obj.(*extensions.Ingress), err
}
func (c *FakeIngress) Update(ingress *extensions.Ingress) (*extensions.Ingress, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("ingresses", c.Namespace, ingress), ingress)
if obj == nil {
return nil, err
}
return obj.(*extensions.Ingress), err
}
func (c *FakeIngress) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("ingresses", c.Namespace, name), &extensions.Ingress{})
return err
}
func (c *FakeIngress) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("ingresses", c.Namespace, opts))
}
func (c *FakeIngress) UpdateStatus(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("ingresses", "status", c.Namespace, ingress), ingress)
if obj == nil {
return nil, err
}
return obj.(*extensions.Ingress), err
}

View file

@ -1,147 +0,0 @@
/*
Copyright 2015 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/watch"
)
// FakeJobs implements JobInterface. 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 FakeJobs struct {
Fake *FakeExperimental
Namespace string
}
func (c *FakeJobs) Get(name string) (*batch.Job, error) {
obj, err := c.Fake.Invokes(NewGetAction("jobs", c.Namespace, name), &batch.Job{})
if obj == nil {
return nil, err
}
return obj.(*batch.Job), err
}
func (c *FakeJobs) List(opts api.ListOptions) (*batch.JobList, error) {
obj, err := c.Fake.Invokes(NewListAction("jobs", c.Namespace, opts), &batch.JobList{})
if obj == nil {
return nil, err
}
return obj.(*batch.JobList), err
}
func (c *FakeJobs) Create(job *batch.Job) (*batch.Job, error) {
obj, err := c.Fake.Invokes(NewCreateAction("jobs", c.Namespace, job), job)
if obj == nil {
return nil, err
}
return obj.(*batch.Job), err
}
func (c *FakeJobs) Update(job *batch.Job) (*batch.Job, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("jobs", c.Namespace, job), job)
if obj == nil {
return nil, err
}
return obj.(*batch.Job), err
}
func (c *FakeJobs) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("jobs", c.Namespace, name), &batch.Job{})
return err
}
func (c *FakeJobs) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("jobs", c.Namespace, opts))
}
func (c *FakeJobs) UpdateStatus(job *batch.Job) (result *batch.Job, err error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("jobs", "status", c.Namespace, job), job)
if obj == nil {
return nil, err
}
return obj.(*batch.Job), err
}
// FakeJobs implements JobInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the methods you want to test easier.
// This is a test implementation of JobsV1
// TODO(piosz): get back to one client implementation once HPA will be graduated to GA completely
type FakeJobsV1 struct {
Fake *FakeBatch
Namespace string
}
func (c *FakeJobsV1) Get(name string) (*batch.Job, error) {
obj, err := c.Fake.Invokes(NewGetAction("jobs", c.Namespace, name), &batch.Job{})
if obj == nil {
return nil, err
}
return obj.(*batch.Job), err
}
func (c *FakeJobsV1) List(opts api.ListOptions) (*batch.JobList, error) {
obj, err := c.Fake.Invokes(NewListAction("jobs", c.Namespace, opts), &batch.JobList{})
if obj == nil {
return nil, err
}
return obj.(*batch.JobList), err
}
func (c *FakeJobsV1) Create(job *batch.Job) (*batch.Job, error) {
obj, err := c.Fake.Invokes(NewCreateAction("jobs", c.Namespace, job), job)
if obj == nil {
return nil, err
}
return obj.(*batch.Job), err
}
func (c *FakeJobsV1) Update(job *batch.Job) (*batch.Job, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("jobs", c.Namespace, job), job)
if obj == nil {
return nil, err
}
return obj.(*batch.Job), err
}
func (c *FakeJobsV1) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("jobs", c.Namespace, name), &batch.Job{})
return err
}
func (c *FakeJobsV1) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("jobs", c.Namespace, opts))
}
func (c *FakeJobsV1) UpdateStatus(job *batch.Job) (result *batch.Job, err error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("jobs", "status", c.Namespace, job), job)
if obj == nil {
return nil, err
}
return obj.(*batch.Job), err
}

View file

@ -1,74 +0,0 @@
/*
Copyright 2014 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
// FakeLimitRanges implements PodsInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the methods you want to test easier.
type FakeLimitRanges struct {
Fake *Fake
Namespace string
}
func (c *FakeLimitRanges) Get(name string) (*api.LimitRange, error) {
obj, err := c.Fake.Invokes(NewGetAction("limitranges", c.Namespace, name), &api.LimitRange{})
if obj == nil {
return nil, err
}
return obj.(*api.LimitRange), err
}
func (c *FakeLimitRanges) List(opts api.ListOptions) (*api.LimitRangeList, error) {
obj, err := c.Fake.Invokes(NewListAction("limitranges", c.Namespace, opts), &api.LimitRangeList{})
if obj == nil {
return nil, err
}
return obj.(*api.LimitRangeList), err
}
func (c *FakeLimitRanges) Create(limitRange *api.LimitRange) (*api.LimitRange, error) {
obj, err := c.Fake.Invokes(NewCreateAction("limitranges", c.Namespace, limitRange), limitRange)
if obj == nil {
return nil, err
}
return obj.(*api.LimitRange), err
}
func (c *FakeLimitRanges) Update(limitRange *api.LimitRange) (*api.LimitRange, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("limitranges", c.Namespace, limitRange), limitRange)
if obj == nil {
return nil, err
}
return obj.(*api.LimitRange), err
}
func (c *FakeLimitRanges) Delete(name string) error {
_, err := c.Fake.Invokes(NewDeleteAction("limitranges", c.Namespace, name), &api.LimitRange{})
return err
}
func (c *FakeLimitRanges) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("limitranges", c.Namespace, opts))
}

View file

@ -1,103 +0,0 @@
/*
Copyright 2014 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
// FakeNamespaces implements NamespacesInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the methods you want to test easier.
type FakeNamespaces struct {
Fake *Fake
}
func (c *FakeNamespaces) Get(name string) (*api.Namespace, error) {
obj, err := c.Fake.Invokes(NewRootGetAction("namespaces", name), &api.Namespace{})
if obj == nil {
return nil, err
}
return obj.(*api.Namespace), err
}
func (c *FakeNamespaces) List(opts api.ListOptions) (*api.NamespaceList, error) {
obj, err := c.Fake.Invokes(NewRootListAction("namespaces", opts), &api.NamespaceList{})
if obj == nil {
return nil, err
}
return obj.(*api.NamespaceList), err
}
func (c *FakeNamespaces) Create(namespace *api.Namespace) (*api.Namespace, error) {
obj, err := c.Fake.Invokes(NewRootCreateAction("namespaces", namespace), namespace)
if obj == nil {
return nil, err
}
return obj.(*api.Namespace), err
}
func (c *FakeNamespaces) Update(namespace *api.Namespace) (*api.Namespace, error) {
obj, err := c.Fake.Invokes(NewRootUpdateAction("namespaces", namespace), namespace)
if obj == nil {
return nil, err
}
return obj.(*api.Namespace), err
}
func (c *FakeNamespaces) Delete(name string) error {
_, err := c.Fake.Invokes(NewRootDeleteAction("namespaces", name), &api.Namespace{})
return err
}
func (c *FakeNamespaces) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewRootWatchAction("namespaces", opts))
}
func (c *FakeNamespaces) Finalize(namespace *api.Namespace) (*api.Namespace, error) {
action := CreateActionImpl{}
action.Verb = "create"
action.Resource = "namespaces"
action.Subresource = "finalize"
action.Object = namespace
obj, err := c.Fake.Invokes(action, namespace)
if obj == nil {
return nil, err
}
return obj.(*api.Namespace), err
}
func (c *FakeNamespaces) Status(namespace *api.Namespace) (*api.Namespace, error) {
action := CreateActionImpl{}
action.Verb = "create"
action.Resource = "namespaces"
action.Subresource = "status"
action.Object = namespace
obj, err := c.Fake.Invokes(action, namespace)
if obj == nil {
return nil, err
}
return obj.(*api.Namespace), err
}

View file

@ -1,75 +0,0 @@
/*
Copyright 2015 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
kclientlib "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/watch"
)
// FakeNetworkPolicies implements NetworkPolicyInterface. 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 FakeNetworkPolicies struct {
Fake *FakeExperimental
Namespace string
}
// Ensure statically that FakeNetworkPolicies implements NetworkPolicyInterface.
var _ kclientlib.NetworkPolicyInterface = &FakeNetworkPolicies{}
func (c *FakeNetworkPolicies) Get(name string) (*extensions.NetworkPolicy, error) {
obj, err := c.Fake.Invokes(NewGetAction("networkpolicies", c.Namespace, name), &extensions.NetworkPolicy{})
if obj == nil {
return nil, err
}
return obj.(*extensions.NetworkPolicy), err
}
func (c *FakeNetworkPolicies) List(opts api.ListOptions) (*extensions.NetworkPolicyList, error) {
obj, err := c.Fake.Invokes(NewListAction("networkpolicies", c.Namespace, opts), &extensions.NetworkPolicyList{})
if obj == nil {
return nil, err
}
return obj.(*extensions.NetworkPolicyList), err
}
func (c *FakeNetworkPolicies) Create(np *extensions.NetworkPolicy) (*extensions.NetworkPolicy, error) {
obj, err := c.Fake.Invokes(NewCreateAction("networkpolicies", c.Namespace, np), &extensions.NetworkPolicy{})
if obj == nil {
return nil, err
}
return obj.(*extensions.NetworkPolicy), err
}
func (c *FakeNetworkPolicies) Update(np *extensions.NetworkPolicy) (*extensions.NetworkPolicy, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("networkpolicies", c.Namespace, np), &extensions.NetworkPolicy{})
if obj == nil {
return nil, err
}
return obj.(*extensions.NetworkPolicy), err
}
func (c *FakeNetworkPolicies) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("networkpolicies", c.Namespace, name), &extensions.NetworkPolicy{})
return err
}
func (c *FakeNetworkPolicies) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("networkpolicies", c.Namespace, opts))
}

View file

@ -1,93 +0,0 @@
/*
Copyright 2014 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
// FakeNodes implements NodeInterface. 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 FakeNodes struct {
Fake *Fake
}
func (c *FakeNodes) Get(name string) (*api.Node, error) {
obj, err := c.Fake.Invokes(NewRootGetAction("nodes", name), &api.Node{})
if obj == nil {
return nil, err
}
return obj.(*api.Node), err
}
func (c *FakeNodes) List(opts api.ListOptions) (*api.NodeList, error) {
obj, err := c.Fake.Invokes(NewRootListAction("nodes", opts), &api.NodeList{})
if obj == nil {
return nil, err
}
return obj.(*api.NodeList), err
}
func (c *FakeNodes) Create(node *api.Node) (*api.Node, error) {
obj, err := c.Fake.Invokes(NewRootCreateAction("nodes", node), node)
if obj == nil {
return nil, err
}
return obj.(*api.Node), err
}
func (c *FakeNodes) Update(node *api.Node) (*api.Node, error) {
obj, err := c.Fake.Invokes(NewRootUpdateAction("nodes", node), node)
if obj == nil {
return nil, err
}
return obj.(*api.Node), err
}
func (c *FakeNodes) Delete(name string) error {
_, err := c.Fake.Invokes(NewRootDeleteAction("nodes", name), &api.Node{})
return err
}
func (c *FakeNodes) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
_, err := c.Fake.Invokes(NewRootDeleteCollectionAction("nodes", listOptions), &api.NodeList{})
return err
}
func (c *FakeNodes) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewRootWatchAction("nodes", opts))
}
func (c *FakeNodes) UpdateStatus(node *api.Node) (*api.Node, error) {
action := CreateActionImpl{}
action.Verb = "update"
action.Resource = "nodes"
action.Subresource = "status"
action.Object = node
obj, err := c.Fake.Invokes(action, node)
if obj == nil {
return nil, err
}
return obj.(*api.Node), err
}

View file

@ -1,81 +0,0 @@
/*
Copyright 2014 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
type FakePersistentVolumeClaims struct {
Fake *Fake
Namespace string
}
func (c *FakePersistentVolumeClaims) Get(name string) (*api.PersistentVolumeClaim, error) {
obj, err := c.Fake.Invokes(NewGetAction("persistentvolumeclaims", c.Namespace, name), &api.PersistentVolumeClaim{})
if obj == nil {
return nil, err
}
return obj.(*api.PersistentVolumeClaim), err
}
func (c *FakePersistentVolumeClaims) List(opts api.ListOptions) (*api.PersistentVolumeClaimList, error) {
obj, err := c.Fake.Invokes(NewListAction("persistentvolumeclaims", c.Namespace, opts), &api.PersistentVolumeClaimList{})
if obj == nil {
return nil, err
}
return obj.(*api.PersistentVolumeClaimList), err
}
func (c *FakePersistentVolumeClaims) Create(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) {
obj, err := c.Fake.Invokes(NewCreateAction("persistentvolumeclaims", c.Namespace, claim), claim)
if obj == nil {
return nil, err
}
return obj.(*api.PersistentVolumeClaim), err
}
func (c *FakePersistentVolumeClaims) Update(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("persistentvolumeclaims", c.Namespace, claim), claim)
if obj == nil {
return nil, err
}
return obj.(*api.PersistentVolumeClaim), err
}
func (c *FakePersistentVolumeClaims) Delete(name string) error {
_, err := c.Fake.Invokes(NewDeleteAction("persistentvolumeclaims", c.Namespace, name), &api.PersistentVolumeClaim{})
return err
}
func (c *FakePersistentVolumeClaims) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("persistentvolumeclaims", c.Namespace, opts))
}
func (c *FakePersistentVolumeClaims) UpdateStatus(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("persistentvolumeclaims", "status", c.Namespace, claim), claim)
if obj == nil {
return nil, err
}
return obj.(*api.PersistentVolumeClaim), err
}

View file

@ -1,86 +0,0 @@
/*
Copyright 2014 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
type FakePersistentVolumes struct {
Fake *Fake
}
func (c *FakePersistentVolumes) Get(name string) (*api.PersistentVolume, error) {
obj, err := c.Fake.Invokes(NewRootGetAction("persistentvolumes", name), &api.PersistentVolume{})
if obj == nil {
return nil, err
}
return obj.(*api.PersistentVolume), err
}
func (c *FakePersistentVolumes) List(opts api.ListOptions) (*api.PersistentVolumeList, error) {
obj, err := c.Fake.Invokes(NewRootListAction("persistentvolumes", opts), &api.PersistentVolumeList{})
if obj == nil {
return nil, err
}
return obj.(*api.PersistentVolumeList), err
}
func (c *FakePersistentVolumes) Create(pv *api.PersistentVolume) (*api.PersistentVolume, error) {
obj, err := c.Fake.Invokes(NewRootCreateAction("persistentvolumes", pv), pv)
if obj == nil {
return nil, err
}
return obj.(*api.PersistentVolume), err
}
func (c *FakePersistentVolumes) Update(pv *api.PersistentVolume) (*api.PersistentVolume, error) {
obj, err := c.Fake.Invokes(NewRootUpdateAction("persistentvolumes", pv), pv)
if obj == nil {
return nil, err
}
return obj.(*api.PersistentVolume), err
}
func (c *FakePersistentVolumes) Delete(name string) error {
_, err := c.Fake.Invokes(NewRootDeleteAction("persistentvolumes", name), &api.PersistentVolume{})
return err
}
func (c *FakePersistentVolumes) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewRootWatchAction("persistentvolumes", opts))
}
func (c *FakePersistentVolumes) UpdateStatus(pv *api.PersistentVolume) (*api.PersistentVolume, error) {
action := UpdateActionImpl{}
action.Verb = "update"
action.Resource = "persistentvolumes"
action.Subresource = "status"
action.Object = pv
obj, err := c.Fake.Invokes(action, pv)
if obj == nil {
return nil, err
}
return obj.(*api.PersistentVolume), err
}

View file

@ -1,83 +0,0 @@
/*
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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/apps"
"k8s.io/kubernetes/pkg/watch"
)
// FakePetSets implements PetSetsInterface. 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 FakePetSets struct {
Fake *FakeApps
Namespace string
}
func (c *FakePetSets) Get(name string) (*apps.PetSet, error) {
obj, err := c.Fake.Invokes(NewGetAction("petsets", c.Namespace, name), &apps.PetSet{})
if obj == nil {
return nil, err
}
return obj.(*apps.PetSet), err
}
func (c *FakePetSets) List(opts api.ListOptions) (*apps.PetSetList, error) {
obj, err := c.Fake.Invokes(NewListAction("petsets", c.Namespace, opts), &apps.PetSetList{})
if obj == nil {
return nil, err
}
return obj.(*apps.PetSetList), err
}
func (c *FakePetSets) Create(rs *apps.PetSet) (*apps.PetSet, error) {
obj, err := c.Fake.Invokes(NewCreateAction("petsets", c.Namespace, rs), rs)
if obj == nil {
return nil, err
}
return obj.(*apps.PetSet), err
}
func (c *FakePetSets) Update(rs *apps.PetSet) (*apps.PetSet, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("petsets", c.Namespace, rs), rs)
if obj == nil {
return nil, err
}
return obj.(*apps.PetSet), err
}
func (c *FakePetSets) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("petsets", c.Namespace, name), &apps.PetSet{})
return err
}
func (c *FakePetSets) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("petsets", c.Namespace, opts))
}
func (c *FakePetSets) UpdateStatus(rs *apps.PetSet) (result *apps.PetSet, err error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("petsets", "status", c.Namespace, rs), rs)
if obj == nil {
return nil, err
}
return obj.(*apps.PetSet), err
}

View file

@ -1,74 +0,0 @@
/*
Copyright 2015 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
// FakePodTemplates implements PodTemplatesInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the methods you want to test easier.
type FakePodTemplates struct {
Fake *Fake
Namespace string
}
func (c *FakePodTemplates) Get(name string) (*api.PodTemplate, error) {
obj, err := c.Fake.Invokes(NewGetAction("podtemplates", c.Namespace, name), &api.PodTemplate{})
if obj == nil {
return nil, err
}
return obj.(*api.PodTemplate), err
}
func (c *FakePodTemplates) List(opts api.ListOptions) (*api.PodTemplateList, error) {
obj, err := c.Fake.Invokes(NewListAction("podtemplates", c.Namespace, opts), &api.PodTemplateList{})
if obj == nil {
return nil, err
}
return obj.(*api.PodTemplateList), err
}
func (c *FakePodTemplates) Create(pod *api.PodTemplate) (*api.PodTemplate, error) {
obj, err := c.Fake.Invokes(NewCreateAction("podtemplates", c.Namespace, pod), pod)
if obj == nil {
return nil, err
}
return obj.(*api.PodTemplate), err
}
func (c *FakePodTemplates) Update(pod *api.PodTemplate) (*api.PodTemplate, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("podtemplates", c.Namespace, pod), pod)
if obj == nil {
return nil, err
}
return obj.(*api.PodTemplate), err
}
func (c *FakePodTemplates) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("podtemplates", c.Namespace, name), &api.PodTemplate{})
return err
}
func (c *FakePodTemplates) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("podtemplates", c.Namespace, opts))
}

View file

@ -1,117 +0,0 @@
/*
Copyright 2014 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/watch"
)
// FakePods implements PodsInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the methods you want to test easier.
type FakePods struct {
Fake *Fake
Namespace string
}
func (c *FakePods) Get(name string) (*api.Pod, error) {
obj, err := c.Fake.Invokes(NewGetAction("pods", c.Namespace, name), &api.Pod{})
if obj == nil {
return nil, err
}
return obj.(*api.Pod), err
}
func (c *FakePods) List(opts api.ListOptions) (*api.PodList, error) {
obj, err := c.Fake.Invokes(NewListAction("pods", c.Namespace, opts), &api.PodList{})
if obj == nil {
return nil, err
}
label := opts.LabelSelector
if label == nil {
label = labels.Everything()
}
list := &api.PodList{}
for _, pod := range obj.(*api.PodList).Items {
if label.Matches(labels.Set(pod.Labels)) {
list.Items = append(list.Items, pod)
}
}
return list, err
}
func (c *FakePods) Create(pod *api.Pod) (*api.Pod, error) {
obj, err := c.Fake.Invokes(NewCreateAction("pods", c.Namespace, pod), pod)
if obj == nil {
return nil, err
}
return obj.(*api.Pod), err
}
func (c *FakePods) Update(pod *api.Pod) (*api.Pod, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("pods", c.Namespace, pod), pod)
if obj == nil {
return nil, err
}
return obj.(*api.Pod), err
}
func (c *FakePods) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("pods", c.Namespace, name), &api.Pod{})
return err
}
func (c *FakePods) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("pods", c.Namespace, opts))
}
func (c *FakePods) Bind(binding *api.Binding) error {
action := CreateActionImpl{}
action.Verb = "create"
action.Resource = "pods"
action.Subresource = "bindings"
action.Object = binding
_, err := c.Fake.Invokes(action, binding)
return err
}
func (c *FakePods) UpdateStatus(pod *api.Pod) (*api.Pod, error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("pods", "status", c.Namespace, pod), pod)
if obj == nil {
return nil, err
}
return obj.(*api.Pod), err
}
func (c *FakePods) GetLogs(name string, opts *api.PodLogOptions) *restclient.Request {
action := GenericActionImpl{}
action.Verb = "get"
action.Namespace = c.Namespace
action.Resource = "pod"
action.Subresource = "logs"
action.Value = opts
_, _ = c.Fake.Invokes(action, &api.Pod{})
return &restclient.Request{}
}

View file

@ -1,73 +0,0 @@
/*
Copyright 2014 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/watch"
)
// FakePodSecurityPolicy implements PodSecurityPolicyInterface. 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 FakePodSecurityPolicy struct {
Fake *Fake
Namespace string
}
func (c *FakePodSecurityPolicy) List(opts api.ListOptions) (*extensions.PodSecurityPolicyList, error) {
obj, err := c.Fake.Invokes(NewListAction("podsecuritypolicies", c.Namespace, opts), &extensions.PodSecurityPolicyList{})
if obj == nil {
return nil, err
}
return obj.(*extensions.PodSecurityPolicyList), err
}
func (c *FakePodSecurityPolicy) Get(name string) (*extensions.PodSecurityPolicy, error) {
obj, err := c.Fake.Invokes(NewGetAction("podsecuritypolicies", c.Namespace, name), &extensions.PodSecurityPolicy{})
if obj == nil {
return nil, err
}
return obj.(*extensions.PodSecurityPolicy), err
}
func (c *FakePodSecurityPolicy) Create(psp *extensions.PodSecurityPolicy) (*extensions.PodSecurityPolicy, error) {
obj, err := c.Fake.Invokes(NewCreateAction("podsecuritypolicies", c.Namespace, psp), &extensions.PodSecurityPolicy{})
if obj == nil {
return nil, err
}
return obj.(*extensions.PodSecurityPolicy), err
}
func (c *FakePodSecurityPolicy) Update(psp *extensions.PodSecurityPolicy) (*extensions.PodSecurityPolicy, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("podsecuritypolicies", c.Namespace, psp), &extensions.PodSecurityPolicy{})
if obj == nil {
return nil, err
}
return obj.(*extensions.PodSecurityPolicy), err
}
func (c *FakePodSecurityPolicy) Delete(name string) error {
_, err := c.Fake.Invokes(NewDeleteAction("podsecuritypolicies", c.Namespace, name), &extensions.PodSecurityPolicy{})
return err
}
func (c *FakePodSecurityPolicy) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("podsecuritypolicies", c.Namespace, opts))
}

View file

@ -1,83 +0,0 @@
/*
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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/watch"
)
// FakeReplicaSets implements ReplicaSetsInterface. 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 FakeReplicaSets struct {
Fake *FakeExperimental
Namespace string
}
func (c *FakeReplicaSets) Get(name string) (*extensions.ReplicaSet, error) {
obj, err := c.Fake.Invokes(NewGetAction("replicasets", c.Namespace, name), &extensions.ReplicaSet{})
if obj == nil {
return nil, err
}
return obj.(*extensions.ReplicaSet), err
}
func (c *FakeReplicaSets) List(opts api.ListOptions) (*extensions.ReplicaSetList, error) {
obj, err := c.Fake.Invokes(NewListAction("replicasets", c.Namespace, opts), &extensions.ReplicaSetList{})
if obj == nil {
return nil, err
}
return obj.(*extensions.ReplicaSetList), err
}
func (c *FakeReplicaSets) Create(rs *extensions.ReplicaSet) (*extensions.ReplicaSet, error) {
obj, err := c.Fake.Invokes(NewCreateAction("replicasets", c.Namespace, rs), rs)
if obj == nil {
return nil, err
}
return obj.(*extensions.ReplicaSet), err
}
func (c *FakeReplicaSets) Update(rs *extensions.ReplicaSet) (*extensions.ReplicaSet, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("replicasets", c.Namespace, rs), rs)
if obj == nil {
return nil, err
}
return obj.(*extensions.ReplicaSet), err
}
func (c *FakeReplicaSets) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("replicasets", c.Namespace, name), &extensions.ReplicaSet{})
return err
}
func (c *FakeReplicaSets) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("replicasets", c.Namespace, opts))
}
func (c *FakeReplicaSets) UpdateStatus(rs *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("replicasets", "status", c.Namespace, rs), rs)
if obj == nil {
return nil, err
}
return obj.(*extensions.ReplicaSet), err
}

View file

@ -1,82 +0,0 @@
/*
Copyright 2014 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
// FakeReplicationControllers implements ReplicationControllerInterface. 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 FakeReplicationControllers struct {
Fake *Fake
Namespace string
}
func (c *FakeReplicationControllers) Get(name string) (*api.ReplicationController, error) {
obj, err := c.Fake.Invokes(NewGetAction("replicationcontrollers", c.Namespace, name), &api.ReplicationController{})
if obj == nil {
return nil, err
}
return obj.(*api.ReplicationController), err
}
func (c *FakeReplicationControllers) List(opts api.ListOptions) (*api.ReplicationControllerList, error) {
obj, err := c.Fake.Invokes(NewListAction("replicationcontrollers", c.Namespace, opts), &api.ReplicationControllerList{})
if obj == nil {
return nil, err
}
return obj.(*api.ReplicationControllerList), err
}
func (c *FakeReplicationControllers) Create(controller *api.ReplicationController) (*api.ReplicationController, error) {
obj, err := c.Fake.Invokes(NewCreateAction("replicationcontrollers", c.Namespace, controller), controller)
if obj == nil {
return nil, err
}
return obj.(*api.ReplicationController), err
}
func (c *FakeReplicationControllers) Update(controller *api.ReplicationController) (*api.ReplicationController, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("replicationcontrollers", c.Namespace, controller), controller)
if obj == nil {
return nil, err
}
return obj.(*api.ReplicationController), err
}
func (c *FakeReplicationControllers) UpdateStatus(controller *api.ReplicationController) (*api.ReplicationController, error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("replicationcontrollers", "status", c.Namespace, controller), &api.ReplicationController{})
if obj == nil {
return nil, err
}
return obj.(*api.ReplicationController), err
}
func (c *FakeReplicationControllers) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("replicationcontrollers", c.Namespace, name), &api.ReplicationController{})
return err
}
func (c *FakeReplicationControllers) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("replicationcontrollers", c.Namespace, opts))
}

View file

@ -1,83 +0,0 @@
/*
Copyright 2014 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
// FakeResourceQuotas implements ResourceQuotaInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the methods you want to test easier.
type FakeResourceQuotas struct {
Fake *Fake
Namespace string
}
func (c *FakeResourceQuotas) Get(name string) (*api.ResourceQuota, error) {
obj, err := c.Fake.Invokes(NewGetAction("resourcequotas", c.Namespace, name), &api.ResourceQuota{})
if obj == nil {
return nil, err
}
return obj.(*api.ResourceQuota), err
}
func (c *FakeResourceQuotas) List(opts api.ListOptions) (*api.ResourceQuotaList, error) {
obj, err := c.Fake.Invokes(NewListAction("resourcequotas", c.Namespace, opts), &api.ResourceQuotaList{})
if obj == nil {
return nil, err
}
return obj.(*api.ResourceQuotaList), err
}
func (c *FakeResourceQuotas) Create(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error) {
obj, err := c.Fake.Invokes(NewCreateAction("resourcequotas", c.Namespace, resourceQuota), resourceQuota)
if obj == nil {
return nil, err
}
return obj.(*api.ResourceQuota), err
}
func (c *FakeResourceQuotas) Update(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("resourcequotas", c.Namespace, resourceQuota), resourceQuota)
if obj == nil {
return nil, err
}
return obj.(*api.ResourceQuota), err
}
func (c *FakeResourceQuotas) Delete(name string) error {
_, err := c.Fake.Invokes(NewDeleteAction("resourcequotas", c.Namespace, name), &api.ResourceQuota{})
return err
}
func (c *FakeResourceQuotas) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("resourcequotas", c.Namespace, opts))
}
func (c *FakeResourceQuotas) UpdateStatus(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("resourcequotas", "status", c.Namespace, resourceQuota), resourceQuota)
if obj == nil {
return nil, err
}
return obj.(*api.ResourceQuota), err
}

View file

@ -1,74 +0,0 @@
/*
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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/watch"
)
// FakeRoleBindings implements RoleBindingInterface
type FakeRoleBindings struct {
Fake *FakeRbac
Namespace string
}
func (c *FakeRoleBindings) Get(name string) (*rbac.RoleBinding, error) {
obj, err := c.Fake.Invokes(NewGetAction("rolebindings", c.Namespace, name), &rbac.RoleBinding{})
if obj == nil {
return nil, err
}
return obj.(*rbac.RoleBinding), err
}
func (c *FakeRoleBindings) List(opts api.ListOptions) (*rbac.RoleBindingList, error) {
obj, err := c.Fake.Invokes(NewListAction("rolebindings", c.Namespace, opts), &rbac.RoleBindingList{})
if obj == nil {
return nil, err
}
return obj.(*rbac.RoleBindingList), err
}
func (c *FakeRoleBindings) Create(csr *rbac.RoleBinding) (*rbac.RoleBinding, error) {
obj, err := c.Fake.Invokes(NewCreateAction("rolebindings", c.Namespace, csr), csr)
if obj == nil {
return nil, err
}
return obj.(*rbac.RoleBinding), err
}
func (c *FakeRoleBindings) Update(csr *rbac.RoleBinding) (*rbac.RoleBinding, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("rolebindings", c.Namespace, csr), csr)
if obj == nil {
return nil, err
}
return obj.(*rbac.RoleBinding), err
}
func (c *FakeRoleBindings) Delete(name string, opts *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("rolebindings", c.Namespace, name), &rbac.RoleBinding{})
return err
}
func (c *FakeRoleBindings) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("rolebindings", c.Namespace, opts))
}

View file

@ -1,74 +0,0 @@
/*
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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/watch"
)
// FakeRoles implements RoleInterface
type FakeRoles struct {
Fake *FakeRbac
Namespace string
}
func (c *FakeRoles) Get(name string) (*rbac.Role, error) {
obj, err := c.Fake.Invokes(NewGetAction("roles", c.Namespace, name), &rbac.Role{})
if obj == nil {
return nil, err
}
return obj.(*rbac.Role), err
}
func (c *FakeRoles) List(opts api.ListOptions) (*rbac.RoleList, error) {
obj, err := c.Fake.Invokes(NewListAction("roles", c.Namespace, opts), &rbac.RoleList{})
if obj == nil {
return nil, err
}
return obj.(*rbac.RoleList), err
}
func (c *FakeRoles) Create(csr *rbac.Role) (*rbac.Role, error) {
obj, err := c.Fake.Invokes(NewCreateAction("roles", c.Namespace, csr), csr)
if obj == nil {
return nil, err
}
return obj.(*rbac.Role), err
}
func (c *FakeRoles) Update(csr *rbac.Role) (*rbac.Role, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("roles", c.Namespace, csr), csr)
if obj == nil {
return nil, err
}
return obj.(*rbac.Role), err
}
func (c *FakeRoles) Delete(name string, opts *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("roles", c.Namespace, name), &rbac.Role{})
return err
}
func (c *FakeRoles) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("roles", c.Namespace, opts))
}

View file

@ -1,52 +0,0 @@
/*
Copyright 2015 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 testclient
import (
"k8s.io/kubernetes/pkg/apis/extensions"
)
// FakeScales implements ScaleInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the methods you want to test easier.
type FakeScales struct {
Fake *FakeExperimental
Namespace string
}
func (c *FakeScales) Get(kind string, name string) (result *extensions.Scale, err error) {
action := GetActionImpl{}
action.Verb = "get"
action.Namespace = c.Namespace
action.Resource = kind
action.Subresource = "scale"
action.Name = name
obj, err := c.Fake.Invokes(action, &extensions.Scale{})
result = obj.(*extensions.Scale)
return
}
func (c *FakeScales) Update(kind string, scale *extensions.Scale) (result *extensions.Scale, err error) {
action := UpdateActionImpl{}
action.Verb = "update"
action.Namespace = c.Namespace
action.Resource = kind
action.Subresource = "scale"
action.Object = scale
obj, err := c.Fake.Invokes(action, scale)
result = obj.(*extensions.Scale)
return
}

View file

@ -1,84 +0,0 @@
/*
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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/watch"
)
// FakeScheduledJobs implements ScheduledJobInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the methods you want to test easier.
type FakeScheduledJobs struct {
Fake *FakeBatch
Namespace string
}
func (c *FakeScheduledJobs) Get(name string) (*batch.ScheduledJob, error) {
obj, err := c.Fake.Invokes(NewGetAction("scheduledjobs", c.Namespace, name), &batch.ScheduledJob{})
if obj == nil {
return nil, err
}
return obj.(*batch.ScheduledJob), err
}
func (c *FakeScheduledJobs) List(opts api.ListOptions) (*batch.ScheduledJobList, error) {
obj, err := c.Fake.Invokes(NewListAction("scheduledjobs", c.Namespace, opts), &batch.ScheduledJobList{})
if obj == nil {
return nil, err
}
return obj.(*batch.ScheduledJobList), err
}
func (c *FakeScheduledJobs) Create(scheduledJob *batch.ScheduledJob) (*batch.ScheduledJob, error) {
obj, err := c.Fake.Invokes(NewCreateAction("scheduledjobs", c.Namespace, scheduledJob), scheduledJob)
if obj == nil {
return nil, err
}
return obj.(*batch.ScheduledJob), err
}
func (c *FakeScheduledJobs) Update(scheduledJob *batch.ScheduledJob) (*batch.ScheduledJob, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("scheduledjobs", c.Namespace, scheduledJob), scheduledJob)
if obj == nil {
return nil, err
}
return obj.(*batch.ScheduledJob), err
}
func (c *FakeScheduledJobs) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("scheduledjobs", c.Namespace, name), &batch.ScheduledJob{})
return err
}
func (c *FakeScheduledJobs) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("scheduledjobs", c.Namespace, opts))
}
func (c *FakeScheduledJobs) UpdateStatus(scheduledJob *batch.ScheduledJob) (result *batch.ScheduledJob, err error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("scheduledjobs", "status", c.Namespace, scheduledJob), scheduledJob)
if obj == nil {
return nil, err
}
return obj.(*batch.ScheduledJob), err
}

View file

@ -1,74 +0,0 @@
/*
Copyright 2014 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
// Fake implements SecretInterface. 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 FakeSecrets struct {
Fake *Fake
Namespace string
}
func (c *FakeSecrets) Get(name string) (*api.Secret, error) {
obj, err := c.Fake.Invokes(NewGetAction("secrets", c.Namespace, name), &api.Secret{})
if obj == nil {
return nil, err
}
return obj.(*api.Secret), err
}
func (c *FakeSecrets) List(opts api.ListOptions) (*api.SecretList, error) {
obj, err := c.Fake.Invokes(NewListAction("secrets", c.Namespace, opts), &api.SecretList{})
if obj == nil {
return nil, err
}
return obj.(*api.SecretList), err
}
func (c *FakeSecrets) Create(secret *api.Secret) (*api.Secret, error) {
obj, err := c.Fake.Invokes(NewCreateAction("secrets", c.Namespace, secret), secret)
if obj == nil {
return nil, err
}
return obj.(*api.Secret), err
}
func (c *FakeSecrets) Update(secret *api.Secret) (*api.Secret, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("secrets", c.Namespace, secret), secret)
if obj == nil {
return nil, err
}
return obj.(*api.Secret), err
}
func (c *FakeSecrets) Delete(name string) error {
_, err := c.Fake.Invokes(NewDeleteAction("secrets", c.Namespace, name), &api.Secret{})
return err
}
func (c *FakeSecrets) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("secrets", c.Namespace, opts))
}

View file

@ -1,74 +0,0 @@
/*
Copyright 2014 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
)
// FakeServiceAccounts implements ServiceAccountsInterface. 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 FakeServiceAccounts struct {
Fake *Fake
Namespace string
}
func (c *FakeServiceAccounts) Get(name string) (*api.ServiceAccount, error) {
obj, err := c.Fake.Invokes(NewGetAction("serviceaccounts", c.Namespace, name), &api.ServiceAccount{})
if obj == nil {
return nil, err
}
return obj.(*api.ServiceAccount), err
}
func (c *FakeServiceAccounts) List(opts api.ListOptions) (*api.ServiceAccountList, error) {
obj, err := c.Fake.Invokes(NewListAction("serviceaccounts", c.Namespace, opts), &api.ServiceAccountList{})
if obj == nil {
return nil, err
}
return obj.(*api.ServiceAccountList), err
}
func (c *FakeServiceAccounts) Create(serviceAccount *api.ServiceAccount) (*api.ServiceAccount, error) {
obj, err := c.Fake.Invokes(NewCreateAction("serviceaccounts", c.Namespace, serviceAccount), serviceAccount)
if obj == nil {
return nil, err
}
return obj.(*api.ServiceAccount), err
}
func (c *FakeServiceAccounts) Update(serviceAccount *api.ServiceAccount) (*api.ServiceAccount, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("serviceaccounts", c.Namespace, serviceAccount), serviceAccount)
if obj == nil {
return nil, err
}
return obj.(*api.ServiceAccount), err
}
func (c *FakeServiceAccounts) Delete(name string) error {
_, err := c.Fake.Invokes(NewDeleteAction("serviceaccounts", c.Namespace, name), &api.ServiceAccount{})
return err
}
func (c *FakeServiceAccounts) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("serviceaccounts", c.Namespace, opts))
}

View file

@ -1,88 +0,0 @@
/*
Copyright 2014 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 testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/watch"
)
// Fake implements ServiceInterface. 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 FakeServices struct {
Fake *Fake
Namespace string
}
func (c *FakeServices) Get(name string) (*api.Service, error) {
obj, err := c.Fake.Invokes(NewGetAction("services", c.Namespace, name), &api.Service{})
if obj == nil {
return nil, err
}
return obj.(*api.Service), err
}
func (c *FakeServices) List(opts api.ListOptions) (*api.ServiceList, error) {
obj, err := c.Fake.Invokes(NewListAction("services", c.Namespace, opts), &api.ServiceList{})
if obj == nil {
return nil, err
}
return obj.(*api.ServiceList), err
}
func (c *FakeServices) Create(service *api.Service) (*api.Service, error) {
obj, err := c.Fake.Invokes(NewCreateAction("services", c.Namespace, service), service)
if obj == nil {
return nil, err
}
return obj.(*api.Service), err
}
func (c *FakeServices) Update(service *api.Service) (*api.Service, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("services", c.Namespace, service), service)
if obj == nil {
return nil, err
}
return obj.(*api.Service), err
}
func (c *FakeServices) UpdateStatus(service *api.Service) (result *api.Service, err error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("services", "status", c.Namespace, service), service)
if obj == nil {
return nil, err
}
return obj.(*api.Service), err
}
func (c *FakeServices) Delete(name string) error {
_, err := c.Fake.Invokes(NewDeleteAction("services", c.Namespace, name), &api.Service{})
return err
}
func (c *FakeServices) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("services", c.Namespace, opts))
}
func (c *FakeServices) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper {
return c.Fake.InvokesProxy(NewProxyGetAction("services", c.Namespace, scheme, name, port, path, params))
}

Some files were not shown because too many files have changed in this diff Show more