diff --git a/build/codegen/codegen.sh b/build/codegen/codegen.sh index e9a5aa95d..1806ee1b0 100755 --- a/build/codegen/codegen.sh +++ b/build/codegen/codegen.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env -S bash -e +#!/usr/bin/env bash # Copyright 2018 The Rook Authors. All rights reserved. # @@ -14,29 +14,33 @@ # See the License for the specific language governing permissions and # limitations under the License. -GROUP_VERSIONS="ceph.rook.io:v1" +set -o errexit +set -o nounset +set -o pipefail -scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# CODE GENERATION -# we run deepcopy and client,lister,informer generations separately so we can use the flag "--plural-exceptions" -# which is only known by client,lister,informer binary and not the deepcopy binary +base_dir="$(cd "${script_dir}/../.." && pwd)" -# run code deepcopy generation -bash ${CODE_GENERATOR}/generate-groups.sh \ - deepcopy \ - github.com/rook/rook/pkg/client \ - github.com/rook/rook/pkg/apis \ - "${GROUP_VERSIONS}" \ - --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../../.." \ - --go-header-file "${scriptdir}/boilerplate.go.txt" +boilerplate="${base_dir}"/build/codegen/header.txt -# run code client,lister,informer generation -bash ${CODE_GENERATOR}/generate-groups.sh \ - client,lister,informer \ - github.com/rook/rook/pkg/client \ - github.com/rook/rook/pkg/apis \ - "${GROUP_VERSIONS}" \ - --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../../.." \ - --go-header-file "${scriptdir}/boilerplate.go.txt" \ - --plural-exceptions "CephNFS:CephNFSes" \ +source "${CODE_GENERATOR}/kube_codegen.sh" +( + # because apis is a separate go module, code generation + # must be run from within the corresponding directory. + cd ${base_dir}/pkg/apis + + # run code deepcopy generation + kube::codegen::gen_helpers \ + --boilerplate "${boilerplate}" \ + "${base_dir}/pkg/apis" \ + + # run code client,lister,informer generation + kube::codegen::gen_client \ + --output-dir "${base_dir}/pkg/client" \ + --output-pkg "github.com/rook/rook/pkg/client" \ + --boilerplate "${boilerplate}" \ + --plural-exceptions "CephNFS:CephNFSes" \ + --with-watch \ + "${base_dir}/pkg/apis" +) diff --git a/build/makelib/golang.mk b/build/makelib/golang.mk index 44814e2b5..ec820e1f9 100644 --- a/build/makelib/golang.mk +++ b/build/makelib/golang.mk @@ -231,7 +231,7 @@ $(YQ): @curl -JL https://github.com/mikefarah/yq/releases/download/$(YQ_VERSION)/yq_$(REAL_HOST_PLATFORM) -o $(YQ) @chmod +x $(YQ) -export CODE_GENERATOR_VERSION=0.20.0 +export CODE_GENERATOR_VERSION=0.31.3 export CODE_GENERATOR=$(TOOLS_HOST_DIR)/code-generator-$(CODE_GENERATOR_VERSION) $(CODE_GENERATOR): mkdir -p $(TOOLS_HOST_DIR) diff --git a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go index 92e443c3e..a0f659adc 100644 --- a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go @@ -2,13 +2,13 @@ // +build !ignore_autogenerated /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 642259576..6134f9832 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,6 +20,7 @@ package versioned import ( "fmt" + "net/http" cephv1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/ceph.rook.io/v1" discovery "k8s.io/client-go/discovery" @@ -32,8 +33,7 @@ type Interface interface { CephV1() cephv1.CephV1Interface } -// Clientset contains the clients for groups. Each group has exactly one -// version included in a Clientset. +// Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient cephV1 *cephv1.CephV1Client @@ -55,22 +55,45 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface { // NewForConfig creates a new Clientset for the given config. // If config's RateLimiter is not set and QPS and Burst are acceptable, // NewForConfig will generate a rate-limiter in configShallowCopy. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). func NewForConfig(c *rest.Config) (*Clientset, error) { configShallowCopy := *c + + if configShallowCopy.UserAgent == "" { + configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() + } + + // share the transport between all clients + httpClient, err := rest.HTTPClientFor(&configShallowCopy) + if err != nil { + return nil, err + } + + return NewForConfigAndClient(&configShallowCopy, httpClient) +} + +// NewForConfigAndClient creates a new Clientset for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. +func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { + configShallowCopy := *c if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.Burst <= 0 { return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") } configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) } + var cs Clientset var err error - cs.cephV1, err = cephv1.NewForConfig(&configShallowCopy) + cs.cephV1, err = cephv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } - cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } @@ -80,11 +103,11 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { // NewForConfigOrDie creates a new Clientset for the given config and // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { - var cs Clientset - cs.cephV1 = cephv1.NewForConfigOrDie(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) - return &cs + cs, err := NewForConfig(c) + if err != nil { + panic(err) + } + return cs } // New creates a new Clientset for the given RESTClient. diff --git a/pkg/client/clientset/versioned/doc.go b/pkg/client/clientset/versioned/doc.go deleted file mode 100644 index 41721ca52..000000000 --- a/pkg/client/clientset/versioned/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index a4718f8a3..9d6ccb089 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -31,8 +31,12 @@ import ( // NewSimpleClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. +// +// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves +// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. +// via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { @@ -74,7 +78,10 @@ func (c *Clientset) Tracker() testing.ObjectTracker { return c.tracker } -var _ clientset.Interface = &Clientset{} +var ( + _ clientset.Interface = &Clientset{} + _ testing.FakeClient = &Clientset{} +) // CephV1 retrieves the CephV1Client func (c *Clientset) CephV1() cephv1.CephV1Interface { diff --git a/pkg/client/clientset/versioned/fake/doc.go b/pkg/client/clientset/versioned/fake/doc.go index 9b99e7167..99fb5c02f 100644 --- a/pkg/client/clientset/versioned/fake/doc.go +++ b/pkg/client/clientset/versioned/fake/doc.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 22f7a1009..40da89b4b 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/clientset/versioned/scheme/doc.go b/pkg/client/clientset/versioned/scheme/doc.go index 7dc375616..7051058f6 100644 --- a/pkg/client/clientset/versioned/scheme/doc.go +++ b/pkg/client/clientset/versioned/scheme/doc.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 8f2fcea75..20b9f5be5 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/ceph.rook.io_client.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/ceph.rook.io_client.go index 59f25fd0d..d63bd3e1b 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/ceph.rook.io_client.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/ceph.rook.io_client.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -19,6 +19,8 @@ limitations under the License. package v1 import ( + "net/http" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" "github.com/rook/rook/pkg/client/clientset/versioned/scheme" rest "k8s.io/client-go/rest" @@ -119,12 +121,28 @@ func (c *CephV1Client) CephRBDMirrors(namespace string) CephRBDMirrorInterface { } // NewForConfig creates a new CephV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). func NewForConfig(c *rest.Config) (*CephV1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } - client, err := rest.RESTClientFor(&config) + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new CephV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*CephV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) if err != nil { return nil, err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephblockpool.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephblockpool.go index b222f65fd..cb7065dbd 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephblockpool.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephblockpool.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephBlockPoolsGetter has a method to return a CephBlockPoolInterface. @@ -51,128 +50,18 @@ type CephBlockPoolInterface interface { // cephBlockPools implements CephBlockPoolInterface type cephBlockPools struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephBlockPool, *v1.CephBlockPoolList] } // newCephBlockPools returns a CephBlockPools func newCephBlockPools(c *CephV1Client, namespace string) *cephBlockPools { return &cephBlockPools{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephBlockPool, *v1.CephBlockPoolList]( + "cephblockpools", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephBlockPool { return &v1.CephBlockPool{} }, + func() *v1.CephBlockPoolList { return &v1.CephBlockPoolList{} }), } } - -// Get takes name of the cephBlockPool, and returns the corresponding cephBlockPool object, and an error if there is any. -func (c *cephBlockPools) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephBlockPool, err error) { - result = &v1.CephBlockPool{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephblockpools"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephBlockPools that match those selectors. -func (c *cephBlockPools) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephBlockPoolList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephBlockPoolList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephblockpools"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephBlockPools. -func (c *cephBlockPools) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephblockpools"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephBlockPool and creates it. Returns the server's representation of the cephBlockPool, and an error, if there is any. -func (c *cephBlockPools) Create(ctx context.Context, cephBlockPool *v1.CephBlockPool, opts metav1.CreateOptions) (result *v1.CephBlockPool, err error) { - result = &v1.CephBlockPool{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephblockpools"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephBlockPool). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephBlockPool and updates it. Returns the server's representation of the cephBlockPool, and an error, if there is any. -func (c *cephBlockPools) Update(ctx context.Context, cephBlockPool *v1.CephBlockPool, opts metav1.UpdateOptions) (result *v1.CephBlockPool, err error) { - result = &v1.CephBlockPool{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephblockpools"). - Name(cephBlockPool.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephBlockPool). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephBlockPool and deletes it. Returns an error if one occurs. -func (c *cephBlockPools) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephblockpools"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephBlockPools) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephblockpools"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephBlockPool. -func (c *cephBlockPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephBlockPool, err error) { - result = &v1.CephBlockPool{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephblockpools"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephblockpoolradosnamespace.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephblockpoolradosnamespace.go index 0883cb40b..29f0580b7 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephblockpoolradosnamespace.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephblockpoolradosnamespace.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephBlockPoolRadosNamespacesGetter has a method to return a CephBlockPoolRadosNamespaceInterface. @@ -51,128 +50,18 @@ type CephBlockPoolRadosNamespaceInterface interface { // cephBlockPoolRadosNamespaces implements CephBlockPoolRadosNamespaceInterface type cephBlockPoolRadosNamespaces struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephBlockPoolRadosNamespace, *v1.CephBlockPoolRadosNamespaceList] } // newCephBlockPoolRadosNamespaces returns a CephBlockPoolRadosNamespaces func newCephBlockPoolRadosNamespaces(c *CephV1Client, namespace string) *cephBlockPoolRadosNamespaces { return &cephBlockPoolRadosNamespaces{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephBlockPoolRadosNamespace, *v1.CephBlockPoolRadosNamespaceList]( + "cephblockpoolradosnamespaces", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephBlockPoolRadosNamespace { return &v1.CephBlockPoolRadosNamespace{} }, + func() *v1.CephBlockPoolRadosNamespaceList { return &v1.CephBlockPoolRadosNamespaceList{} }), } } - -// Get takes name of the cephBlockPoolRadosNamespace, and returns the corresponding cephBlockPoolRadosNamespace object, and an error if there is any. -func (c *cephBlockPoolRadosNamespaces) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephBlockPoolRadosNamespace, err error) { - result = &v1.CephBlockPoolRadosNamespace{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephblockpoolradosnamespaces"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephBlockPoolRadosNamespaces that match those selectors. -func (c *cephBlockPoolRadosNamespaces) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephBlockPoolRadosNamespaceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephBlockPoolRadosNamespaceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephblockpoolradosnamespaces"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephBlockPoolRadosNamespaces. -func (c *cephBlockPoolRadosNamespaces) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephblockpoolradosnamespaces"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephBlockPoolRadosNamespace and creates it. Returns the server's representation of the cephBlockPoolRadosNamespace, and an error, if there is any. -func (c *cephBlockPoolRadosNamespaces) Create(ctx context.Context, cephBlockPoolRadosNamespace *v1.CephBlockPoolRadosNamespace, opts metav1.CreateOptions) (result *v1.CephBlockPoolRadosNamespace, err error) { - result = &v1.CephBlockPoolRadosNamespace{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephblockpoolradosnamespaces"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephBlockPoolRadosNamespace). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephBlockPoolRadosNamespace and updates it. Returns the server's representation of the cephBlockPoolRadosNamespace, and an error, if there is any. -func (c *cephBlockPoolRadosNamespaces) Update(ctx context.Context, cephBlockPoolRadosNamespace *v1.CephBlockPoolRadosNamespace, opts metav1.UpdateOptions) (result *v1.CephBlockPoolRadosNamespace, err error) { - result = &v1.CephBlockPoolRadosNamespace{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephblockpoolradosnamespaces"). - Name(cephBlockPoolRadosNamespace.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephBlockPoolRadosNamespace). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephBlockPoolRadosNamespace and deletes it. Returns an error if one occurs. -func (c *cephBlockPoolRadosNamespaces) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephblockpoolradosnamespaces"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephBlockPoolRadosNamespaces) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephblockpoolradosnamespaces"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephBlockPoolRadosNamespace. -func (c *cephBlockPoolRadosNamespaces) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephBlockPoolRadosNamespace, err error) { - result = &v1.CephBlockPoolRadosNamespace{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephblockpoolradosnamespaces"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephbucketnotification.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephbucketnotification.go index 37e9dd77e..a3afffac0 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephbucketnotification.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephbucketnotification.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephBucketNotificationsGetter has a method to return a CephBucketNotificationInterface. @@ -51,128 +50,18 @@ type CephBucketNotificationInterface interface { // cephBucketNotifications implements CephBucketNotificationInterface type cephBucketNotifications struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephBucketNotification, *v1.CephBucketNotificationList] } // newCephBucketNotifications returns a CephBucketNotifications func newCephBucketNotifications(c *CephV1Client, namespace string) *cephBucketNotifications { return &cephBucketNotifications{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephBucketNotification, *v1.CephBucketNotificationList]( + "cephbucketnotifications", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephBucketNotification { return &v1.CephBucketNotification{} }, + func() *v1.CephBucketNotificationList { return &v1.CephBucketNotificationList{} }), } } - -// Get takes name of the cephBucketNotification, and returns the corresponding cephBucketNotification object, and an error if there is any. -func (c *cephBucketNotifications) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephBucketNotification, err error) { - result = &v1.CephBucketNotification{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephbucketnotifications"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephBucketNotifications that match those selectors. -func (c *cephBucketNotifications) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephBucketNotificationList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephBucketNotificationList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephbucketnotifications"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephBucketNotifications. -func (c *cephBucketNotifications) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephbucketnotifications"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephBucketNotification and creates it. Returns the server's representation of the cephBucketNotification, and an error, if there is any. -func (c *cephBucketNotifications) Create(ctx context.Context, cephBucketNotification *v1.CephBucketNotification, opts metav1.CreateOptions) (result *v1.CephBucketNotification, err error) { - result = &v1.CephBucketNotification{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephbucketnotifications"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephBucketNotification). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephBucketNotification and updates it. Returns the server's representation of the cephBucketNotification, and an error, if there is any. -func (c *cephBucketNotifications) Update(ctx context.Context, cephBucketNotification *v1.CephBucketNotification, opts metav1.UpdateOptions) (result *v1.CephBucketNotification, err error) { - result = &v1.CephBucketNotification{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephbucketnotifications"). - Name(cephBucketNotification.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephBucketNotification). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephBucketNotification and deletes it. Returns an error if one occurs. -func (c *cephBucketNotifications) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephbucketnotifications"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephBucketNotifications) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephbucketnotifications"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephBucketNotification. -func (c *cephBucketNotifications) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephBucketNotification, err error) { - result = &v1.CephBucketNotification{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephbucketnotifications"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephbuckettopic.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephbuckettopic.go index 89ab7cd9b..0f16b8538 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephbuckettopic.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephbuckettopic.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephBucketTopicsGetter has a method to return a CephBucketTopicInterface. @@ -51,128 +50,18 @@ type CephBucketTopicInterface interface { // cephBucketTopics implements CephBucketTopicInterface type cephBucketTopics struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephBucketTopic, *v1.CephBucketTopicList] } // newCephBucketTopics returns a CephBucketTopics func newCephBucketTopics(c *CephV1Client, namespace string) *cephBucketTopics { return &cephBucketTopics{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephBucketTopic, *v1.CephBucketTopicList]( + "cephbuckettopics", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephBucketTopic { return &v1.CephBucketTopic{} }, + func() *v1.CephBucketTopicList { return &v1.CephBucketTopicList{} }), } } - -// Get takes name of the cephBucketTopic, and returns the corresponding cephBucketTopic object, and an error if there is any. -func (c *cephBucketTopics) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephBucketTopic, err error) { - result = &v1.CephBucketTopic{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephbuckettopics"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephBucketTopics that match those selectors. -func (c *cephBucketTopics) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephBucketTopicList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephBucketTopicList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephbuckettopics"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephBucketTopics. -func (c *cephBucketTopics) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephbuckettopics"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephBucketTopic and creates it. Returns the server's representation of the cephBucketTopic, and an error, if there is any. -func (c *cephBucketTopics) Create(ctx context.Context, cephBucketTopic *v1.CephBucketTopic, opts metav1.CreateOptions) (result *v1.CephBucketTopic, err error) { - result = &v1.CephBucketTopic{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephbuckettopics"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephBucketTopic). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephBucketTopic and updates it. Returns the server's representation of the cephBucketTopic, and an error, if there is any. -func (c *cephBucketTopics) Update(ctx context.Context, cephBucketTopic *v1.CephBucketTopic, opts metav1.UpdateOptions) (result *v1.CephBucketTopic, err error) { - result = &v1.CephBucketTopic{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephbuckettopics"). - Name(cephBucketTopic.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephBucketTopic). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephBucketTopic and deletes it. Returns an error if one occurs. -func (c *cephBucketTopics) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephbuckettopics"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephBucketTopics) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephbuckettopics"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephBucketTopic. -func (c *cephBucketTopics) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephBucketTopic, err error) { - result = &v1.CephBucketTopic{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephbuckettopics"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephclient.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephclient.go index db45d7ef0..ab52e3fff 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephclient.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephclient.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephClientsGetter has a method to return a CephClientInterface. @@ -51,128 +50,18 @@ type CephClientInterface interface { // cephClients implements CephClientInterface type cephClients struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephClient, *v1.CephClientList] } // newCephClients returns a CephClients func newCephClients(c *CephV1Client, namespace string) *cephClients { return &cephClients{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephClient, *v1.CephClientList]( + "cephclients", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephClient { return &v1.CephClient{} }, + func() *v1.CephClientList { return &v1.CephClientList{} }), } } - -// Get takes name of the cephClient, and returns the corresponding cephClient object, and an error if there is any. -func (c *cephClients) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephClient, err error) { - result = &v1.CephClient{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephclients"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephClients that match those selectors. -func (c *cephClients) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephClientList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephClientList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephclients"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephClients. -func (c *cephClients) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephclients"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephClient and creates it. Returns the server's representation of the cephClient, and an error, if there is any. -func (c *cephClients) Create(ctx context.Context, cephClient *v1.CephClient, opts metav1.CreateOptions) (result *v1.CephClient, err error) { - result = &v1.CephClient{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephclients"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephClient). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephClient and updates it. Returns the server's representation of the cephClient, and an error, if there is any. -func (c *cephClients) Update(ctx context.Context, cephClient *v1.CephClient, opts metav1.UpdateOptions) (result *v1.CephClient, err error) { - result = &v1.CephClient{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephclients"). - Name(cephClient.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephClient). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephClient and deletes it. Returns an error if one occurs. -func (c *cephClients) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephclients"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephClients) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephclients"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephClient. -func (c *cephClients) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephClient, err error) { - result = &v1.CephClient{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephclients"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephcluster.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephcluster.go index 7ebe4e2c9..a310a090d 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephcluster.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephcluster.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephClustersGetter has a method to return a CephClusterInterface. @@ -51,128 +50,18 @@ type CephClusterInterface interface { // cephClusters implements CephClusterInterface type cephClusters struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephCluster, *v1.CephClusterList] } // newCephClusters returns a CephClusters func newCephClusters(c *CephV1Client, namespace string) *cephClusters { return &cephClusters{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephCluster, *v1.CephClusterList]( + "cephclusters", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephCluster { return &v1.CephCluster{} }, + func() *v1.CephClusterList { return &v1.CephClusterList{} }), } } - -// Get takes name of the cephCluster, and returns the corresponding cephCluster object, and an error if there is any. -func (c *cephClusters) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephCluster, err error) { - result = &v1.CephCluster{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephclusters"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephClusters that match those selectors. -func (c *cephClusters) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephClusterList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephClusterList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephclusters"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephClusters. -func (c *cephClusters) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephclusters"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephCluster and creates it. Returns the server's representation of the cephCluster, and an error, if there is any. -func (c *cephClusters) Create(ctx context.Context, cephCluster *v1.CephCluster, opts metav1.CreateOptions) (result *v1.CephCluster, err error) { - result = &v1.CephCluster{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephclusters"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephCluster). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephCluster and updates it. Returns the server's representation of the cephCluster, and an error, if there is any. -func (c *cephClusters) Update(ctx context.Context, cephCluster *v1.CephCluster, opts metav1.UpdateOptions) (result *v1.CephCluster, err error) { - result = &v1.CephCluster{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephclusters"). - Name(cephCluster.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephCluster). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephCluster and deletes it. Returns an error if one occurs. -func (c *cephClusters) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephclusters"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephClusters) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephclusters"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephCluster. -func (c *cephClusters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephCluster, err error) { - result = &v1.CephCluster{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephclusters"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephcosidriver.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephcosidriver.go index 7e084f521..1f291e600 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephcosidriver.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephcosidriver.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephCOSIDriversGetter has a method to return a CephCOSIDriverInterface. @@ -51,128 +50,18 @@ type CephCOSIDriverInterface interface { // cephCOSIDrivers implements CephCOSIDriverInterface type cephCOSIDrivers struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephCOSIDriver, *v1.CephCOSIDriverList] } // newCephCOSIDrivers returns a CephCOSIDrivers func newCephCOSIDrivers(c *CephV1Client, namespace string) *cephCOSIDrivers { return &cephCOSIDrivers{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephCOSIDriver, *v1.CephCOSIDriverList]( + "cephcosidrivers", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephCOSIDriver { return &v1.CephCOSIDriver{} }, + func() *v1.CephCOSIDriverList { return &v1.CephCOSIDriverList{} }), } } - -// Get takes name of the cephCOSIDriver, and returns the corresponding cephCOSIDriver object, and an error if there is any. -func (c *cephCOSIDrivers) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephCOSIDriver, err error) { - result = &v1.CephCOSIDriver{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephcosidrivers"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephCOSIDrivers that match those selectors. -func (c *cephCOSIDrivers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephCOSIDriverList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephCOSIDriverList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephcosidrivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephCOSIDrivers. -func (c *cephCOSIDrivers) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephcosidrivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephCOSIDriver and creates it. Returns the server's representation of the cephCOSIDriver, and an error, if there is any. -func (c *cephCOSIDrivers) Create(ctx context.Context, cephCOSIDriver *v1.CephCOSIDriver, opts metav1.CreateOptions) (result *v1.CephCOSIDriver, err error) { - result = &v1.CephCOSIDriver{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephcosidrivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephCOSIDriver). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephCOSIDriver and updates it. Returns the server's representation of the cephCOSIDriver, and an error, if there is any. -func (c *cephCOSIDrivers) Update(ctx context.Context, cephCOSIDriver *v1.CephCOSIDriver, opts metav1.UpdateOptions) (result *v1.CephCOSIDriver, err error) { - result = &v1.CephCOSIDriver{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephcosidrivers"). - Name(cephCOSIDriver.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephCOSIDriver). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephCOSIDriver and deletes it. Returns an error if one occurs. -func (c *cephCOSIDrivers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephcosidrivers"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephCOSIDrivers) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephcosidrivers"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephCOSIDriver. -func (c *cephCOSIDrivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephCOSIDriver, err error) { - result = &v1.CephCOSIDriver{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephcosidrivers"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephfilesystem.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephfilesystem.go index 1dccce1ef..1197dc8d6 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephfilesystem.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephfilesystem.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephFilesystemsGetter has a method to return a CephFilesystemInterface. @@ -51,128 +50,18 @@ type CephFilesystemInterface interface { // cephFilesystems implements CephFilesystemInterface type cephFilesystems struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephFilesystem, *v1.CephFilesystemList] } // newCephFilesystems returns a CephFilesystems func newCephFilesystems(c *CephV1Client, namespace string) *cephFilesystems { return &cephFilesystems{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephFilesystem, *v1.CephFilesystemList]( + "cephfilesystems", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephFilesystem { return &v1.CephFilesystem{} }, + func() *v1.CephFilesystemList { return &v1.CephFilesystemList{} }), } } - -// Get takes name of the cephFilesystem, and returns the corresponding cephFilesystem object, and an error if there is any. -func (c *cephFilesystems) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephFilesystem, err error) { - result = &v1.CephFilesystem{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephfilesystems"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephFilesystems that match those selectors. -func (c *cephFilesystems) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephFilesystemList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephFilesystemList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephfilesystems"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephFilesystems. -func (c *cephFilesystems) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephfilesystems"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephFilesystem and creates it. Returns the server's representation of the cephFilesystem, and an error, if there is any. -func (c *cephFilesystems) Create(ctx context.Context, cephFilesystem *v1.CephFilesystem, opts metav1.CreateOptions) (result *v1.CephFilesystem, err error) { - result = &v1.CephFilesystem{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephfilesystems"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephFilesystem). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephFilesystem and updates it. Returns the server's representation of the cephFilesystem, and an error, if there is any. -func (c *cephFilesystems) Update(ctx context.Context, cephFilesystem *v1.CephFilesystem, opts metav1.UpdateOptions) (result *v1.CephFilesystem, err error) { - result = &v1.CephFilesystem{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephfilesystems"). - Name(cephFilesystem.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephFilesystem). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephFilesystem and deletes it. Returns an error if one occurs. -func (c *cephFilesystems) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephfilesystems"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephFilesystems) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephfilesystems"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephFilesystem. -func (c *cephFilesystems) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephFilesystem, err error) { - result = &v1.CephFilesystem{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephfilesystems"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephfilesystemmirror.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephfilesystemmirror.go index 867b42f09..06765ca32 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephfilesystemmirror.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephfilesystemmirror.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephFilesystemMirrorsGetter has a method to return a CephFilesystemMirrorInterface. @@ -51,128 +50,18 @@ type CephFilesystemMirrorInterface interface { // cephFilesystemMirrors implements CephFilesystemMirrorInterface type cephFilesystemMirrors struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephFilesystemMirror, *v1.CephFilesystemMirrorList] } // newCephFilesystemMirrors returns a CephFilesystemMirrors func newCephFilesystemMirrors(c *CephV1Client, namespace string) *cephFilesystemMirrors { return &cephFilesystemMirrors{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephFilesystemMirror, *v1.CephFilesystemMirrorList]( + "cephfilesystemmirrors", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephFilesystemMirror { return &v1.CephFilesystemMirror{} }, + func() *v1.CephFilesystemMirrorList { return &v1.CephFilesystemMirrorList{} }), } } - -// Get takes name of the cephFilesystemMirror, and returns the corresponding cephFilesystemMirror object, and an error if there is any. -func (c *cephFilesystemMirrors) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephFilesystemMirror, err error) { - result = &v1.CephFilesystemMirror{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephfilesystemmirrors"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephFilesystemMirrors that match those selectors. -func (c *cephFilesystemMirrors) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephFilesystemMirrorList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephFilesystemMirrorList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephfilesystemmirrors"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephFilesystemMirrors. -func (c *cephFilesystemMirrors) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephfilesystemmirrors"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephFilesystemMirror and creates it. Returns the server's representation of the cephFilesystemMirror, and an error, if there is any. -func (c *cephFilesystemMirrors) Create(ctx context.Context, cephFilesystemMirror *v1.CephFilesystemMirror, opts metav1.CreateOptions) (result *v1.CephFilesystemMirror, err error) { - result = &v1.CephFilesystemMirror{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephfilesystemmirrors"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephFilesystemMirror). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephFilesystemMirror and updates it. Returns the server's representation of the cephFilesystemMirror, and an error, if there is any. -func (c *cephFilesystemMirrors) Update(ctx context.Context, cephFilesystemMirror *v1.CephFilesystemMirror, opts metav1.UpdateOptions) (result *v1.CephFilesystemMirror, err error) { - result = &v1.CephFilesystemMirror{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephfilesystemmirrors"). - Name(cephFilesystemMirror.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephFilesystemMirror). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephFilesystemMirror and deletes it. Returns an error if one occurs. -func (c *cephFilesystemMirrors) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephfilesystemmirrors"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephFilesystemMirrors) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephfilesystemmirrors"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephFilesystemMirror. -func (c *cephFilesystemMirrors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephFilesystemMirror, err error) { - result = &v1.CephFilesystemMirror{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephfilesystemmirrors"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephfilesystemsubvolumegroup.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephfilesystemsubvolumegroup.go index 80a66e56a..6063c72f9 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephfilesystemsubvolumegroup.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephfilesystemsubvolumegroup.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephFilesystemSubVolumeGroupsGetter has a method to return a CephFilesystemSubVolumeGroupInterface. @@ -51,128 +50,18 @@ type CephFilesystemSubVolumeGroupInterface interface { // cephFilesystemSubVolumeGroups implements CephFilesystemSubVolumeGroupInterface type cephFilesystemSubVolumeGroups struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephFilesystemSubVolumeGroup, *v1.CephFilesystemSubVolumeGroupList] } // newCephFilesystemSubVolumeGroups returns a CephFilesystemSubVolumeGroups func newCephFilesystemSubVolumeGroups(c *CephV1Client, namespace string) *cephFilesystemSubVolumeGroups { return &cephFilesystemSubVolumeGroups{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephFilesystemSubVolumeGroup, *v1.CephFilesystemSubVolumeGroupList]( + "cephfilesystemsubvolumegroups", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephFilesystemSubVolumeGroup { return &v1.CephFilesystemSubVolumeGroup{} }, + func() *v1.CephFilesystemSubVolumeGroupList { return &v1.CephFilesystemSubVolumeGroupList{} }), } } - -// Get takes name of the cephFilesystemSubVolumeGroup, and returns the corresponding cephFilesystemSubVolumeGroup object, and an error if there is any. -func (c *cephFilesystemSubVolumeGroups) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephFilesystemSubVolumeGroup, err error) { - result = &v1.CephFilesystemSubVolumeGroup{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephfilesystemsubvolumegroups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephFilesystemSubVolumeGroups that match those selectors. -func (c *cephFilesystemSubVolumeGroups) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephFilesystemSubVolumeGroupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephFilesystemSubVolumeGroupList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephfilesystemsubvolumegroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephFilesystemSubVolumeGroups. -func (c *cephFilesystemSubVolumeGroups) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephfilesystemsubvolumegroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephFilesystemSubVolumeGroup and creates it. Returns the server's representation of the cephFilesystemSubVolumeGroup, and an error, if there is any. -func (c *cephFilesystemSubVolumeGroups) Create(ctx context.Context, cephFilesystemSubVolumeGroup *v1.CephFilesystemSubVolumeGroup, opts metav1.CreateOptions) (result *v1.CephFilesystemSubVolumeGroup, err error) { - result = &v1.CephFilesystemSubVolumeGroup{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephfilesystemsubvolumegroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephFilesystemSubVolumeGroup). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephFilesystemSubVolumeGroup and updates it. Returns the server's representation of the cephFilesystemSubVolumeGroup, and an error, if there is any. -func (c *cephFilesystemSubVolumeGroups) Update(ctx context.Context, cephFilesystemSubVolumeGroup *v1.CephFilesystemSubVolumeGroup, opts metav1.UpdateOptions) (result *v1.CephFilesystemSubVolumeGroup, err error) { - result = &v1.CephFilesystemSubVolumeGroup{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephfilesystemsubvolumegroups"). - Name(cephFilesystemSubVolumeGroup.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephFilesystemSubVolumeGroup). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephFilesystemSubVolumeGroup and deletes it. Returns an error if one occurs. -func (c *cephFilesystemSubVolumeGroups) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephfilesystemsubvolumegroups"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephFilesystemSubVolumeGroups) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephfilesystemsubvolumegroups"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephFilesystemSubVolumeGroup. -func (c *cephFilesystemSubVolumeGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephFilesystemSubVolumeGroup, err error) { - result = &v1.CephFilesystemSubVolumeGroup{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephfilesystemsubvolumegroups"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephnfs.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephnfs.go index bc4351654..35b44facf 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephnfs.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephnfs.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephNFSesGetter has a method to return a CephNFSInterface. @@ -51,128 +50,18 @@ type CephNFSInterface interface { // cephNFSes implements CephNFSInterface type cephNFSes struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephNFS, *v1.CephNFSList] } // newCephNFSes returns a CephNFSes func newCephNFSes(c *CephV1Client, namespace string) *cephNFSes { return &cephNFSes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephNFS, *v1.CephNFSList]( + "cephnfses", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephNFS { return &v1.CephNFS{} }, + func() *v1.CephNFSList { return &v1.CephNFSList{} }), } } - -// Get takes name of the cephNFS, and returns the corresponding cephNFS object, and an error if there is any. -func (c *cephNFSes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephNFS, err error) { - result = &v1.CephNFS{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephnfses"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephNFSes that match those selectors. -func (c *cephNFSes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephNFSList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephNFSList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephnfses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephNFSes. -func (c *cephNFSes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephnfses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephNFS and creates it. Returns the server's representation of the cephNFS, and an error, if there is any. -func (c *cephNFSes) Create(ctx context.Context, cephNFS *v1.CephNFS, opts metav1.CreateOptions) (result *v1.CephNFS, err error) { - result = &v1.CephNFS{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephnfses"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephNFS). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephNFS and updates it. Returns the server's representation of the cephNFS, and an error, if there is any. -func (c *cephNFSes) Update(ctx context.Context, cephNFS *v1.CephNFS, opts metav1.UpdateOptions) (result *v1.CephNFS, err error) { - result = &v1.CephNFS{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephnfses"). - Name(cephNFS.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephNFS). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephNFS and deletes it. Returns an error if one occurs. -func (c *cephNFSes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephnfses"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephNFSes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephnfses"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephNFS. -func (c *cephNFSes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephNFS, err error) { - result = &v1.CephNFS{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephnfses"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectrealm.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectrealm.go index a408ab852..68e0e6ff1 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectrealm.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectrealm.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephObjectRealmsGetter has a method to return a CephObjectRealmInterface. @@ -51,128 +50,18 @@ type CephObjectRealmInterface interface { // cephObjectRealms implements CephObjectRealmInterface type cephObjectRealms struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephObjectRealm, *v1.CephObjectRealmList] } // newCephObjectRealms returns a CephObjectRealms func newCephObjectRealms(c *CephV1Client, namespace string) *cephObjectRealms { return &cephObjectRealms{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephObjectRealm, *v1.CephObjectRealmList]( + "cephobjectrealms", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephObjectRealm { return &v1.CephObjectRealm{} }, + func() *v1.CephObjectRealmList { return &v1.CephObjectRealmList{} }), } } - -// Get takes name of the cephObjectRealm, and returns the corresponding cephObjectRealm object, and an error if there is any. -func (c *cephObjectRealms) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephObjectRealm, err error) { - result = &v1.CephObjectRealm{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephobjectrealms"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephObjectRealms that match those selectors. -func (c *cephObjectRealms) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephObjectRealmList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephObjectRealmList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephobjectrealms"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephObjectRealms. -func (c *cephObjectRealms) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephobjectrealms"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephObjectRealm and creates it. Returns the server's representation of the cephObjectRealm, and an error, if there is any. -func (c *cephObjectRealms) Create(ctx context.Context, cephObjectRealm *v1.CephObjectRealm, opts metav1.CreateOptions) (result *v1.CephObjectRealm, err error) { - result = &v1.CephObjectRealm{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephobjectrealms"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephObjectRealm). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephObjectRealm and updates it. Returns the server's representation of the cephObjectRealm, and an error, if there is any. -func (c *cephObjectRealms) Update(ctx context.Context, cephObjectRealm *v1.CephObjectRealm, opts metav1.UpdateOptions) (result *v1.CephObjectRealm, err error) { - result = &v1.CephObjectRealm{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephobjectrealms"). - Name(cephObjectRealm.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephObjectRealm). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephObjectRealm and deletes it. Returns an error if one occurs. -func (c *cephObjectRealms) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephobjectrealms"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephObjectRealms) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephobjectrealms"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephObjectRealm. -func (c *cephObjectRealms) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephObjectRealm, err error) { - result = &v1.CephObjectRealm{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephobjectrealms"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectstore.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectstore.go index 7b3156363..cac7cd04c 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectstore.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectstore.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephObjectStoresGetter has a method to return a CephObjectStoreInterface. @@ -51,128 +50,18 @@ type CephObjectStoreInterface interface { // cephObjectStores implements CephObjectStoreInterface type cephObjectStores struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephObjectStore, *v1.CephObjectStoreList] } // newCephObjectStores returns a CephObjectStores func newCephObjectStores(c *CephV1Client, namespace string) *cephObjectStores { return &cephObjectStores{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephObjectStore, *v1.CephObjectStoreList]( + "cephobjectstores", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephObjectStore { return &v1.CephObjectStore{} }, + func() *v1.CephObjectStoreList { return &v1.CephObjectStoreList{} }), } } - -// Get takes name of the cephObjectStore, and returns the corresponding cephObjectStore object, and an error if there is any. -func (c *cephObjectStores) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephObjectStore, err error) { - result = &v1.CephObjectStore{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephobjectstores"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephObjectStores that match those selectors. -func (c *cephObjectStores) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephObjectStoreList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephObjectStoreList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephobjectstores"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephObjectStores. -func (c *cephObjectStores) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephobjectstores"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephObjectStore and creates it. Returns the server's representation of the cephObjectStore, and an error, if there is any. -func (c *cephObjectStores) Create(ctx context.Context, cephObjectStore *v1.CephObjectStore, opts metav1.CreateOptions) (result *v1.CephObjectStore, err error) { - result = &v1.CephObjectStore{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephobjectstores"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephObjectStore). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephObjectStore and updates it. Returns the server's representation of the cephObjectStore, and an error, if there is any. -func (c *cephObjectStores) Update(ctx context.Context, cephObjectStore *v1.CephObjectStore, opts metav1.UpdateOptions) (result *v1.CephObjectStore, err error) { - result = &v1.CephObjectStore{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephobjectstores"). - Name(cephObjectStore.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephObjectStore). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephObjectStore and deletes it. Returns an error if one occurs. -func (c *cephObjectStores) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephobjectstores"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephObjectStores) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephobjectstores"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephObjectStore. -func (c *cephObjectStores) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephObjectStore, err error) { - result = &v1.CephObjectStore{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephobjectstores"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectstoreuser.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectstoreuser.go index 69e929c27..77ecfe1a6 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectstoreuser.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectstoreuser.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephObjectStoreUsersGetter has a method to return a CephObjectStoreUserInterface. @@ -51,128 +50,18 @@ type CephObjectStoreUserInterface interface { // cephObjectStoreUsers implements CephObjectStoreUserInterface type cephObjectStoreUsers struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephObjectStoreUser, *v1.CephObjectStoreUserList] } // newCephObjectStoreUsers returns a CephObjectStoreUsers func newCephObjectStoreUsers(c *CephV1Client, namespace string) *cephObjectStoreUsers { return &cephObjectStoreUsers{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephObjectStoreUser, *v1.CephObjectStoreUserList]( + "cephobjectstoreusers", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephObjectStoreUser { return &v1.CephObjectStoreUser{} }, + func() *v1.CephObjectStoreUserList { return &v1.CephObjectStoreUserList{} }), } } - -// Get takes name of the cephObjectStoreUser, and returns the corresponding cephObjectStoreUser object, and an error if there is any. -func (c *cephObjectStoreUsers) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephObjectStoreUser, err error) { - result = &v1.CephObjectStoreUser{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephobjectstoreusers"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephObjectStoreUsers that match those selectors. -func (c *cephObjectStoreUsers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephObjectStoreUserList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephObjectStoreUserList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephobjectstoreusers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephObjectStoreUsers. -func (c *cephObjectStoreUsers) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephobjectstoreusers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephObjectStoreUser and creates it. Returns the server's representation of the cephObjectStoreUser, and an error, if there is any. -func (c *cephObjectStoreUsers) Create(ctx context.Context, cephObjectStoreUser *v1.CephObjectStoreUser, opts metav1.CreateOptions) (result *v1.CephObjectStoreUser, err error) { - result = &v1.CephObjectStoreUser{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephobjectstoreusers"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephObjectStoreUser). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephObjectStoreUser and updates it. Returns the server's representation of the cephObjectStoreUser, and an error, if there is any. -func (c *cephObjectStoreUsers) Update(ctx context.Context, cephObjectStoreUser *v1.CephObjectStoreUser, opts metav1.UpdateOptions) (result *v1.CephObjectStoreUser, err error) { - result = &v1.CephObjectStoreUser{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephobjectstoreusers"). - Name(cephObjectStoreUser.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephObjectStoreUser). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephObjectStoreUser and deletes it. Returns an error if one occurs. -func (c *cephObjectStoreUsers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephobjectstoreusers"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephObjectStoreUsers) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephobjectstoreusers"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephObjectStoreUser. -func (c *cephObjectStoreUsers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephObjectStoreUser, err error) { - result = &v1.CephObjectStoreUser{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephobjectstoreusers"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectzone.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectzone.go index 315d93c3b..229ca140f 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectzone.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectzone.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephObjectZonesGetter has a method to return a CephObjectZoneInterface. @@ -51,128 +50,18 @@ type CephObjectZoneInterface interface { // cephObjectZones implements CephObjectZoneInterface type cephObjectZones struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephObjectZone, *v1.CephObjectZoneList] } // newCephObjectZones returns a CephObjectZones func newCephObjectZones(c *CephV1Client, namespace string) *cephObjectZones { return &cephObjectZones{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephObjectZone, *v1.CephObjectZoneList]( + "cephobjectzones", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephObjectZone { return &v1.CephObjectZone{} }, + func() *v1.CephObjectZoneList { return &v1.CephObjectZoneList{} }), } } - -// Get takes name of the cephObjectZone, and returns the corresponding cephObjectZone object, and an error if there is any. -func (c *cephObjectZones) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephObjectZone, err error) { - result = &v1.CephObjectZone{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephobjectzones"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephObjectZones that match those selectors. -func (c *cephObjectZones) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephObjectZoneList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephObjectZoneList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephobjectzones"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephObjectZones. -func (c *cephObjectZones) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephobjectzones"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephObjectZone and creates it. Returns the server's representation of the cephObjectZone, and an error, if there is any. -func (c *cephObjectZones) Create(ctx context.Context, cephObjectZone *v1.CephObjectZone, opts metav1.CreateOptions) (result *v1.CephObjectZone, err error) { - result = &v1.CephObjectZone{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephobjectzones"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephObjectZone). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephObjectZone and updates it. Returns the server's representation of the cephObjectZone, and an error, if there is any. -func (c *cephObjectZones) Update(ctx context.Context, cephObjectZone *v1.CephObjectZone, opts metav1.UpdateOptions) (result *v1.CephObjectZone, err error) { - result = &v1.CephObjectZone{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephobjectzones"). - Name(cephObjectZone.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephObjectZone). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephObjectZone and deletes it. Returns an error if one occurs. -func (c *cephObjectZones) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephobjectzones"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephObjectZones) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephobjectzones"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephObjectZone. -func (c *cephObjectZones) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephObjectZone, err error) { - result = &v1.CephObjectZone{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephobjectzones"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectzonegroup.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectzonegroup.go index 11899408a..f5135af43 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectzonegroup.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephobjectzonegroup.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephObjectZoneGroupsGetter has a method to return a CephObjectZoneGroupInterface. @@ -51,128 +50,18 @@ type CephObjectZoneGroupInterface interface { // cephObjectZoneGroups implements CephObjectZoneGroupInterface type cephObjectZoneGroups struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephObjectZoneGroup, *v1.CephObjectZoneGroupList] } // newCephObjectZoneGroups returns a CephObjectZoneGroups func newCephObjectZoneGroups(c *CephV1Client, namespace string) *cephObjectZoneGroups { return &cephObjectZoneGroups{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephObjectZoneGroup, *v1.CephObjectZoneGroupList]( + "cephobjectzonegroups", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephObjectZoneGroup { return &v1.CephObjectZoneGroup{} }, + func() *v1.CephObjectZoneGroupList { return &v1.CephObjectZoneGroupList{} }), } } - -// Get takes name of the cephObjectZoneGroup, and returns the corresponding cephObjectZoneGroup object, and an error if there is any. -func (c *cephObjectZoneGroups) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephObjectZoneGroup, err error) { - result = &v1.CephObjectZoneGroup{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephobjectzonegroups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephObjectZoneGroups that match those selectors. -func (c *cephObjectZoneGroups) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephObjectZoneGroupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephObjectZoneGroupList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephobjectzonegroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephObjectZoneGroups. -func (c *cephObjectZoneGroups) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephobjectzonegroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephObjectZoneGroup and creates it. Returns the server's representation of the cephObjectZoneGroup, and an error, if there is any. -func (c *cephObjectZoneGroups) Create(ctx context.Context, cephObjectZoneGroup *v1.CephObjectZoneGroup, opts metav1.CreateOptions) (result *v1.CephObjectZoneGroup, err error) { - result = &v1.CephObjectZoneGroup{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephobjectzonegroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephObjectZoneGroup). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephObjectZoneGroup and updates it. Returns the server's representation of the cephObjectZoneGroup, and an error, if there is any. -func (c *cephObjectZoneGroups) Update(ctx context.Context, cephObjectZoneGroup *v1.CephObjectZoneGroup, opts metav1.UpdateOptions) (result *v1.CephObjectZoneGroup, err error) { - result = &v1.CephObjectZoneGroup{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephobjectzonegroups"). - Name(cephObjectZoneGroup.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephObjectZoneGroup). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephObjectZoneGroup and deletes it. Returns an error if one occurs. -func (c *cephObjectZoneGroups) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephobjectzonegroups"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephObjectZoneGroups) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephobjectzonegroups"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephObjectZoneGroup. -func (c *cephObjectZoneGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephObjectZoneGroup, err error) { - result = &v1.CephObjectZoneGroup{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephobjectzonegroups"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephrbdmirror.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephrbdmirror.go index 524e8a98f..874fbf57f 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephrbdmirror.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/cephrbdmirror.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CephRBDMirrorsGetter has a method to return a CephRBDMirrorInterface. @@ -51,128 +50,18 @@ type CephRBDMirrorInterface interface { // cephRBDMirrors implements CephRBDMirrorInterface type cephRBDMirrors struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.CephRBDMirror, *v1.CephRBDMirrorList] } // newCephRBDMirrors returns a CephRBDMirrors func newCephRBDMirrors(c *CephV1Client, namespace string) *cephRBDMirrors { return &cephRBDMirrors{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.CephRBDMirror, *v1.CephRBDMirrorList]( + "cephrbdmirrors", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.CephRBDMirror { return &v1.CephRBDMirror{} }, + func() *v1.CephRBDMirrorList { return &v1.CephRBDMirrorList{} }), } } - -// Get takes name of the cephRBDMirror, and returns the corresponding cephRBDMirror object, and an error if there is any. -func (c *cephRBDMirrors) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephRBDMirror, err error) { - result = &v1.CephRBDMirror{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephrbdmirrors"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CephRBDMirrors that match those selectors. -func (c *cephRBDMirrors) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephRBDMirrorList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CephRBDMirrorList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cephrbdmirrors"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cephRBDMirrors. -func (c *cephRBDMirrors) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cephrbdmirrors"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cephRBDMirror and creates it. Returns the server's representation of the cephRBDMirror, and an error, if there is any. -func (c *cephRBDMirrors) Create(ctx context.Context, cephRBDMirror *v1.CephRBDMirror, opts metav1.CreateOptions) (result *v1.CephRBDMirror, err error) { - result = &v1.CephRBDMirror{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cephrbdmirrors"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephRBDMirror). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cephRBDMirror and updates it. Returns the server's representation of the cephRBDMirror, and an error, if there is any. -func (c *cephRBDMirrors) Update(ctx context.Context, cephRBDMirror *v1.CephRBDMirror, opts metav1.UpdateOptions) (result *v1.CephRBDMirror, err error) { - result = &v1.CephRBDMirror{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cephrbdmirrors"). - Name(cephRBDMirror.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cephRBDMirror). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cephRBDMirror and deletes it. Returns an error if one occurs. -func (c *cephRBDMirrors) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cephrbdmirrors"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cephRBDMirrors) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cephrbdmirrors"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cephRBDMirror. -func (c *cephRBDMirrors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephRBDMirror, err error) { - result = &v1.CephRBDMirror{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cephrbdmirrors"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/doc.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/doc.go index 3af5d054f..fcafe2aec 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/doc.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/doc.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/doc.go index 16f443990..9465bea0c 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/doc.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/doc.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_ceph.rook.io_client.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_ceph.rook.io_client.go index cb7ee4075..ccbcc0742 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_ceph.rook.io_client.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_ceph.rook.io_client.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephblockpool.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephblockpool.go index 991b9b293..cc1d0ad24 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephblockpool.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephblockpool.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephBlockPools struct { ns string } -var cephblockpoolsResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephblockpools"} +var cephblockpoolsResource = v1.SchemeGroupVersion.WithResource("cephblockpools") -var cephblockpoolsKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephBlockPool"} +var cephblockpoolsKind = v1.SchemeGroupVersion.WithKind("CephBlockPool") // Get takes name of the cephBlockPool, and returns the corresponding cephBlockPool object, and an error if there is any. -func (c *FakeCephBlockPools) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephBlockPool, err error) { +func (c *FakeCephBlockPools) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephBlockPool, err error) { + emptyResult := &v1.CephBlockPool{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephblockpoolsResource, c.ns, name), &cephrookiov1.CephBlockPool{}) + Invokes(testing.NewGetActionWithOptions(cephblockpoolsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBlockPool), err + return obj.(*v1.CephBlockPool), err } // List takes label and field selectors, and returns the list of CephBlockPools that match those selectors. -func (c *FakeCephBlockPools) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephBlockPoolList, err error) { +func (c *FakeCephBlockPools) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephBlockPoolList, err error) { + emptyResult := &v1.CephBlockPoolList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephblockpoolsResource, cephblockpoolsKind, c.ns, opts), &cephrookiov1.CephBlockPoolList{}) + Invokes(testing.NewListActionWithOptions(cephblockpoolsResource, cephblockpoolsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephBlockPoolList{ListMeta: obj.(*cephrookiov1.CephBlockPoolList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephBlockPoolList).Items { + list := &v1.CephBlockPoolList{ListMeta: obj.(*v1.CephBlockPoolList).ListMeta} + for _, item := range obj.(*v1.CephBlockPoolList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephBlockPools) List(ctx context.Context, opts v1.ListOptions) (res } // Watch returns a watch.Interface that watches the requested cephBlockPools. -func (c *FakeCephBlockPools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephBlockPools) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephblockpoolsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephblockpoolsResource, c.ns, opts)) } // Create takes the representation of a cephBlockPool and creates it. Returns the server's representation of the cephBlockPool, and an error, if there is any. -func (c *FakeCephBlockPools) Create(ctx context.Context, cephBlockPool *cephrookiov1.CephBlockPool, opts v1.CreateOptions) (result *cephrookiov1.CephBlockPool, err error) { +func (c *FakeCephBlockPools) Create(ctx context.Context, cephBlockPool *v1.CephBlockPool, opts metav1.CreateOptions) (result *v1.CephBlockPool, err error) { + emptyResult := &v1.CephBlockPool{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephblockpoolsResource, c.ns, cephBlockPool), &cephrookiov1.CephBlockPool{}) + Invokes(testing.NewCreateActionWithOptions(cephblockpoolsResource, c.ns, cephBlockPool, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBlockPool), err + return obj.(*v1.CephBlockPool), err } // Update takes the representation of a cephBlockPool and updates it. Returns the server's representation of the cephBlockPool, and an error, if there is any. -func (c *FakeCephBlockPools) Update(ctx context.Context, cephBlockPool *cephrookiov1.CephBlockPool, opts v1.UpdateOptions) (result *cephrookiov1.CephBlockPool, err error) { +func (c *FakeCephBlockPools) Update(ctx context.Context, cephBlockPool *v1.CephBlockPool, opts metav1.UpdateOptions) (result *v1.CephBlockPool, err error) { + emptyResult := &v1.CephBlockPool{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephblockpoolsResource, c.ns, cephBlockPool), &cephrookiov1.CephBlockPool{}) + Invokes(testing.NewUpdateActionWithOptions(cephblockpoolsResource, c.ns, cephBlockPool, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBlockPool), err + return obj.(*v1.CephBlockPool), err } // Delete takes name of the cephBlockPool and deletes it. Returns an error if one occurs. -func (c *FakeCephBlockPools) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephBlockPools) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephblockpoolsResource, c.ns, name), &cephrookiov1.CephBlockPool{}) + Invokes(testing.NewDeleteActionWithOptions(cephblockpoolsResource, c.ns, name, opts), &v1.CephBlockPool{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephBlockPools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephblockpoolsResource, c.ns, listOpts) +func (c *FakeCephBlockPools) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephblockpoolsResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephBlockPoolList{}) + _, err := c.Fake.Invokes(action, &v1.CephBlockPoolList{}) return err } // Patch applies the patch and returns the patched cephBlockPool. -func (c *FakeCephBlockPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephBlockPool, err error) { +func (c *FakeCephBlockPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephBlockPool, err error) { + emptyResult := &v1.CephBlockPool{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephblockpoolsResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephBlockPool{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephblockpoolsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBlockPool), err + return obj.(*v1.CephBlockPool), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephblockpoolradosnamespace.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephblockpoolradosnamespace.go index 5281ead49..d4cf6c2eb 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephblockpoolradosnamespace.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephblockpoolradosnamespace.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephBlockPoolRadosNamespaces struct { ns string } -var cephblockpoolradosnamespacesResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephblockpoolradosnamespaces"} +var cephblockpoolradosnamespacesResource = v1.SchemeGroupVersion.WithResource("cephblockpoolradosnamespaces") -var cephblockpoolradosnamespacesKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephBlockPoolRadosNamespace"} +var cephblockpoolradosnamespacesKind = v1.SchemeGroupVersion.WithKind("CephBlockPoolRadosNamespace") // Get takes name of the cephBlockPoolRadosNamespace, and returns the corresponding cephBlockPoolRadosNamespace object, and an error if there is any. -func (c *FakeCephBlockPoolRadosNamespaces) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephBlockPoolRadosNamespace, err error) { +func (c *FakeCephBlockPoolRadosNamespaces) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephBlockPoolRadosNamespace, err error) { + emptyResult := &v1.CephBlockPoolRadosNamespace{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephblockpoolradosnamespacesResource, c.ns, name), &cephrookiov1.CephBlockPoolRadosNamespace{}) + Invokes(testing.NewGetActionWithOptions(cephblockpoolradosnamespacesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBlockPoolRadosNamespace), err + return obj.(*v1.CephBlockPoolRadosNamespace), err } // List takes label and field selectors, and returns the list of CephBlockPoolRadosNamespaces that match those selectors. -func (c *FakeCephBlockPoolRadosNamespaces) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephBlockPoolRadosNamespaceList, err error) { +func (c *FakeCephBlockPoolRadosNamespaces) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephBlockPoolRadosNamespaceList, err error) { + emptyResult := &v1.CephBlockPoolRadosNamespaceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephblockpoolradosnamespacesResource, cephblockpoolradosnamespacesKind, c.ns, opts), &cephrookiov1.CephBlockPoolRadosNamespaceList{}) + Invokes(testing.NewListActionWithOptions(cephblockpoolradosnamespacesResource, cephblockpoolradosnamespacesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephBlockPoolRadosNamespaceList{ListMeta: obj.(*cephrookiov1.CephBlockPoolRadosNamespaceList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephBlockPoolRadosNamespaceList).Items { + list := &v1.CephBlockPoolRadosNamespaceList{ListMeta: obj.(*v1.CephBlockPoolRadosNamespaceList).ListMeta} + for _, item := range obj.(*v1.CephBlockPoolRadosNamespaceList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephBlockPoolRadosNamespaces) List(ctx context.Context, opts v1.Lis } // Watch returns a watch.Interface that watches the requested cephBlockPoolRadosNamespaces. -func (c *FakeCephBlockPoolRadosNamespaces) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephBlockPoolRadosNamespaces) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephblockpoolradosnamespacesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephblockpoolradosnamespacesResource, c.ns, opts)) } // Create takes the representation of a cephBlockPoolRadosNamespace and creates it. Returns the server's representation of the cephBlockPoolRadosNamespace, and an error, if there is any. -func (c *FakeCephBlockPoolRadosNamespaces) Create(ctx context.Context, cephBlockPoolRadosNamespace *cephrookiov1.CephBlockPoolRadosNamespace, opts v1.CreateOptions) (result *cephrookiov1.CephBlockPoolRadosNamespace, err error) { +func (c *FakeCephBlockPoolRadosNamespaces) Create(ctx context.Context, cephBlockPoolRadosNamespace *v1.CephBlockPoolRadosNamespace, opts metav1.CreateOptions) (result *v1.CephBlockPoolRadosNamespace, err error) { + emptyResult := &v1.CephBlockPoolRadosNamespace{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephblockpoolradosnamespacesResource, c.ns, cephBlockPoolRadosNamespace), &cephrookiov1.CephBlockPoolRadosNamespace{}) + Invokes(testing.NewCreateActionWithOptions(cephblockpoolradosnamespacesResource, c.ns, cephBlockPoolRadosNamespace, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBlockPoolRadosNamespace), err + return obj.(*v1.CephBlockPoolRadosNamespace), err } // Update takes the representation of a cephBlockPoolRadosNamespace and updates it. Returns the server's representation of the cephBlockPoolRadosNamespace, and an error, if there is any. -func (c *FakeCephBlockPoolRadosNamespaces) Update(ctx context.Context, cephBlockPoolRadosNamespace *cephrookiov1.CephBlockPoolRadosNamespace, opts v1.UpdateOptions) (result *cephrookiov1.CephBlockPoolRadosNamespace, err error) { +func (c *FakeCephBlockPoolRadosNamespaces) Update(ctx context.Context, cephBlockPoolRadosNamespace *v1.CephBlockPoolRadosNamespace, opts metav1.UpdateOptions) (result *v1.CephBlockPoolRadosNamespace, err error) { + emptyResult := &v1.CephBlockPoolRadosNamespace{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephblockpoolradosnamespacesResource, c.ns, cephBlockPoolRadosNamespace), &cephrookiov1.CephBlockPoolRadosNamespace{}) + Invokes(testing.NewUpdateActionWithOptions(cephblockpoolradosnamespacesResource, c.ns, cephBlockPoolRadosNamespace, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBlockPoolRadosNamespace), err + return obj.(*v1.CephBlockPoolRadosNamespace), err } // Delete takes name of the cephBlockPoolRadosNamespace and deletes it. Returns an error if one occurs. -func (c *FakeCephBlockPoolRadosNamespaces) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephBlockPoolRadosNamespaces) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephblockpoolradosnamespacesResource, c.ns, name), &cephrookiov1.CephBlockPoolRadosNamespace{}) + Invokes(testing.NewDeleteActionWithOptions(cephblockpoolradosnamespacesResource, c.ns, name, opts), &v1.CephBlockPoolRadosNamespace{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephBlockPoolRadosNamespaces) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephblockpoolradosnamespacesResource, c.ns, listOpts) +func (c *FakeCephBlockPoolRadosNamespaces) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephblockpoolradosnamespacesResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephBlockPoolRadosNamespaceList{}) + _, err := c.Fake.Invokes(action, &v1.CephBlockPoolRadosNamespaceList{}) return err } // Patch applies the patch and returns the patched cephBlockPoolRadosNamespace. -func (c *FakeCephBlockPoolRadosNamespaces) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephBlockPoolRadosNamespace, err error) { +func (c *FakeCephBlockPoolRadosNamespaces) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephBlockPoolRadosNamespace, err error) { + emptyResult := &v1.CephBlockPoolRadosNamespace{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephblockpoolradosnamespacesResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephBlockPoolRadosNamespace{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephblockpoolradosnamespacesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBlockPoolRadosNamespace), err + return obj.(*v1.CephBlockPoolRadosNamespace), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephbucketnotification.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephbucketnotification.go index 35ebe66fe..5fecd17a0 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephbucketnotification.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephbucketnotification.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephBucketNotifications struct { ns string } -var cephbucketnotificationsResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephbucketnotifications"} +var cephbucketnotificationsResource = v1.SchemeGroupVersion.WithResource("cephbucketnotifications") -var cephbucketnotificationsKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephBucketNotification"} +var cephbucketnotificationsKind = v1.SchemeGroupVersion.WithKind("CephBucketNotification") // Get takes name of the cephBucketNotification, and returns the corresponding cephBucketNotification object, and an error if there is any. -func (c *FakeCephBucketNotifications) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephBucketNotification, err error) { +func (c *FakeCephBucketNotifications) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephBucketNotification, err error) { + emptyResult := &v1.CephBucketNotification{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephbucketnotificationsResource, c.ns, name), &cephrookiov1.CephBucketNotification{}) + Invokes(testing.NewGetActionWithOptions(cephbucketnotificationsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBucketNotification), err + return obj.(*v1.CephBucketNotification), err } // List takes label and field selectors, and returns the list of CephBucketNotifications that match those selectors. -func (c *FakeCephBucketNotifications) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephBucketNotificationList, err error) { +func (c *FakeCephBucketNotifications) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephBucketNotificationList, err error) { + emptyResult := &v1.CephBucketNotificationList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephbucketnotificationsResource, cephbucketnotificationsKind, c.ns, opts), &cephrookiov1.CephBucketNotificationList{}) + Invokes(testing.NewListActionWithOptions(cephbucketnotificationsResource, cephbucketnotificationsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephBucketNotificationList{ListMeta: obj.(*cephrookiov1.CephBucketNotificationList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephBucketNotificationList).Items { + list := &v1.CephBucketNotificationList{ListMeta: obj.(*v1.CephBucketNotificationList).ListMeta} + for _, item := range obj.(*v1.CephBucketNotificationList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephBucketNotifications) List(ctx context.Context, opts v1.ListOpti } // Watch returns a watch.Interface that watches the requested cephBucketNotifications. -func (c *FakeCephBucketNotifications) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephBucketNotifications) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephbucketnotificationsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephbucketnotificationsResource, c.ns, opts)) } // Create takes the representation of a cephBucketNotification and creates it. Returns the server's representation of the cephBucketNotification, and an error, if there is any. -func (c *FakeCephBucketNotifications) Create(ctx context.Context, cephBucketNotification *cephrookiov1.CephBucketNotification, opts v1.CreateOptions) (result *cephrookiov1.CephBucketNotification, err error) { +func (c *FakeCephBucketNotifications) Create(ctx context.Context, cephBucketNotification *v1.CephBucketNotification, opts metav1.CreateOptions) (result *v1.CephBucketNotification, err error) { + emptyResult := &v1.CephBucketNotification{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephbucketnotificationsResource, c.ns, cephBucketNotification), &cephrookiov1.CephBucketNotification{}) + Invokes(testing.NewCreateActionWithOptions(cephbucketnotificationsResource, c.ns, cephBucketNotification, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBucketNotification), err + return obj.(*v1.CephBucketNotification), err } // Update takes the representation of a cephBucketNotification and updates it. Returns the server's representation of the cephBucketNotification, and an error, if there is any. -func (c *FakeCephBucketNotifications) Update(ctx context.Context, cephBucketNotification *cephrookiov1.CephBucketNotification, opts v1.UpdateOptions) (result *cephrookiov1.CephBucketNotification, err error) { +func (c *FakeCephBucketNotifications) Update(ctx context.Context, cephBucketNotification *v1.CephBucketNotification, opts metav1.UpdateOptions) (result *v1.CephBucketNotification, err error) { + emptyResult := &v1.CephBucketNotification{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephbucketnotificationsResource, c.ns, cephBucketNotification), &cephrookiov1.CephBucketNotification{}) + Invokes(testing.NewUpdateActionWithOptions(cephbucketnotificationsResource, c.ns, cephBucketNotification, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBucketNotification), err + return obj.(*v1.CephBucketNotification), err } // Delete takes name of the cephBucketNotification and deletes it. Returns an error if one occurs. -func (c *FakeCephBucketNotifications) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephBucketNotifications) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephbucketnotificationsResource, c.ns, name), &cephrookiov1.CephBucketNotification{}) + Invokes(testing.NewDeleteActionWithOptions(cephbucketnotificationsResource, c.ns, name, opts), &v1.CephBucketNotification{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephBucketNotifications) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephbucketnotificationsResource, c.ns, listOpts) +func (c *FakeCephBucketNotifications) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephbucketnotificationsResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephBucketNotificationList{}) + _, err := c.Fake.Invokes(action, &v1.CephBucketNotificationList{}) return err } // Patch applies the patch and returns the patched cephBucketNotification. -func (c *FakeCephBucketNotifications) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephBucketNotification, err error) { +func (c *FakeCephBucketNotifications) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephBucketNotification, err error) { + emptyResult := &v1.CephBucketNotification{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephbucketnotificationsResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephBucketNotification{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephbucketnotificationsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBucketNotification), err + return obj.(*v1.CephBucketNotification), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephbuckettopic.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephbuckettopic.go index f117c9fef..7e4418b90 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephbuckettopic.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephbuckettopic.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephBucketTopics struct { ns string } -var cephbuckettopicsResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephbuckettopics"} +var cephbuckettopicsResource = v1.SchemeGroupVersion.WithResource("cephbuckettopics") -var cephbuckettopicsKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephBucketTopic"} +var cephbuckettopicsKind = v1.SchemeGroupVersion.WithKind("CephBucketTopic") // Get takes name of the cephBucketTopic, and returns the corresponding cephBucketTopic object, and an error if there is any. -func (c *FakeCephBucketTopics) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephBucketTopic, err error) { +func (c *FakeCephBucketTopics) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephBucketTopic, err error) { + emptyResult := &v1.CephBucketTopic{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephbuckettopicsResource, c.ns, name), &cephrookiov1.CephBucketTopic{}) + Invokes(testing.NewGetActionWithOptions(cephbuckettopicsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBucketTopic), err + return obj.(*v1.CephBucketTopic), err } // List takes label and field selectors, and returns the list of CephBucketTopics that match those selectors. -func (c *FakeCephBucketTopics) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephBucketTopicList, err error) { +func (c *FakeCephBucketTopics) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephBucketTopicList, err error) { + emptyResult := &v1.CephBucketTopicList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephbuckettopicsResource, cephbuckettopicsKind, c.ns, opts), &cephrookiov1.CephBucketTopicList{}) + Invokes(testing.NewListActionWithOptions(cephbuckettopicsResource, cephbuckettopicsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephBucketTopicList{ListMeta: obj.(*cephrookiov1.CephBucketTopicList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephBucketTopicList).Items { + list := &v1.CephBucketTopicList{ListMeta: obj.(*v1.CephBucketTopicList).ListMeta} + for _, item := range obj.(*v1.CephBucketTopicList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephBucketTopics) List(ctx context.Context, opts v1.ListOptions) (r } // Watch returns a watch.Interface that watches the requested cephBucketTopics. -func (c *FakeCephBucketTopics) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephBucketTopics) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephbuckettopicsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephbuckettopicsResource, c.ns, opts)) } // Create takes the representation of a cephBucketTopic and creates it. Returns the server's representation of the cephBucketTopic, and an error, if there is any. -func (c *FakeCephBucketTopics) Create(ctx context.Context, cephBucketTopic *cephrookiov1.CephBucketTopic, opts v1.CreateOptions) (result *cephrookiov1.CephBucketTopic, err error) { +func (c *FakeCephBucketTopics) Create(ctx context.Context, cephBucketTopic *v1.CephBucketTopic, opts metav1.CreateOptions) (result *v1.CephBucketTopic, err error) { + emptyResult := &v1.CephBucketTopic{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephbuckettopicsResource, c.ns, cephBucketTopic), &cephrookiov1.CephBucketTopic{}) + Invokes(testing.NewCreateActionWithOptions(cephbuckettopicsResource, c.ns, cephBucketTopic, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBucketTopic), err + return obj.(*v1.CephBucketTopic), err } // Update takes the representation of a cephBucketTopic and updates it. Returns the server's representation of the cephBucketTopic, and an error, if there is any. -func (c *FakeCephBucketTopics) Update(ctx context.Context, cephBucketTopic *cephrookiov1.CephBucketTopic, opts v1.UpdateOptions) (result *cephrookiov1.CephBucketTopic, err error) { +func (c *FakeCephBucketTopics) Update(ctx context.Context, cephBucketTopic *v1.CephBucketTopic, opts metav1.UpdateOptions) (result *v1.CephBucketTopic, err error) { + emptyResult := &v1.CephBucketTopic{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephbuckettopicsResource, c.ns, cephBucketTopic), &cephrookiov1.CephBucketTopic{}) + Invokes(testing.NewUpdateActionWithOptions(cephbuckettopicsResource, c.ns, cephBucketTopic, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBucketTopic), err + return obj.(*v1.CephBucketTopic), err } // Delete takes name of the cephBucketTopic and deletes it. Returns an error if one occurs. -func (c *FakeCephBucketTopics) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephBucketTopics) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephbuckettopicsResource, c.ns, name), &cephrookiov1.CephBucketTopic{}) + Invokes(testing.NewDeleteActionWithOptions(cephbuckettopicsResource, c.ns, name, opts), &v1.CephBucketTopic{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephBucketTopics) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephbuckettopicsResource, c.ns, listOpts) +func (c *FakeCephBucketTopics) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephbuckettopicsResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephBucketTopicList{}) + _, err := c.Fake.Invokes(action, &v1.CephBucketTopicList{}) return err } // Patch applies the patch and returns the patched cephBucketTopic. -func (c *FakeCephBucketTopics) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephBucketTopic, err error) { +func (c *FakeCephBucketTopics) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephBucketTopic, err error) { + emptyResult := &v1.CephBucketTopic{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephbuckettopicsResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephBucketTopic{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephbuckettopicsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephBucketTopic), err + return obj.(*v1.CephBucketTopic), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephclient.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephclient.go index 963842e3f..1cdf2e5db 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephclient.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephclient.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephClients struct { ns string } -var cephclientsResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephclients"} +var cephclientsResource = v1.SchemeGroupVersion.WithResource("cephclients") -var cephclientsKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephClient"} +var cephclientsKind = v1.SchemeGroupVersion.WithKind("CephClient") // Get takes name of the cephClient, and returns the corresponding cephClient object, and an error if there is any. -func (c *FakeCephClients) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephClient, err error) { +func (c *FakeCephClients) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephClient, err error) { + emptyResult := &v1.CephClient{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephclientsResource, c.ns, name), &cephrookiov1.CephClient{}) + Invokes(testing.NewGetActionWithOptions(cephclientsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephClient), err + return obj.(*v1.CephClient), err } // List takes label and field selectors, and returns the list of CephClients that match those selectors. -func (c *FakeCephClients) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephClientList, err error) { +func (c *FakeCephClients) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephClientList, err error) { + emptyResult := &v1.CephClientList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephclientsResource, cephclientsKind, c.ns, opts), &cephrookiov1.CephClientList{}) + Invokes(testing.NewListActionWithOptions(cephclientsResource, cephclientsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephClientList{ListMeta: obj.(*cephrookiov1.CephClientList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephClientList).Items { + list := &v1.CephClientList{ListMeta: obj.(*v1.CephClientList).ListMeta} + for _, item := range obj.(*v1.CephClientList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephClients) List(ctx context.Context, opts v1.ListOptions) (result } // Watch returns a watch.Interface that watches the requested cephClients. -func (c *FakeCephClients) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephClients) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephclientsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephclientsResource, c.ns, opts)) } // Create takes the representation of a cephClient and creates it. Returns the server's representation of the cephClient, and an error, if there is any. -func (c *FakeCephClients) Create(ctx context.Context, cephClient *cephrookiov1.CephClient, opts v1.CreateOptions) (result *cephrookiov1.CephClient, err error) { +func (c *FakeCephClients) Create(ctx context.Context, cephClient *v1.CephClient, opts metav1.CreateOptions) (result *v1.CephClient, err error) { + emptyResult := &v1.CephClient{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephclientsResource, c.ns, cephClient), &cephrookiov1.CephClient{}) + Invokes(testing.NewCreateActionWithOptions(cephclientsResource, c.ns, cephClient, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephClient), err + return obj.(*v1.CephClient), err } // Update takes the representation of a cephClient and updates it. Returns the server's representation of the cephClient, and an error, if there is any. -func (c *FakeCephClients) Update(ctx context.Context, cephClient *cephrookiov1.CephClient, opts v1.UpdateOptions) (result *cephrookiov1.CephClient, err error) { +func (c *FakeCephClients) Update(ctx context.Context, cephClient *v1.CephClient, opts metav1.UpdateOptions) (result *v1.CephClient, err error) { + emptyResult := &v1.CephClient{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephclientsResource, c.ns, cephClient), &cephrookiov1.CephClient{}) + Invokes(testing.NewUpdateActionWithOptions(cephclientsResource, c.ns, cephClient, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephClient), err + return obj.(*v1.CephClient), err } // Delete takes name of the cephClient and deletes it. Returns an error if one occurs. -func (c *FakeCephClients) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephClients) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephclientsResource, c.ns, name), &cephrookiov1.CephClient{}) + Invokes(testing.NewDeleteActionWithOptions(cephclientsResource, c.ns, name, opts), &v1.CephClient{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephClients) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephclientsResource, c.ns, listOpts) +func (c *FakeCephClients) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephclientsResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephClientList{}) + _, err := c.Fake.Invokes(action, &v1.CephClientList{}) return err } // Patch applies the patch and returns the patched cephClient. -func (c *FakeCephClients) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephClient, err error) { +func (c *FakeCephClients) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephClient, err error) { + emptyResult := &v1.CephClient{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephclientsResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephClient{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephclientsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephClient), err + return obj.(*v1.CephClient), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephcluster.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephcluster.go index f30bcf70a..a27522ba8 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephcluster.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephcluster.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephClusters struct { ns string } -var cephclustersResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephclusters"} +var cephclustersResource = v1.SchemeGroupVersion.WithResource("cephclusters") -var cephclustersKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephCluster"} +var cephclustersKind = v1.SchemeGroupVersion.WithKind("CephCluster") // Get takes name of the cephCluster, and returns the corresponding cephCluster object, and an error if there is any. -func (c *FakeCephClusters) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephCluster, err error) { +func (c *FakeCephClusters) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephCluster, err error) { + emptyResult := &v1.CephCluster{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephclustersResource, c.ns, name), &cephrookiov1.CephCluster{}) + Invokes(testing.NewGetActionWithOptions(cephclustersResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephCluster), err + return obj.(*v1.CephCluster), err } // List takes label and field selectors, and returns the list of CephClusters that match those selectors. -func (c *FakeCephClusters) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephClusterList, err error) { +func (c *FakeCephClusters) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephClusterList, err error) { + emptyResult := &v1.CephClusterList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephclustersResource, cephclustersKind, c.ns, opts), &cephrookiov1.CephClusterList{}) + Invokes(testing.NewListActionWithOptions(cephclustersResource, cephclustersKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephClusterList{ListMeta: obj.(*cephrookiov1.CephClusterList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephClusterList).Items { + list := &v1.CephClusterList{ListMeta: obj.(*v1.CephClusterList).ListMeta} + for _, item := range obj.(*v1.CephClusterList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephClusters) List(ctx context.Context, opts v1.ListOptions) (resul } // Watch returns a watch.Interface that watches the requested cephClusters. -func (c *FakeCephClusters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephClusters) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephclustersResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephclustersResource, c.ns, opts)) } // Create takes the representation of a cephCluster and creates it. Returns the server's representation of the cephCluster, and an error, if there is any. -func (c *FakeCephClusters) Create(ctx context.Context, cephCluster *cephrookiov1.CephCluster, opts v1.CreateOptions) (result *cephrookiov1.CephCluster, err error) { +func (c *FakeCephClusters) Create(ctx context.Context, cephCluster *v1.CephCluster, opts metav1.CreateOptions) (result *v1.CephCluster, err error) { + emptyResult := &v1.CephCluster{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephclustersResource, c.ns, cephCluster), &cephrookiov1.CephCluster{}) + Invokes(testing.NewCreateActionWithOptions(cephclustersResource, c.ns, cephCluster, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephCluster), err + return obj.(*v1.CephCluster), err } // Update takes the representation of a cephCluster and updates it. Returns the server's representation of the cephCluster, and an error, if there is any. -func (c *FakeCephClusters) Update(ctx context.Context, cephCluster *cephrookiov1.CephCluster, opts v1.UpdateOptions) (result *cephrookiov1.CephCluster, err error) { +func (c *FakeCephClusters) Update(ctx context.Context, cephCluster *v1.CephCluster, opts metav1.UpdateOptions) (result *v1.CephCluster, err error) { + emptyResult := &v1.CephCluster{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephclustersResource, c.ns, cephCluster), &cephrookiov1.CephCluster{}) + Invokes(testing.NewUpdateActionWithOptions(cephclustersResource, c.ns, cephCluster, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephCluster), err + return obj.(*v1.CephCluster), err } // Delete takes name of the cephCluster and deletes it. Returns an error if one occurs. -func (c *FakeCephClusters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephClusters) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephclustersResource, c.ns, name), &cephrookiov1.CephCluster{}) + Invokes(testing.NewDeleteActionWithOptions(cephclustersResource, c.ns, name, opts), &v1.CephCluster{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephClusters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephclustersResource, c.ns, listOpts) +func (c *FakeCephClusters) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephclustersResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephClusterList{}) + _, err := c.Fake.Invokes(action, &v1.CephClusterList{}) return err } // Patch applies the patch and returns the patched cephCluster. -func (c *FakeCephClusters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephCluster, err error) { +func (c *FakeCephClusters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephCluster, err error) { + emptyResult := &v1.CephCluster{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephclustersResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephCluster{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephclustersResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephCluster), err + return obj.(*v1.CephCluster), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephcosidriver.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephcosidriver.go index 0a5c7490b..1bac73919 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephcosidriver.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephcosidriver.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephCOSIDrivers struct { ns string } -var cephcosidriversResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephcosidrivers"} +var cephcosidriversResource = v1.SchemeGroupVersion.WithResource("cephcosidrivers") -var cephcosidriversKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephCOSIDriver"} +var cephcosidriversKind = v1.SchemeGroupVersion.WithKind("CephCOSIDriver") // Get takes name of the cephCOSIDriver, and returns the corresponding cephCOSIDriver object, and an error if there is any. -func (c *FakeCephCOSIDrivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephCOSIDriver, err error) { +func (c *FakeCephCOSIDrivers) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephCOSIDriver, err error) { + emptyResult := &v1.CephCOSIDriver{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephcosidriversResource, c.ns, name), &cephrookiov1.CephCOSIDriver{}) + Invokes(testing.NewGetActionWithOptions(cephcosidriversResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephCOSIDriver), err + return obj.(*v1.CephCOSIDriver), err } // List takes label and field selectors, and returns the list of CephCOSIDrivers that match those selectors. -func (c *FakeCephCOSIDrivers) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephCOSIDriverList, err error) { +func (c *FakeCephCOSIDrivers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephCOSIDriverList, err error) { + emptyResult := &v1.CephCOSIDriverList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephcosidriversResource, cephcosidriversKind, c.ns, opts), &cephrookiov1.CephCOSIDriverList{}) + Invokes(testing.NewListActionWithOptions(cephcosidriversResource, cephcosidriversKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephCOSIDriverList{ListMeta: obj.(*cephrookiov1.CephCOSIDriverList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephCOSIDriverList).Items { + list := &v1.CephCOSIDriverList{ListMeta: obj.(*v1.CephCOSIDriverList).ListMeta} + for _, item := range obj.(*v1.CephCOSIDriverList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephCOSIDrivers) List(ctx context.Context, opts v1.ListOptions) (re } // Watch returns a watch.Interface that watches the requested cephCOSIDrivers. -func (c *FakeCephCOSIDrivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephCOSIDrivers) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephcosidriversResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephcosidriversResource, c.ns, opts)) } // Create takes the representation of a cephCOSIDriver and creates it. Returns the server's representation of the cephCOSIDriver, and an error, if there is any. -func (c *FakeCephCOSIDrivers) Create(ctx context.Context, cephCOSIDriver *cephrookiov1.CephCOSIDriver, opts v1.CreateOptions) (result *cephrookiov1.CephCOSIDriver, err error) { +func (c *FakeCephCOSIDrivers) Create(ctx context.Context, cephCOSIDriver *v1.CephCOSIDriver, opts metav1.CreateOptions) (result *v1.CephCOSIDriver, err error) { + emptyResult := &v1.CephCOSIDriver{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephcosidriversResource, c.ns, cephCOSIDriver), &cephrookiov1.CephCOSIDriver{}) + Invokes(testing.NewCreateActionWithOptions(cephcosidriversResource, c.ns, cephCOSIDriver, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephCOSIDriver), err + return obj.(*v1.CephCOSIDriver), err } // Update takes the representation of a cephCOSIDriver and updates it. Returns the server's representation of the cephCOSIDriver, and an error, if there is any. -func (c *FakeCephCOSIDrivers) Update(ctx context.Context, cephCOSIDriver *cephrookiov1.CephCOSIDriver, opts v1.UpdateOptions) (result *cephrookiov1.CephCOSIDriver, err error) { +func (c *FakeCephCOSIDrivers) Update(ctx context.Context, cephCOSIDriver *v1.CephCOSIDriver, opts metav1.UpdateOptions) (result *v1.CephCOSIDriver, err error) { + emptyResult := &v1.CephCOSIDriver{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephcosidriversResource, c.ns, cephCOSIDriver), &cephrookiov1.CephCOSIDriver{}) + Invokes(testing.NewUpdateActionWithOptions(cephcosidriversResource, c.ns, cephCOSIDriver, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephCOSIDriver), err + return obj.(*v1.CephCOSIDriver), err } // Delete takes name of the cephCOSIDriver and deletes it. Returns an error if one occurs. -func (c *FakeCephCOSIDrivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephCOSIDrivers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephcosidriversResource, c.ns, name), &cephrookiov1.CephCOSIDriver{}) + Invokes(testing.NewDeleteActionWithOptions(cephcosidriversResource, c.ns, name, opts), &v1.CephCOSIDriver{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephCOSIDrivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephcosidriversResource, c.ns, listOpts) +func (c *FakeCephCOSIDrivers) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephcosidriversResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephCOSIDriverList{}) + _, err := c.Fake.Invokes(action, &v1.CephCOSIDriverList{}) return err } // Patch applies the patch and returns the patched cephCOSIDriver. -func (c *FakeCephCOSIDrivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephCOSIDriver, err error) { +func (c *FakeCephCOSIDrivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephCOSIDriver, err error) { + emptyResult := &v1.CephCOSIDriver{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephcosidriversResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephCOSIDriver{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephcosidriversResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephCOSIDriver), err + return obj.(*v1.CephCOSIDriver), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephfilesystem.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephfilesystem.go index 0f998e3fc..65d398902 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephfilesystem.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephfilesystem.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephFilesystems struct { ns string } -var cephfilesystemsResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephfilesystems"} +var cephfilesystemsResource = v1.SchemeGroupVersion.WithResource("cephfilesystems") -var cephfilesystemsKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephFilesystem"} +var cephfilesystemsKind = v1.SchemeGroupVersion.WithKind("CephFilesystem") // Get takes name of the cephFilesystem, and returns the corresponding cephFilesystem object, and an error if there is any. -func (c *FakeCephFilesystems) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephFilesystem, err error) { +func (c *FakeCephFilesystems) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephFilesystem, err error) { + emptyResult := &v1.CephFilesystem{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephfilesystemsResource, c.ns, name), &cephrookiov1.CephFilesystem{}) + Invokes(testing.NewGetActionWithOptions(cephfilesystemsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephFilesystem), err + return obj.(*v1.CephFilesystem), err } // List takes label and field selectors, and returns the list of CephFilesystems that match those selectors. -func (c *FakeCephFilesystems) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephFilesystemList, err error) { +func (c *FakeCephFilesystems) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephFilesystemList, err error) { + emptyResult := &v1.CephFilesystemList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephfilesystemsResource, cephfilesystemsKind, c.ns, opts), &cephrookiov1.CephFilesystemList{}) + Invokes(testing.NewListActionWithOptions(cephfilesystemsResource, cephfilesystemsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephFilesystemList{ListMeta: obj.(*cephrookiov1.CephFilesystemList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephFilesystemList).Items { + list := &v1.CephFilesystemList{ListMeta: obj.(*v1.CephFilesystemList).ListMeta} + for _, item := range obj.(*v1.CephFilesystemList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephFilesystems) List(ctx context.Context, opts v1.ListOptions) (re } // Watch returns a watch.Interface that watches the requested cephFilesystems. -func (c *FakeCephFilesystems) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephFilesystems) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephfilesystemsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephfilesystemsResource, c.ns, opts)) } // Create takes the representation of a cephFilesystem and creates it. Returns the server's representation of the cephFilesystem, and an error, if there is any. -func (c *FakeCephFilesystems) Create(ctx context.Context, cephFilesystem *cephrookiov1.CephFilesystem, opts v1.CreateOptions) (result *cephrookiov1.CephFilesystem, err error) { +func (c *FakeCephFilesystems) Create(ctx context.Context, cephFilesystem *v1.CephFilesystem, opts metav1.CreateOptions) (result *v1.CephFilesystem, err error) { + emptyResult := &v1.CephFilesystem{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephfilesystemsResource, c.ns, cephFilesystem), &cephrookiov1.CephFilesystem{}) + Invokes(testing.NewCreateActionWithOptions(cephfilesystemsResource, c.ns, cephFilesystem, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephFilesystem), err + return obj.(*v1.CephFilesystem), err } // Update takes the representation of a cephFilesystem and updates it. Returns the server's representation of the cephFilesystem, and an error, if there is any. -func (c *FakeCephFilesystems) Update(ctx context.Context, cephFilesystem *cephrookiov1.CephFilesystem, opts v1.UpdateOptions) (result *cephrookiov1.CephFilesystem, err error) { +func (c *FakeCephFilesystems) Update(ctx context.Context, cephFilesystem *v1.CephFilesystem, opts metav1.UpdateOptions) (result *v1.CephFilesystem, err error) { + emptyResult := &v1.CephFilesystem{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephfilesystemsResource, c.ns, cephFilesystem), &cephrookiov1.CephFilesystem{}) + Invokes(testing.NewUpdateActionWithOptions(cephfilesystemsResource, c.ns, cephFilesystem, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephFilesystem), err + return obj.(*v1.CephFilesystem), err } // Delete takes name of the cephFilesystem and deletes it. Returns an error if one occurs. -func (c *FakeCephFilesystems) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephFilesystems) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephfilesystemsResource, c.ns, name), &cephrookiov1.CephFilesystem{}) + Invokes(testing.NewDeleteActionWithOptions(cephfilesystemsResource, c.ns, name, opts), &v1.CephFilesystem{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephFilesystems) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephfilesystemsResource, c.ns, listOpts) +func (c *FakeCephFilesystems) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephfilesystemsResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephFilesystemList{}) + _, err := c.Fake.Invokes(action, &v1.CephFilesystemList{}) return err } // Patch applies the patch and returns the patched cephFilesystem. -func (c *FakeCephFilesystems) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephFilesystem, err error) { +func (c *FakeCephFilesystems) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephFilesystem, err error) { + emptyResult := &v1.CephFilesystem{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephfilesystemsResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephFilesystem{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephfilesystemsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephFilesystem), err + return obj.(*v1.CephFilesystem), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephfilesystemmirror.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephfilesystemmirror.go index 1394c4556..38098857e 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephfilesystemmirror.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephfilesystemmirror.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephFilesystemMirrors struct { ns string } -var cephfilesystemmirrorsResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephfilesystemmirrors"} +var cephfilesystemmirrorsResource = v1.SchemeGroupVersion.WithResource("cephfilesystemmirrors") -var cephfilesystemmirrorsKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephFilesystemMirror"} +var cephfilesystemmirrorsKind = v1.SchemeGroupVersion.WithKind("CephFilesystemMirror") // Get takes name of the cephFilesystemMirror, and returns the corresponding cephFilesystemMirror object, and an error if there is any. -func (c *FakeCephFilesystemMirrors) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephFilesystemMirror, err error) { +func (c *FakeCephFilesystemMirrors) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephFilesystemMirror, err error) { + emptyResult := &v1.CephFilesystemMirror{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephfilesystemmirrorsResource, c.ns, name), &cephrookiov1.CephFilesystemMirror{}) + Invokes(testing.NewGetActionWithOptions(cephfilesystemmirrorsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephFilesystemMirror), err + return obj.(*v1.CephFilesystemMirror), err } // List takes label and field selectors, and returns the list of CephFilesystemMirrors that match those selectors. -func (c *FakeCephFilesystemMirrors) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephFilesystemMirrorList, err error) { +func (c *FakeCephFilesystemMirrors) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephFilesystemMirrorList, err error) { + emptyResult := &v1.CephFilesystemMirrorList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephfilesystemmirrorsResource, cephfilesystemmirrorsKind, c.ns, opts), &cephrookiov1.CephFilesystemMirrorList{}) + Invokes(testing.NewListActionWithOptions(cephfilesystemmirrorsResource, cephfilesystemmirrorsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephFilesystemMirrorList{ListMeta: obj.(*cephrookiov1.CephFilesystemMirrorList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephFilesystemMirrorList).Items { + list := &v1.CephFilesystemMirrorList{ListMeta: obj.(*v1.CephFilesystemMirrorList).ListMeta} + for _, item := range obj.(*v1.CephFilesystemMirrorList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephFilesystemMirrors) List(ctx context.Context, opts v1.ListOption } // Watch returns a watch.Interface that watches the requested cephFilesystemMirrors. -func (c *FakeCephFilesystemMirrors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephFilesystemMirrors) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephfilesystemmirrorsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephfilesystemmirrorsResource, c.ns, opts)) } // Create takes the representation of a cephFilesystemMirror and creates it. Returns the server's representation of the cephFilesystemMirror, and an error, if there is any. -func (c *FakeCephFilesystemMirrors) Create(ctx context.Context, cephFilesystemMirror *cephrookiov1.CephFilesystemMirror, opts v1.CreateOptions) (result *cephrookiov1.CephFilesystemMirror, err error) { +func (c *FakeCephFilesystemMirrors) Create(ctx context.Context, cephFilesystemMirror *v1.CephFilesystemMirror, opts metav1.CreateOptions) (result *v1.CephFilesystemMirror, err error) { + emptyResult := &v1.CephFilesystemMirror{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephfilesystemmirrorsResource, c.ns, cephFilesystemMirror), &cephrookiov1.CephFilesystemMirror{}) + Invokes(testing.NewCreateActionWithOptions(cephfilesystemmirrorsResource, c.ns, cephFilesystemMirror, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephFilesystemMirror), err + return obj.(*v1.CephFilesystemMirror), err } // Update takes the representation of a cephFilesystemMirror and updates it. Returns the server's representation of the cephFilesystemMirror, and an error, if there is any. -func (c *FakeCephFilesystemMirrors) Update(ctx context.Context, cephFilesystemMirror *cephrookiov1.CephFilesystemMirror, opts v1.UpdateOptions) (result *cephrookiov1.CephFilesystemMirror, err error) { +func (c *FakeCephFilesystemMirrors) Update(ctx context.Context, cephFilesystemMirror *v1.CephFilesystemMirror, opts metav1.UpdateOptions) (result *v1.CephFilesystemMirror, err error) { + emptyResult := &v1.CephFilesystemMirror{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephfilesystemmirrorsResource, c.ns, cephFilesystemMirror), &cephrookiov1.CephFilesystemMirror{}) + Invokes(testing.NewUpdateActionWithOptions(cephfilesystemmirrorsResource, c.ns, cephFilesystemMirror, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephFilesystemMirror), err + return obj.(*v1.CephFilesystemMirror), err } // Delete takes name of the cephFilesystemMirror and deletes it. Returns an error if one occurs. -func (c *FakeCephFilesystemMirrors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephFilesystemMirrors) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephfilesystemmirrorsResource, c.ns, name), &cephrookiov1.CephFilesystemMirror{}) + Invokes(testing.NewDeleteActionWithOptions(cephfilesystemmirrorsResource, c.ns, name, opts), &v1.CephFilesystemMirror{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephFilesystemMirrors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephfilesystemmirrorsResource, c.ns, listOpts) +func (c *FakeCephFilesystemMirrors) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephfilesystemmirrorsResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephFilesystemMirrorList{}) + _, err := c.Fake.Invokes(action, &v1.CephFilesystemMirrorList{}) return err } // Patch applies the patch and returns the patched cephFilesystemMirror. -func (c *FakeCephFilesystemMirrors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephFilesystemMirror, err error) { +func (c *FakeCephFilesystemMirrors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephFilesystemMirror, err error) { + emptyResult := &v1.CephFilesystemMirror{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephfilesystemmirrorsResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephFilesystemMirror{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephfilesystemmirrorsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephFilesystemMirror), err + return obj.(*v1.CephFilesystemMirror), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephfilesystemsubvolumegroup.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephfilesystemsubvolumegroup.go index f9afe5ba1..91321b84a 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephfilesystemsubvolumegroup.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephfilesystemsubvolumegroup.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephFilesystemSubVolumeGroups struct { ns string } -var cephfilesystemsubvolumegroupsResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephfilesystemsubvolumegroups"} +var cephfilesystemsubvolumegroupsResource = v1.SchemeGroupVersion.WithResource("cephfilesystemsubvolumegroups") -var cephfilesystemsubvolumegroupsKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephFilesystemSubVolumeGroup"} +var cephfilesystemsubvolumegroupsKind = v1.SchemeGroupVersion.WithKind("CephFilesystemSubVolumeGroup") // Get takes name of the cephFilesystemSubVolumeGroup, and returns the corresponding cephFilesystemSubVolumeGroup object, and an error if there is any. -func (c *FakeCephFilesystemSubVolumeGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephFilesystemSubVolumeGroup, err error) { +func (c *FakeCephFilesystemSubVolumeGroups) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephFilesystemSubVolumeGroup, err error) { + emptyResult := &v1.CephFilesystemSubVolumeGroup{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephfilesystemsubvolumegroupsResource, c.ns, name), &cephrookiov1.CephFilesystemSubVolumeGroup{}) + Invokes(testing.NewGetActionWithOptions(cephfilesystemsubvolumegroupsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephFilesystemSubVolumeGroup), err + return obj.(*v1.CephFilesystemSubVolumeGroup), err } // List takes label and field selectors, and returns the list of CephFilesystemSubVolumeGroups that match those selectors. -func (c *FakeCephFilesystemSubVolumeGroups) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephFilesystemSubVolumeGroupList, err error) { +func (c *FakeCephFilesystemSubVolumeGroups) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephFilesystemSubVolumeGroupList, err error) { + emptyResult := &v1.CephFilesystemSubVolumeGroupList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephfilesystemsubvolumegroupsResource, cephfilesystemsubvolumegroupsKind, c.ns, opts), &cephrookiov1.CephFilesystemSubVolumeGroupList{}) + Invokes(testing.NewListActionWithOptions(cephfilesystemsubvolumegroupsResource, cephfilesystemsubvolumegroupsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephFilesystemSubVolumeGroupList{ListMeta: obj.(*cephrookiov1.CephFilesystemSubVolumeGroupList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephFilesystemSubVolumeGroupList).Items { + list := &v1.CephFilesystemSubVolumeGroupList{ListMeta: obj.(*v1.CephFilesystemSubVolumeGroupList).ListMeta} + for _, item := range obj.(*v1.CephFilesystemSubVolumeGroupList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephFilesystemSubVolumeGroups) List(ctx context.Context, opts v1.Li } // Watch returns a watch.Interface that watches the requested cephFilesystemSubVolumeGroups. -func (c *FakeCephFilesystemSubVolumeGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephFilesystemSubVolumeGroups) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephfilesystemsubvolumegroupsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephfilesystemsubvolumegroupsResource, c.ns, opts)) } // Create takes the representation of a cephFilesystemSubVolumeGroup and creates it. Returns the server's representation of the cephFilesystemSubVolumeGroup, and an error, if there is any. -func (c *FakeCephFilesystemSubVolumeGroups) Create(ctx context.Context, cephFilesystemSubVolumeGroup *cephrookiov1.CephFilesystemSubVolumeGroup, opts v1.CreateOptions) (result *cephrookiov1.CephFilesystemSubVolumeGroup, err error) { +func (c *FakeCephFilesystemSubVolumeGroups) Create(ctx context.Context, cephFilesystemSubVolumeGroup *v1.CephFilesystemSubVolumeGroup, opts metav1.CreateOptions) (result *v1.CephFilesystemSubVolumeGroup, err error) { + emptyResult := &v1.CephFilesystemSubVolumeGroup{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephfilesystemsubvolumegroupsResource, c.ns, cephFilesystemSubVolumeGroup), &cephrookiov1.CephFilesystemSubVolumeGroup{}) + Invokes(testing.NewCreateActionWithOptions(cephfilesystemsubvolumegroupsResource, c.ns, cephFilesystemSubVolumeGroup, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephFilesystemSubVolumeGroup), err + return obj.(*v1.CephFilesystemSubVolumeGroup), err } // Update takes the representation of a cephFilesystemSubVolumeGroup and updates it. Returns the server's representation of the cephFilesystemSubVolumeGroup, and an error, if there is any. -func (c *FakeCephFilesystemSubVolumeGroups) Update(ctx context.Context, cephFilesystemSubVolumeGroup *cephrookiov1.CephFilesystemSubVolumeGroup, opts v1.UpdateOptions) (result *cephrookiov1.CephFilesystemSubVolumeGroup, err error) { +func (c *FakeCephFilesystemSubVolumeGroups) Update(ctx context.Context, cephFilesystemSubVolumeGroup *v1.CephFilesystemSubVolumeGroup, opts metav1.UpdateOptions) (result *v1.CephFilesystemSubVolumeGroup, err error) { + emptyResult := &v1.CephFilesystemSubVolumeGroup{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephfilesystemsubvolumegroupsResource, c.ns, cephFilesystemSubVolumeGroup), &cephrookiov1.CephFilesystemSubVolumeGroup{}) + Invokes(testing.NewUpdateActionWithOptions(cephfilesystemsubvolumegroupsResource, c.ns, cephFilesystemSubVolumeGroup, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephFilesystemSubVolumeGroup), err + return obj.(*v1.CephFilesystemSubVolumeGroup), err } // Delete takes name of the cephFilesystemSubVolumeGroup and deletes it. Returns an error if one occurs. -func (c *FakeCephFilesystemSubVolumeGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephFilesystemSubVolumeGroups) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephfilesystemsubvolumegroupsResource, c.ns, name), &cephrookiov1.CephFilesystemSubVolumeGroup{}) + Invokes(testing.NewDeleteActionWithOptions(cephfilesystemsubvolumegroupsResource, c.ns, name, opts), &v1.CephFilesystemSubVolumeGroup{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephFilesystemSubVolumeGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephfilesystemsubvolumegroupsResource, c.ns, listOpts) +func (c *FakeCephFilesystemSubVolumeGroups) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephfilesystemsubvolumegroupsResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephFilesystemSubVolumeGroupList{}) + _, err := c.Fake.Invokes(action, &v1.CephFilesystemSubVolumeGroupList{}) return err } // Patch applies the patch and returns the patched cephFilesystemSubVolumeGroup. -func (c *FakeCephFilesystemSubVolumeGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephFilesystemSubVolumeGroup, err error) { +func (c *FakeCephFilesystemSubVolumeGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephFilesystemSubVolumeGroup, err error) { + emptyResult := &v1.CephFilesystemSubVolumeGroup{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephfilesystemsubvolumegroupsResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephFilesystemSubVolumeGroup{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephfilesystemsubvolumegroupsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephFilesystemSubVolumeGroup), err + return obj.(*v1.CephFilesystemSubVolumeGroup), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephnfs.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephnfs.go index e1059df68..d455b93a4 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephnfs.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephnfs.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephNFSes struct { ns string } -var cephnfsesResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephnfses"} +var cephnfsesResource = v1.SchemeGroupVersion.WithResource("cephnfses") -var cephnfsesKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephNFS"} +var cephnfsesKind = v1.SchemeGroupVersion.WithKind("CephNFS") // Get takes name of the cephNFS, and returns the corresponding cephNFS object, and an error if there is any. -func (c *FakeCephNFSes) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephNFS, err error) { +func (c *FakeCephNFSes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephNFS, err error) { + emptyResult := &v1.CephNFS{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephnfsesResource, c.ns, name), &cephrookiov1.CephNFS{}) + Invokes(testing.NewGetActionWithOptions(cephnfsesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephNFS), err + return obj.(*v1.CephNFS), err } // List takes label and field selectors, and returns the list of CephNFSes that match those selectors. -func (c *FakeCephNFSes) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephNFSList, err error) { +func (c *FakeCephNFSes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephNFSList, err error) { + emptyResult := &v1.CephNFSList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephnfsesResource, cephnfsesKind, c.ns, opts), &cephrookiov1.CephNFSList{}) + Invokes(testing.NewListActionWithOptions(cephnfsesResource, cephnfsesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephNFSList{ListMeta: obj.(*cephrookiov1.CephNFSList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephNFSList).Items { + list := &v1.CephNFSList{ListMeta: obj.(*v1.CephNFSList).ListMeta} + for _, item := range obj.(*v1.CephNFSList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephNFSes) List(ctx context.Context, opts v1.ListOptions) (result * } // Watch returns a watch.Interface that watches the requested cephNFSes. -func (c *FakeCephNFSes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephNFSes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephnfsesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephnfsesResource, c.ns, opts)) } // Create takes the representation of a cephNFS and creates it. Returns the server's representation of the cephNFS, and an error, if there is any. -func (c *FakeCephNFSes) Create(ctx context.Context, cephNFS *cephrookiov1.CephNFS, opts v1.CreateOptions) (result *cephrookiov1.CephNFS, err error) { +func (c *FakeCephNFSes) Create(ctx context.Context, cephNFS *v1.CephNFS, opts metav1.CreateOptions) (result *v1.CephNFS, err error) { + emptyResult := &v1.CephNFS{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephnfsesResource, c.ns, cephNFS), &cephrookiov1.CephNFS{}) + Invokes(testing.NewCreateActionWithOptions(cephnfsesResource, c.ns, cephNFS, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephNFS), err + return obj.(*v1.CephNFS), err } // Update takes the representation of a cephNFS and updates it. Returns the server's representation of the cephNFS, and an error, if there is any. -func (c *FakeCephNFSes) Update(ctx context.Context, cephNFS *cephrookiov1.CephNFS, opts v1.UpdateOptions) (result *cephrookiov1.CephNFS, err error) { +func (c *FakeCephNFSes) Update(ctx context.Context, cephNFS *v1.CephNFS, opts metav1.UpdateOptions) (result *v1.CephNFS, err error) { + emptyResult := &v1.CephNFS{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephnfsesResource, c.ns, cephNFS), &cephrookiov1.CephNFS{}) + Invokes(testing.NewUpdateActionWithOptions(cephnfsesResource, c.ns, cephNFS, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephNFS), err + return obj.(*v1.CephNFS), err } // Delete takes name of the cephNFS and deletes it. Returns an error if one occurs. -func (c *FakeCephNFSes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephNFSes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephnfsesResource, c.ns, name), &cephrookiov1.CephNFS{}) + Invokes(testing.NewDeleteActionWithOptions(cephnfsesResource, c.ns, name, opts), &v1.CephNFS{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephNFSes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephnfsesResource, c.ns, listOpts) +func (c *FakeCephNFSes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephnfsesResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephNFSList{}) + _, err := c.Fake.Invokes(action, &v1.CephNFSList{}) return err } // Patch applies the patch and returns the patched cephNFS. -func (c *FakeCephNFSes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephNFS, err error) { +func (c *FakeCephNFSes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephNFS, err error) { + emptyResult := &v1.CephNFS{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephnfsesResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephNFS{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephnfsesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephNFS), err + return obj.(*v1.CephNFS), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectrealm.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectrealm.go index 818f00d7d..307ec7f3b 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectrealm.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectrealm.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephObjectRealms struct { ns string } -var cephobjectrealmsResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephobjectrealms"} +var cephobjectrealmsResource = v1.SchemeGroupVersion.WithResource("cephobjectrealms") -var cephobjectrealmsKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephObjectRealm"} +var cephobjectrealmsKind = v1.SchemeGroupVersion.WithKind("CephObjectRealm") // Get takes name of the cephObjectRealm, and returns the corresponding cephObjectRealm object, and an error if there is any. -func (c *FakeCephObjectRealms) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephObjectRealm, err error) { +func (c *FakeCephObjectRealms) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephObjectRealm, err error) { + emptyResult := &v1.CephObjectRealm{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephobjectrealmsResource, c.ns, name), &cephrookiov1.CephObjectRealm{}) + Invokes(testing.NewGetActionWithOptions(cephobjectrealmsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectRealm), err + return obj.(*v1.CephObjectRealm), err } // List takes label and field selectors, and returns the list of CephObjectRealms that match those selectors. -func (c *FakeCephObjectRealms) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephObjectRealmList, err error) { +func (c *FakeCephObjectRealms) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephObjectRealmList, err error) { + emptyResult := &v1.CephObjectRealmList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephobjectrealmsResource, cephobjectrealmsKind, c.ns, opts), &cephrookiov1.CephObjectRealmList{}) + Invokes(testing.NewListActionWithOptions(cephobjectrealmsResource, cephobjectrealmsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephObjectRealmList{ListMeta: obj.(*cephrookiov1.CephObjectRealmList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephObjectRealmList).Items { + list := &v1.CephObjectRealmList{ListMeta: obj.(*v1.CephObjectRealmList).ListMeta} + for _, item := range obj.(*v1.CephObjectRealmList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephObjectRealms) List(ctx context.Context, opts v1.ListOptions) (r } // Watch returns a watch.Interface that watches the requested cephObjectRealms. -func (c *FakeCephObjectRealms) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephObjectRealms) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephobjectrealmsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephobjectrealmsResource, c.ns, opts)) } // Create takes the representation of a cephObjectRealm and creates it. Returns the server's representation of the cephObjectRealm, and an error, if there is any. -func (c *FakeCephObjectRealms) Create(ctx context.Context, cephObjectRealm *cephrookiov1.CephObjectRealm, opts v1.CreateOptions) (result *cephrookiov1.CephObjectRealm, err error) { +func (c *FakeCephObjectRealms) Create(ctx context.Context, cephObjectRealm *v1.CephObjectRealm, opts metav1.CreateOptions) (result *v1.CephObjectRealm, err error) { + emptyResult := &v1.CephObjectRealm{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephobjectrealmsResource, c.ns, cephObjectRealm), &cephrookiov1.CephObjectRealm{}) + Invokes(testing.NewCreateActionWithOptions(cephobjectrealmsResource, c.ns, cephObjectRealm, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectRealm), err + return obj.(*v1.CephObjectRealm), err } // Update takes the representation of a cephObjectRealm and updates it. Returns the server's representation of the cephObjectRealm, and an error, if there is any. -func (c *FakeCephObjectRealms) Update(ctx context.Context, cephObjectRealm *cephrookiov1.CephObjectRealm, opts v1.UpdateOptions) (result *cephrookiov1.CephObjectRealm, err error) { +func (c *FakeCephObjectRealms) Update(ctx context.Context, cephObjectRealm *v1.CephObjectRealm, opts metav1.UpdateOptions) (result *v1.CephObjectRealm, err error) { + emptyResult := &v1.CephObjectRealm{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephobjectrealmsResource, c.ns, cephObjectRealm), &cephrookiov1.CephObjectRealm{}) + Invokes(testing.NewUpdateActionWithOptions(cephobjectrealmsResource, c.ns, cephObjectRealm, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectRealm), err + return obj.(*v1.CephObjectRealm), err } // Delete takes name of the cephObjectRealm and deletes it. Returns an error if one occurs. -func (c *FakeCephObjectRealms) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephObjectRealms) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephobjectrealmsResource, c.ns, name), &cephrookiov1.CephObjectRealm{}) + Invokes(testing.NewDeleteActionWithOptions(cephobjectrealmsResource, c.ns, name, opts), &v1.CephObjectRealm{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephObjectRealms) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephobjectrealmsResource, c.ns, listOpts) +func (c *FakeCephObjectRealms) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephobjectrealmsResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephObjectRealmList{}) + _, err := c.Fake.Invokes(action, &v1.CephObjectRealmList{}) return err } // Patch applies the patch and returns the patched cephObjectRealm. -func (c *FakeCephObjectRealms) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephObjectRealm, err error) { +func (c *FakeCephObjectRealms) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephObjectRealm, err error) { + emptyResult := &v1.CephObjectRealm{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephobjectrealmsResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephObjectRealm{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephobjectrealmsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectRealm), err + return obj.(*v1.CephObjectRealm), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectstore.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectstore.go index f571e3809..d874b3948 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectstore.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectstore.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephObjectStores struct { ns string } -var cephobjectstoresResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephobjectstores"} +var cephobjectstoresResource = v1.SchemeGroupVersion.WithResource("cephobjectstores") -var cephobjectstoresKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephObjectStore"} +var cephobjectstoresKind = v1.SchemeGroupVersion.WithKind("CephObjectStore") // Get takes name of the cephObjectStore, and returns the corresponding cephObjectStore object, and an error if there is any. -func (c *FakeCephObjectStores) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephObjectStore, err error) { +func (c *FakeCephObjectStores) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephObjectStore, err error) { + emptyResult := &v1.CephObjectStore{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephobjectstoresResource, c.ns, name), &cephrookiov1.CephObjectStore{}) + Invokes(testing.NewGetActionWithOptions(cephobjectstoresResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectStore), err + return obj.(*v1.CephObjectStore), err } // List takes label and field selectors, and returns the list of CephObjectStores that match those selectors. -func (c *FakeCephObjectStores) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephObjectStoreList, err error) { +func (c *FakeCephObjectStores) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephObjectStoreList, err error) { + emptyResult := &v1.CephObjectStoreList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephobjectstoresResource, cephobjectstoresKind, c.ns, opts), &cephrookiov1.CephObjectStoreList{}) + Invokes(testing.NewListActionWithOptions(cephobjectstoresResource, cephobjectstoresKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephObjectStoreList{ListMeta: obj.(*cephrookiov1.CephObjectStoreList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephObjectStoreList).Items { + list := &v1.CephObjectStoreList{ListMeta: obj.(*v1.CephObjectStoreList).ListMeta} + for _, item := range obj.(*v1.CephObjectStoreList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephObjectStores) List(ctx context.Context, opts v1.ListOptions) (r } // Watch returns a watch.Interface that watches the requested cephObjectStores. -func (c *FakeCephObjectStores) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephObjectStores) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephobjectstoresResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephobjectstoresResource, c.ns, opts)) } // Create takes the representation of a cephObjectStore and creates it. Returns the server's representation of the cephObjectStore, and an error, if there is any. -func (c *FakeCephObjectStores) Create(ctx context.Context, cephObjectStore *cephrookiov1.CephObjectStore, opts v1.CreateOptions) (result *cephrookiov1.CephObjectStore, err error) { +func (c *FakeCephObjectStores) Create(ctx context.Context, cephObjectStore *v1.CephObjectStore, opts metav1.CreateOptions) (result *v1.CephObjectStore, err error) { + emptyResult := &v1.CephObjectStore{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephobjectstoresResource, c.ns, cephObjectStore), &cephrookiov1.CephObjectStore{}) + Invokes(testing.NewCreateActionWithOptions(cephobjectstoresResource, c.ns, cephObjectStore, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectStore), err + return obj.(*v1.CephObjectStore), err } // Update takes the representation of a cephObjectStore and updates it. Returns the server's representation of the cephObjectStore, and an error, if there is any. -func (c *FakeCephObjectStores) Update(ctx context.Context, cephObjectStore *cephrookiov1.CephObjectStore, opts v1.UpdateOptions) (result *cephrookiov1.CephObjectStore, err error) { +func (c *FakeCephObjectStores) Update(ctx context.Context, cephObjectStore *v1.CephObjectStore, opts metav1.UpdateOptions) (result *v1.CephObjectStore, err error) { + emptyResult := &v1.CephObjectStore{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephobjectstoresResource, c.ns, cephObjectStore), &cephrookiov1.CephObjectStore{}) + Invokes(testing.NewUpdateActionWithOptions(cephobjectstoresResource, c.ns, cephObjectStore, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectStore), err + return obj.(*v1.CephObjectStore), err } // Delete takes name of the cephObjectStore and deletes it. Returns an error if one occurs. -func (c *FakeCephObjectStores) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephObjectStores) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephobjectstoresResource, c.ns, name), &cephrookiov1.CephObjectStore{}) + Invokes(testing.NewDeleteActionWithOptions(cephobjectstoresResource, c.ns, name, opts), &v1.CephObjectStore{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephObjectStores) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephobjectstoresResource, c.ns, listOpts) +func (c *FakeCephObjectStores) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephobjectstoresResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephObjectStoreList{}) + _, err := c.Fake.Invokes(action, &v1.CephObjectStoreList{}) return err } // Patch applies the patch and returns the patched cephObjectStore. -func (c *FakeCephObjectStores) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephObjectStore, err error) { +func (c *FakeCephObjectStores) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephObjectStore, err error) { + emptyResult := &v1.CephObjectStore{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephobjectstoresResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephObjectStore{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephobjectstoresResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectStore), err + return obj.(*v1.CephObjectStore), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectstoreuser.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectstoreuser.go index ebe8f91e5..fa0ed8428 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectstoreuser.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectstoreuser.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephObjectStoreUsers struct { ns string } -var cephobjectstoreusersResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephobjectstoreusers"} +var cephobjectstoreusersResource = v1.SchemeGroupVersion.WithResource("cephobjectstoreusers") -var cephobjectstoreusersKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephObjectStoreUser"} +var cephobjectstoreusersKind = v1.SchemeGroupVersion.WithKind("CephObjectStoreUser") // Get takes name of the cephObjectStoreUser, and returns the corresponding cephObjectStoreUser object, and an error if there is any. -func (c *FakeCephObjectStoreUsers) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephObjectStoreUser, err error) { +func (c *FakeCephObjectStoreUsers) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephObjectStoreUser, err error) { + emptyResult := &v1.CephObjectStoreUser{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephobjectstoreusersResource, c.ns, name), &cephrookiov1.CephObjectStoreUser{}) + Invokes(testing.NewGetActionWithOptions(cephobjectstoreusersResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectStoreUser), err + return obj.(*v1.CephObjectStoreUser), err } // List takes label and field selectors, and returns the list of CephObjectStoreUsers that match those selectors. -func (c *FakeCephObjectStoreUsers) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephObjectStoreUserList, err error) { +func (c *FakeCephObjectStoreUsers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephObjectStoreUserList, err error) { + emptyResult := &v1.CephObjectStoreUserList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephobjectstoreusersResource, cephobjectstoreusersKind, c.ns, opts), &cephrookiov1.CephObjectStoreUserList{}) + Invokes(testing.NewListActionWithOptions(cephobjectstoreusersResource, cephobjectstoreusersKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephObjectStoreUserList{ListMeta: obj.(*cephrookiov1.CephObjectStoreUserList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephObjectStoreUserList).Items { + list := &v1.CephObjectStoreUserList{ListMeta: obj.(*v1.CephObjectStoreUserList).ListMeta} + for _, item := range obj.(*v1.CephObjectStoreUserList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephObjectStoreUsers) List(ctx context.Context, opts v1.ListOptions } // Watch returns a watch.Interface that watches the requested cephObjectStoreUsers. -func (c *FakeCephObjectStoreUsers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephObjectStoreUsers) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephobjectstoreusersResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephobjectstoreusersResource, c.ns, opts)) } // Create takes the representation of a cephObjectStoreUser and creates it. Returns the server's representation of the cephObjectStoreUser, and an error, if there is any. -func (c *FakeCephObjectStoreUsers) Create(ctx context.Context, cephObjectStoreUser *cephrookiov1.CephObjectStoreUser, opts v1.CreateOptions) (result *cephrookiov1.CephObjectStoreUser, err error) { +func (c *FakeCephObjectStoreUsers) Create(ctx context.Context, cephObjectStoreUser *v1.CephObjectStoreUser, opts metav1.CreateOptions) (result *v1.CephObjectStoreUser, err error) { + emptyResult := &v1.CephObjectStoreUser{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephobjectstoreusersResource, c.ns, cephObjectStoreUser), &cephrookiov1.CephObjectStoreUser{}) + Invokes(testing.NewCreateActionWithOptions(cephobjectstoreusersResource, c.ns, cephObjectStoreUser, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectStoreUser), err + return obj.(*v1.CephObjectStoreUser), err } // Update takes the representation of a cephObjectStoreUser and updates it. Returns the server's representation of the cephObjectStoreUser, and an error, if there is any. -func (c *FakeCephObjectStoreUsers) Update(ctx context.Context, cephObjectStoreUser *cephrookiov1.CephObjectStoreUser, opts v1.UpdateOptions) (result *cephrookiov1.CephObjectStoreUser, err error) { +func (c *FakeCephObjectStoreUsers) Update(ctx context.Context, cephObjectStoreUser *v1.CephObjectStoreUser, opts metav1.UpdateOptions) (result *v1.CephObjectStoreUser, err error) { + emptyResult := &v1.CephObjectStoreUser{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephobjectstoreusersResource, c.ns, cephObjectStoreUser), &cephrookiov1.CephObjectStoreUser{}) + Invokes(testing.NewUpdateActionWithOptions(cephobjectstoreusersResource, c.ns, cephObjectStoreUser, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectStoreUser), err + return obj.(*v1.CephObjectStoreUser), err } // Delete takes name of the cephObjectStoreUser and deletes it. Returns an error if one occurs. -func (c *FakeCephObjectStoreUsers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephObjectStoreUsers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephobjectstoreusersResource, c.ns, name), &cephrookiov1.CephObjectStoreUser{}) + Invokes(testing.NewDeleteActionWithOptions(cephobjectstoreusersResource, c.ns, name, opts), &v1.CephObjectStoreUser{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephObjectStoreUsers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephobjectstoreusersResource, c.ns, listOpts) +func (c *FakeCephObjectStoreUsers) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephobjectstoreusersResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephObjectStoreUserList{}) + _, err := c.Fake.Invokes(action, &v1.CephObjectStoreUserList{}) return err } // Patch applies the patch and returns the patched cephObjectStoreUser. -func (c *FakeCephObjectStoreUsers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephObjectStoreUser, err error) { +func (c *FakeCephObjectStoreUsers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephObjectStoreUser, err error) { + emptyResult := &v1.CephObjectStoreUser{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephobjectstoreusersResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephObjectStoreUser{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephobjectstoreusersResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectStoreUser), err + return obj.(*v1.CephObjectStoreUser), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectzone.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectzone.go index 6767576c0..7ca592e7e 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectzone.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectzone.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephObjectZones struct { ns string } -var cephobjectzonesResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephobjectzones"} +var cephobjectzonesResource = v1.SchemeGroupVersion.WithResource("cephobjectzones") -var cephobjectzonesKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephObjectZone"} +var cephobjectzonesKind = v1.SchemeGroupVersion.WithKind("CephObjectZone") // Get takes name of the cephObjectZone, and returns the corresponding cephObjectZone object, and an error if there is any. -func (c *FakeCephObjectZones) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephObjectZone, err error) { +func (c *FakeCephObjectZones) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephObjectZone, err error) { + emptyResult := &v1.CephObjectZone{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephobjectzonesResource, c.ns, name), &cephrookiov1.CephObjectZone{}) + Invokes(testing.NewGetActionWithOptions(cephobjectzonesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectZone), err + return obj.(*v1.CephObjectZone), err } // List takes label and field selectors, and returns the list of CephObjectZones that match those selectors. -func (c *FakeCephObjectZones) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephObjectZoneList, err error) { +func (c *FakeCephObjectZones) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephObjectZoneList, err error) { + emptyResult := &v1.CephObjectZoneList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephobjectzonesResource, cephobjectzonesKind, c.ns, opts), &cephrookiov1.CephObjectZoneList{}) + Invokes(testing.NewListActionWithOptions(cephobjectzonesResource, cephobjectzonesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephObjectZoneList{ListMeta: obj.(*cephrookiov1.CephObjectZoneList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephObjectZoneList).Items { + list := &v1.CephObjectZoneList{ListMeta: obj.(*v1.CephObjectZoneList).ListMeta} + for _, item := range obj.(*v1.CephObjectZoneList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephObjectZones) List(ctx context.Context, opts v1.ListOptions) (re } // Watch returns a watch.Interface that watches the requested cephObjectZones. -func (c *FakeCephObjectZones) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephObjectZones) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephobjectzonesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephobjectzonesResource, c.ns, opts)) } // Create takes the representation of a cephObjectZone and creates it. Returns the server's representation of the cephObjectZone, and an error, if there is any. -func (c *FakeCephObjectZones) Create(ctx context.Context, cephObjectZone *cephrookiov1.CephObjectZone, opts v1.CreateOptions) (result *cephrookiov1.CephObjectZone, err error) { +func (c *FakeCephObjectZones) Create(ctx context.Context, cephObjectZone *v1.CephObjectZone, opts metav1.CreateOptions) (result *v1.CephObjectZone, err error) { + emptyResult := &v1.CephObjectZone{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephobjectzonesResource, c.ns, cephObjectZone), &cephrookiov1.CephObjectZone{}) + Invokes(testing.NewCreateActionWithOptions(cephobjectzonesResource, c.ns, cephObjectZone, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectZone), err + return obj.(*v1.CephObjectZone), err } // Update takes the representation of a cephObjectZone and updates it. Returns the server's representation of the cephObjectZone, and an error, if there is any. -func (c *FakeCephObjectZones) Update(ctx context.Context, cephObjectZone *cephrookiov1.CephObjectZone, opts v1.UpdateOptions) (result *cephrookiov1.CephObjectZone, err error) { +func (c *FakeCephObjectZones) Update(ctx context.Context, cephObjectZone *v1.CephObjectZone, opts metav1.UpdateOptions) (result *v1.CephObjectZone, err error) { + emptyResult := &v1.CephObjectZone{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephobjectzonesResource, c.ns, cephObjectZone), &cephrookiov1.CephObjectZone{}) + Invokes(testing.NewUpdateActionWithOptions(cephobjectzonesResource, c.ns, cephObjectZone, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectZone), err + return obj.(*v1.CephObjectZone), err } // Delete takes name of the cephObjectZone and deletes it. Returns an error if one occurs. -func (c *FakeCephObjectZones) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephObjectZones) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephobjectzonesResource, c.ns, name), &cephrookiov1.CephObjectZone{}) + Invokes(testing.NewDeleteActionWithOptions(cephobjectzonesResource, c.ns, name, opts), &v1.CephObjectZone{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephObjectZones) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephobjectzonesResource, c.ns, listOpts) +func (c *FakeCephObjectZones) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephobjectzonesResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephObjectZoneList{}) + _, err := c.Fake.Invokes(action, &v1.CephObjectZoneList{}) return err } // Patch applies the patch and returns the patched cephObjectZone. -func (c *FakeCephObjectZones) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephObjectZone, err error) { +func (c *FakeCephObjectZones) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephObjectZone, err error) { + emptyResult := &v1.CephObjectZone{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephobjectzonesResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephObjectZone{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephobjectzonesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectZone), err + return obj.(*v1.CephObjectZone), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectzonegroup.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectzonegroup.go index 952f3a7fa..af2be5ba5 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectzonegroup.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephobjectzonegroup.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephObjectZoneGroups struct { ns string } -var cephobjectzonegroupsResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephobjectzonegroups"} +var cephobjectzonegroupsResource = v1.SchemeGroupVersion.WithResource("cephobjectzonegroups") -var cephobjectzonegroupsKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephObjectZoneGroup"} +var cephobjectzonegroupsKind = v1.SchemeGroupVersion.WithKind("CephObjectZoneGroup") // Get takes name of the cephObjectZoneGroup, and returns the corresponding cephObjectZoneGroup object, and an error if there is any. -func (c *FakeCephObjectZoneGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephObjectZoneGroup, err error) { +func (c *FakeCephObjectZoneGroups) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephObjectZoneGroup, err error) { + emptyResult := &v1.CephObjectZoneGroup{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephobjectzonegroupsResource, c.ns, name), &cephrookiov1.CephObjectZoneGroup{}) + Invokes(testing.NewGetActionWithOptions(cephobjectzonegroupsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectZoneGroup), err + return obj.(*v1.CephObjectZoneGroup), err } // List takes label and field selectors, and returns the list of CephObjectZoneGroups that match those selectors. -func (c *FakeCephObjectZoneGroups) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephObjectZoneGroupList, err error) { +func (c *FakeCephObjectZoneGroups) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephObjectZoneGroupList, err error) { + emptyResult := &v1.CephObjectZoneGroupList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephobjectzonegroupsResource, cephobjectzonegroupsKind, c.ns, opts), &cephrookiov1.CephObjectZoneGroupList{}) + Invokes(testing.NewListActionWithOptions(cephobjectzonegroupsResource, cephobjectzonegroupsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephObjectZoneGroupList{ListMeta: obj.(*cephrookiov1.CephObjectZoneGroupList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephObjectZoneGroupList).Items { + list := &v1.CephObjectZoneGroupList{ListMeta: obj.(*v1.CephObjectZoneGroupList).ListMeta} + for _, item := range obj.(*v1.CephObjectZoneGroupList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephObjectZoneGroups) List(ctx context.Context, opts v1.ListOptions } // Watch returns a watch.Interface that watches the requested cephObjectZoneGroups. -func (c *FakeCephObjectZoneGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephObjectZoneGroups) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephobjectzonegroupsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephobjectzonegroupsResource, c.ns, opts)) } // Create takes the representation of a cephObjectZoneGroup and creates it. Returns the server's representation of the cephObjectZoneGroup, and an error, if there is any. -func (c *FakeCephObjectZoneGroups) Create(ctx context.Context, cephObjectZoneGroup *cephrookiov1.CephObjectZoneGroup, opts v1.CreateOptions) (result *cephrookiov1.CephObjectZoneGroup, err error) { +func (c *FakeCephObjectZoneGroups) Create(ctx context.Context, cephObjectZoneGroup *v1.CephObjectZoneGroup, opts metav1.CreateOptions) (result *v1.CephObjectZoneGroup, err error) { + emptyResult := &v1.CephObjectZoneGroup{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephobjectzonegroupsResource, c.ns, cephObjectZoneGroup), &cephrookiov1.CephObjectZoneGroup{}) + Invokes(testing.NewCreateActionWithOptions(cephobjectzonegroupsResource, c.ns, cephObjectZoneGroup, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectZoneGroup), err + return obj.(*v1.CephObjectZoneGroup), err } // Update takes the representation of a cephObjectZoneGroup and updates it. Returns the server's representation of the cephObjectZoneGroup, and an error, if there is any. -func (c *FakeCephObjectZoneGroups) Update(ctx context.Context, cephObjectZoneGroup *cephrookiov1.CephObjectZoneGroup, opts v1.UpdateOptions) (result *cephrookiov1.CephObjectZoneGroup, err error) { +func (c *FakeCephObjectZoneGroups) Update(ctx context.Context, cephObjectZoneGroup *v1.CephObjectZoneGroup, opts metav1.UpdateOptions) (result *v1.CephObjectZoneGroup, err error) { + emptyResult := &v1.CephObjectZoneGroup{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephobjectzonegroupsResource, c.ns, cephObjectZoneGroup), &cephrookiov1.CephObjectZoneGroup{}) + Invokes(testing.NewUpdateActionWithOptions(cephobjectzonegroupsResource, c.ns, cephObjectZoneGroup, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectZoneGroup), err + return obj.(*v1.CephObjectZoneGroup), err } // Delete takes name of the cephObjectZoneGroup and deletes it. Returns an error if one occurs. -func (c *FakeCephObjectZoneGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephObjectZoneGroups) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephobjectzonegroupsResource, c.ns, name), &cephrookiov1.CephObjectZoneGroup{}) + Invokes(testing.NewDeleteActionWithOptions(cephobjectzonegroupsResource, c.ns, name, opts), &v1.CephObjectZoneGroup{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephObjectZoneGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephobjectzonegroupsResource, c.ns, listOpts) +func (c *FakeCephObjectZoneGroups) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephobjectzonegroupsResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephObjectZoneGroupList{}) + _, err := c.Fake.Invokes(action, &v1.CephObjectZoneGroupList{}) return err } // Patch applies the patch and returns the patched cephObjectZoneGroup. -func (c *FakeCephObjectZoneGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephObjectZoneGroup, err error) { +func (c *FakeCephObjectZoneGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephObjectZoneGroup, err error) { + emptyResult := &v1.CephObjectZoneGroup{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephobjectzonegroupsResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephObjectZoneGroup{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephobjectzonegroupsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephObjectZoneGroup), err + return obj.(*v1.CephObjectZoneGroup), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephrbdmirror.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephrbdmirror.go index e55fd4fab..70b237923 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephrbdmirror.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/fake/fake_cephrbdmirror.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -21,10 +21,9 @@ package fake import ( "context" - cephrookiov1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" @@ -36,36 +35,38 @@ type FakeCephRBDMirrors struct { ns string } -var cephrbdmirrorsResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1", Resource: "cephrbdmirrors"} +var cephrbdmirrorsResource = v1.SchemeGroupVersion.WithResource("cephrbdmirrors") -var cephrbdmirrorsKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1", Kind: "CephRBDMirror"} +var cephrbdmirrorsKind = v1.SchemeGroupVersion.WithKind("CephRBDMirror") // Get takes name of the cephRBDMirror, and returns the corresponding cephRBDMirror object, and an error if there is any. -func (c *FakeCephRBDMirrors) Get(ctx context.Context, name string, options v1.GetOptions) (result *cephrookiov1.CephRBDMirror, err error) { +func (c *FakeCephRBDMirrors) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CephRBDMirror, err error) { + emptyResult := &v1.CephRBDMirror{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cephrbdmirrorsResource, c.ns, name), &cephrookiov1.CephRBDMirror{}) + Invokes(testing.NewGetActionWithOptions(cephrbdmirrorsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephRBDMirror), err + return obj.(*v1.CephRBDMirror), err } // List takes label and field selectors, and returns the list of CephRBDMirrors that match those selectors. -func (c *FakeCephRBDMirrors) List(ctx context.Context, opts v1.ListOptions) (result *cephrookiov1.CephRBDMirrorList, err error) { +func (c *FakeCephRBDMirrors) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CephRBDMirrorList, err error) { + emptyResult := &v1.CephRBDMirrorList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cephrbdmirrorsResource, cephrbdmirrorsKind, c.ns, opts), &cephrookiov1.CephRBDMirrorList{}) + Invokes(testing.NewListActionWithOptions(cephrbdmirrorsResource, cephrbdmirrorsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } - list := &cephrookiov1.CephRBDMirrorList{ListMeta: obj.(*cephrookiov1.CephRBDMirrorList).ListMeta} - for _, item := range obj.(*cephrookiov1.CephRBDMirrorList).Items { + list := &v1.CephRBDMirrorList{ListMeta: obj.(*v1.CephRBDMirrorList).ListMeta} + for _, item := range obj.(*v1.CephRBDMirrorList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -74,57 +75,60 @@ func (c *FakeCephRBDMirrors) List(ctx context.Context, opts v1.ListOptions) (res } // Watch returns a watch.Interface that watches the requested cephRBDMirrors. -func (c *FakeCephRBDMirrors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCephRBDMirrors) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cephrbdmirrorsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cephrbdmirrorsResource, c.ns, opts)) } // Create takes the representation of a cephRBDMirror and creates it. Returns the server's representation of the cephRBDMirror, and an error, if there is any. -func (c *FakeCephRBDMirrors) Create(ctx context.Context, cephRBDMirror *cephrookiov1.CephRBDMirror, opts v1.CreateOptions) (result *cephrookiov1.CephRBDMirror, err error) { +func (c *FakeCephRBDMirrors) Create(ctx context.Context, cephRBDMirror *v1.CephRBDMirror, opts metav1.CreateOptions) (result *v1.CephRBDMirror, err error) { + emptyResult := &v1.CephRBDMirror{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cephrbdmirrorsResource, c.ns, cephRBDMirror), &cephrookiov1.CephRBDMirror{}) + Invokes(testing.NewCreateActionWithOptions(cephrbdmirrorsResource, c.ns, cephRBDMirror, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephRBDMirror), err + return obj.(*v1.CephRBDMirror), err } // Update takes the representation of a cephRBDMirror and updates it. Returns the server's representation of the cephRBDMirror, and an error, if there is any. -func (c *FakeCephRBDMirrors) Update(ctx context.Context, cephRBDMirror *cephrookiov1.CephRBDMirror, opts v1.UpdateOptions) (result *cephrookiov1.CephRBDMirror, err error) { +func (c *FakeCephRBDMirrors) Update(ctx context.Context, cephRBDMirror *v1.CephRBDMirror, opts metav1.UpdateOptions) (result *v1.CephRBDMirror, err error) { + emptyResult := &v1.CephRBDMirror{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cephrbdmirrorsResource, c.ns, cephRBDMirror), &cephrookiov1.CephRBDMirror{}) + Invokes(testing.NewUpdateActionWithOptions(cephrbdmirrorsResource, c.ns, cephRBDMirror, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephRBDMirror), err + return obj.(*v1.CephRBDMirror), err } // Delete takes name of the cephRBDMirror and deletes it. Returns an error if one occurs. -func (c *FakeCephRBDMirrors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCephRBDMirrors) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(cephrbdmirrorsResource, c.ns, name), &cephrookiov1.CephRBDMirror{}) + Invokes(testing.NewDeleteActionWithOptions(cephrbdmirrorsResource, c.ns, name, opts), &v1.CephRBDMirror{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCephRBDMirrors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cephrbdmirrorsResource, c.ns, listOpts) +func (c *FakeCephRBDMirrors) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(cephrbdmirrorsResource, c.ns, opts, listOpts) - _, err := c.Fake.Invokes(action, &cephrookiov1.CephRBDMirrorList{}) + _, err := c.Fake.Invokes(action, &v1.CephRBDMirrorList{}) return err } // Patch applies the patch and returns the patched cephRBDMirror. -func (c *FakeCephRBDMirrors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *cephrookiov1.CephRBDMirror, err error) { +func (c *FakeCephRBDMirrors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CephRBDMirror, err error) { + emptyResult := &v1.CephRBDMirror{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cephrbdmirrorsResource, c.ns, name, pt, data, subresources...), &cephrookiov1.CephRBDMirror{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cephrbdmirrorsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } - return obj.(*cephrookiov1.CephRBDMirror), err + return obj.(*v1.CephRBDMirror), err } diff --git a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/generated_expansion.go index ca470183b..82f716799 100644 --- a/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/ceph.rook.io/v1/generated_expansion.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/interface.go b/pkg/client/informers/externalversions/ceph.rook.io/interface.go index c2800a929..b57aa45bc 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/interface.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/interface.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephblockpool.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephblockpool.go index 63f4f6467..891dbe9f8 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephblockpool.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephblockpool.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephblockpoolradosnamespace.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephblockpoolradosnamespace.go index a01352f57..bcc5a6abc 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephblockpoolradosnamespace.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephblockpoolradosnamespace.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephbucketnotification.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephbucketnotification.go index f27c88ae5..ef8c2570f 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephbucketnotification.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephbucketnotification.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephbuckettopic.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephbuckettopic.go index 4ac2b5027..bf6581845 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephbuckettopic.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephbuckettopic.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephclient.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephclient.go index 6f07a1659..1c0088866 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephclient.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephclient.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephcluster.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephcluster.go index 23cf65440..0dc4a4e51 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephcluster.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephcluster.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephcosidriver.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephcosidriver.go index 35ce75ff6..5b2d94905 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephcosidriver.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephcosidriver.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephfilesystem.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephfilesystem.go index a08aebb93..6270d753d 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephfilesystem.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephfilesystem.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephfilesystemmirror.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephfilesystemmirror.go index b697fa68e..88a2e5cc1 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephfilesystemmirror.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephfilesystemmirror.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephfilesystemsubvolumegroup.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephfilesystemsubvolumegroup.go index 0559d0693..da12ae5eb 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephfilesystemsubvolumegroup.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephfilesystemsubvolumegroup.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephnfs.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephnfs.go index a4f0dc1dd..a9056a892 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephnfs.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephnfs.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectrealm.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectrealm.go index 9bea46d67..9519bd6a5 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectrealm.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectrealm.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectstore.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectstore.go index 4e80b1f9f..f7c087a1e 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectstore.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectstore.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectstoreuser.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectstoreuser.go index 9270c21bb..5af55a778 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectstoreuser.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectstoreuser.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectzone.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectzone.go index 4bcb3eab3..b77d3b19f 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectzone.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectzone.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectzonegroup.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectzonegroup.go index 16ad27bd0..7ee97ea29 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectzonegroup.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephobjectzonegroup.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephrbdmirror.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephrbdmirror.go index 00d095194..a7e12d741 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/cephrbdmirror.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/cephrbdmirror.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/ceph.rook.io/v1/interface.go b/pkg/client/informers/externalversions/ceph.rook.io/v1/interface.go index 922853644..41fd56d9c 100644 --- a/pkg/client/informers/externalversions/ceph.rook.io/v1/interface.go +++ b/pkg/client/informers/externalversions/ceph.rook.io/v1/interface.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index 82f3ce762..6e7d8ac21 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -42,11 +42,17 @@ type sharedInformerFactory struct { lock sync.Mutex defaultResync time.Duration customResync map[reflect.Type]time.Duration + transform cache.TransformFunc informers map[reflect.Type]cache.SharedIndexInformer // startedInformers is used for tracking which informers have been started. // This allows Start() to be called multiple times safely. startedInformers map[reflect.Type]bool + // wg tracks how many goroutines were started. + wg sync.WaitGroup + // shuttingDown is true when Shutdown has been called. It may still be running + // because it needs to wait for goroutines. + shuttingDown bool } // WithCustomResyncConfig sets a custom resync period for the specified informer types. @@ -75,6 +81,14 @@ func WithNamespace(namespace string) SharedInformerOption { } } +// WithTransform sets a transform on all informers. +func WithTransform(transform cache.TransformFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.transform = transform + return factory + } +} + // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -107,20 +121,39 @@ func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResy return factory } -// Start initializes all requested informers. func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { f.lock.Lock() defer f.lock.Unlock() + if f.shuttingDown { + return + } + for informerType, informer := range f.informers { if !f.startedInformers[informerType] { - go informer.Run(stopCh) + f.wg.Add(1) + // We need a new variable in each loop iteration, + // otherwise the goroutine would use the loop variable + // and that keeps changing. + informer := informer + go func() { + defer f.wg.Done() + informer.Run(stopCh) + }() f.startedInformers[informerType] = true } } } -// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) Shutdown() { + f.lock.Lock() + f.shuttingDown = true + f.lock.Unlock() + + // Will return immediately if there is nothing to wait for. + f.wg.Wait() +} + func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { informers := func() map[reflect.Type]cache.SharedIndexInformer { f.lock.Lock() @@ -142,7 +175,7 @@ func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[ref return res } -// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// InformerFor returns the SharedIndexInformer for obj using an internal // client. func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { f.lock.Lock() @@ -160,6 +193,7 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal } informer = newFunc(f.client, resyncPeriod) + informer.SetTransform(f.transform) f.informers[informerType] = informer return informer @@ -167,11 +201,59 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal // SharedInformerFactory provides shared informers for resources in all known // API group versions. +// +// It is typically used like this: +// +// ctx, cancel := context.Background() +// defer cancel() +// factory := NewSharedInformerFactory(client, resyncPeriod) +// defer factory.WaitForStop() // Returns immediately if nothing was started. +// genericInformer := factory.ForResource(resource) +// typedInformer := factory.SomeAPIGroup().V1().SomeType() +// factory.Start(ctx.Done()) // Start processing these informers. +// synced := factory.WaitForCacheSync(ctx.Done()) +// for v, ok := range synced { +// if !ok { +// fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v) +// return +// } +// } +// +// // Creating informers can also be created after Start, but then +// // Start must be called again: +// anotherGenericInformer := factory.ForResource(resource) +// factory.Start(ctx.Done()) type SharedInformerFactory interface { internalinterfaces.SharedInformerFactory - ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + + // Start initializes all requested informers. They are handled in goroutines + // which run until the stop channel gets closed. + // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. + Start(stopCh <-chan struct{}) + + // Shutdown marks a factory as shutting down. At that point no new + // informers can be started anymore and Start will return without + // doing anything. + // + // In addition, Shutdown blocks until all goroutines have terminated. For that + // to happen, the close channel(s) that they were started with must be closed, + // either before Shutdown gets called or while it is waiting. + // + // Shutdown may be called multiple times, even concurrently. All such calls will + // block until all goroutines have terminated. + Shutdown() + + // WaitForCacheSync blocks until all started informers' caches were synced + // or the stop channel gets closed. WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + // ForResource gives generic access to a shared informer of the matching type. + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + + // InformerFor returns the SharedIndexInformer for obj using an internal + // client. + InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer + Ceph() cephrookio.Interface } diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 1fcf03c8f..47187a033 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go index 3ea7f0171..f16bb8b3c 100644 --- a/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, diff --git a/pkg/client/listers/ceph.rook.io/v1/cephblockpool.go b/pkg/client/listers/ceph.rook.io/v1/cephblockpool.go index d7abf2034..9fffa7cae 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephblockpool.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephblockpool.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephBlockPoolLister interface { // cephBlockPoolLister implements the CephBlockPoolLister interface. type cephBlockPoolLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephBlockPool] } // NewCephBlockPoolLister returns a new CephBlockPoolLister. func NewCephBlockPoolLister(indexer cache.Indexer) CephBlockPoolLister { - return &cephBlockPoolLister{indexer: indexer} -} - -// List lists all CephBlockPools in the indexer. -func (s *cephBlockPoolLister) List(selector labels.Selector) (ret []*v1.CephBlockPool, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephBlockPool)) - }) - return ret, err + return &cephBlockPoolLister{listers.New[*v1.CephBlockPool](indexer, v1.Resource("cephblockpool"))} } // CephBlockPools returns an object that can list and get CephBlockPools. func (s *cephBlockPoolLister) CephBlockPools(namespace string) CephBlockPoolNamespaceLister { - return cephBlockPoolNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephBlockPoolNamespaceLister{listers.NewNamespaced[*v1.CephBlockPool](s.ResourceIndexer, namespace)} } // CephBlockPoolNamespaceLister helps list and get CephBlockPools. @@ -74,26 +66,5 @@ type CephBlockPoolNamespaceLister interface { // cephBlockPoolNamespaceLister implements the CephBlockPoolNamespaceLister // interface. type cephBlockPoolNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephBlockPools in the indexer for a given namespace. -func (s cephBlockPoolNamespaceLister) List(selector labels.Selector) (ret []*v1.CephBlockPool, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephBlockPool)) - }) - return ret, err -} - -// Get retrieves the CephBlockPool from the indexer for a given namespace and name. -func (s cephBlockPoolNamespaceLister) Get(name string) (*v1.CephBlockPool, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephblockpool"), name) - } - return obj.(*v1.CephBlockPool), nil + listers.ResourceIndexer[*v1.CephBlockPool] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephblockpoolradosnamespace.go b/pkg/client/listers/ceph.rook.io/v1/cephblockpoolradosnamespace.go index 22bc41973..e174916aa 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephblockpoolradosnamespace.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephblockpoolradosnamespace.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephBlockPoolRadosNamespaceLister interface { // cephBlockPoolRadosNamespaceLister implements the CephBlockPoolRadosNamespaceLister interface. type cephBlockPoolRadosNamespaceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephBlockPoolRadosNamespace] } // NewCephBlockPoolRadosNamespaceLister returns a new CephBlockPoolRadosNamespaceLister. func NewCephBlockPoolRadosNamespaceLister(indexer cache.Indexer) CephBlockPoolRadosNamespaceLister { - return &cephBlockPoolRadosNamespaceLister{indexer: indexer} -} - -// List lists all CephBlockPoolRadosNamespaces in the indexer. -func (s *cephBlockPoolRadosNamespaceLister) List(selector labels.Selector) (ret []*v1.CephBlockPoolRadosNamespace, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephBlockPoolRadosNamespace)) - }) - return ret, err + return &cephBlockPoolRadosNamespaceLister{listers.New[*v1.CephBlockPoolRadosNamespace](indexer, v1.Resource("cephblockpoolradosnamespace"))} } // CephBlockPoolRadosNamespaces returns an object that can list and get CephBlockPoolRadosNamespaces. func (s *cephBlockPoolRadosNamespaceLister) CephBlockPoolRadosNamespaces(namespace string) CephBlockPoolRadosNamespaceNamespaceLister { - return cephBlockPoolRadosNamespaceNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephBlockPoolRadosNamespaceNamespaceLister{listers.NewNamespaced[*v1.CephBlockPoolRadosNamespace](s.ResourceIndexer, namespace)} } // CephBlockPoolRadosNamespaceNamespaceLister helps list and get CephBlockPoolRadosNamespaces. @@ -74,26 +66,5 @@ type CephBlockPoolRadosNamespaceNamespaceLister interface { // cephBlockPoolRadosNamespaceNamespaceLister implements the CephBlockPoolRadosNamespaceNamespaceLister // interface. type cephBlockPoolRadosNamespaceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephBlockPoolRadosNamespaces in the indexer for a given namespace. -func (s cephBlockPoolRadosNamespaceNamespaceLister) List(selector labels.Selector) (ret []*v1.CephBlockPoolRadosNamespace, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephBlockPoolRadosNamespace)) - }) - return ret, err -} - -// Get retrieves the CephBlockPoolRadosNamespace from the indexer for a given namespace and name. -func (s cephBlockPoolRadosNamespaceNamespaceLister) Get(name string) (*v1.CephBlockPoolRadosNamespace, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephblockpoolradosnamespace"), name) - } - return obj.(*v1.CephBlockPoolRadosNamespace), nil + listers.ResourceIndexer[*v1.CephBlockPoolRadosNamespace] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephbucketnotification.go b/pkg/client/listers/ceph.rook.io/v1/cephbucketnotification.go index 7dd37522d..86e77c6d5 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephbucketnotification.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephbucketnotification.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephBucketNotificationLister interface { // cephBucketNotificationLister implements the CephBucketNotificationLister interface. type cephBucketNotificationLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephBucketNotification] } // NewCephBucketNotificationLister returns a new CephBucketNotificationLister. func NewCephBucketNotificationLister(indexer cache.Indexer) CephBucketNotificationLister { - return &cephBucketNotificationLister{indexer: indexer} -} - -// List lists all CephBucketNotifications in the indexer. -func (s *cephBucketNotificationLister) List(selector labels.Selector) (ret []*v1.CephBucketNotification, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephBucketNotification)) - }) - return ret, err + return &cephBucketNotificationLister{listers.New[*v1.CephBucketNotification](indexer, v1.Resource("cephbucketnotification"))} } // CephBucketNotifications returns an object that can list and get CephBucketNotifications. func (s *cephBucketNotificationLister) CephBucketNotifications(namespace string) CephBucketNotificationNamespaceLister { - return cephBucketNotificationNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephBucketNotificationNamespaceLister{listers.NewNamespaced[*v1.CephBucketNotification](s.ResourceIndexer, namespace)} } // CephBucketNotificationNamespaceLister helps list and get CephBucketNotifications. @@ -74,26 +66,5 @@ type CephBucketNotificationNamespaceLister interface { // cephBucketNotificationNamespaceLister implements the CephBucketNotificationNamespaceLister // interface. type cephBucketNotificationNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephBucketNotifications in the indexer for a given namespace. -func (s cephBucketNotificationNamespaceLister) List(selector labels.Selector) (ret []*v1.CephBucketNotification, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephBucketNotification)) - }) - return ret, err -} - -// Get retrieves the CephBucketNotification from the indexer for a given namespace and name. -func (s cephBucketNotificationNamespaceLister) Get(name string) (*v1.CephBucketNotification, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephbucketnotification"), name) - } - return obj.(*v1.CephBucketNotification), nil + listers.ResourceIndexer[*v1.CephBucketNotification] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephbuckettopic.go b/pkg/client/listers/ceph.rook.io/v1/cephbuckettopic.go index 01906ab35..1460ad8a2 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephbuckettopic.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephbuckettopic.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephBucketTopicLister interface { // cephBucketTopicLister implements the CephBucketTopicLister interface. type cephBucketTopicLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephBucketTopic] } // NewCephBucketTopicLister returns a new CephBucketTopicLister. func NewCephBucketTopicLister(indexer cache.Indexer) CephBucketTopicLister { - return &cephBucketTopicLister{indexer: indexer} -} - -// List lists all CephBucketTopics in the indexer. -func (s *cephBucketTopicLister) List(selector labels.Selector) (ret []*v1.CephBucketTopic, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephBucketTopic)) - }) - return ret, err + return &cephBucketTopicLister{listers.New[*v1.CephBucketTopic](indexer, v1.Resource("cephbuckettopic"))} } // CephBucketTopics returns an object that can list and get CephBucketTopics. func (s *cephBucketTopicLister) CephBucketTopics(namespace string) CephBucketTopicNamespaceLister { - return cephBucketTopicNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephBucketTopicNamespaceLister{listers.NewNamespaced[*v1.CephBucketTopic](s.ResourceIndexer, namespace)} } // CephBucketTopicNamespaceLister helps list and get CephBucketTopics. @@ -74,26 +66,5 @@ type CephBucketTopicNamespaceLister interface { // cephBucketTopicNamespaceLister implements the CephBucketTopicNamespaceLister // interface. type cephBucketTopicNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephBucketTopics in the indexer for a given namespace. -func (s cephBucketTopicNamespaceLister) List(selector labels.Selector) (ret []*v1.CephBucketTopic, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephBucketTopic)) - }) - return ret, err -} - -// Get retrieves the CephBucketTopic from the indexer for a given namespace and name. -func (s cephBucketTopicNamespaceLister) Get(name string) (*v1.CephBucketTopic, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephbuckettopic"), name) - } - return obj.(*v1.CephBucketTopic), nil + listers.ResourceIndexer[*v1.CephBucketTopic] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephclient.go b/pkg/client/listers/ceph.rook.io/v1/cephclient.go index c867d349d..876e552b1 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephclient.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephclient.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephClientLister interface { // cephClientLister implements the CephClientLister interface. type cephClientLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephClient] } // NewCephClientLister returns a new CephClientLister. func NewCephClientLister(indexer cache.Indexer) CephClientLister { - return &cephClientLister{indexer: indexer} -} - -// List lists all CephClients in the indexer. -func (s *cephClientLister) List(selector labels.Selector) (ret []*v1.CephClient, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephClient)) - }) - return ret, err + return &cephClientLister{listers.New[*v1.CephClient](indexer, v1.Resource("cephclient"))} } // CephClients returns an object that can list and get CephClients. func (s *cephClientLister) CephClients(namespace string) CephClientNamespaceLister { - return cephClientNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephClientNamespaceLister{listers.NewNamespaced[*v1.CephClient](s.ResourceIndexer, namespace)} } // CephClientNamespaceLister helps list and get CephClients. @@ -74,26 +66,5 @@ type CephClientNamespaceLister interface { // cephClientNamespaceLister implements the CephClientNamespaceLister // interface. type cephClientNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephClients in the indexer for a given namespace. -func (s cephClientNamespaceLister) List(selector labels.Selector) (ret []*v1.CephClient, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephClient)) - }) - return ret, err -} - -// Get retrieves the CephClient from the indexer for a given namespace and name. -func (s cephClientNamespaceLister) Get(name string) (*v1.CephClient, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephclient"), name) - } - return obj.(*v1.CephClient), nil + listers.ResourceIndexer[*v1.CephClient] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephcluster.go b/pkg/client/listers/ceph.rook.io/v1/cephcluster.go index 1008cb28b..027f14a2c 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephcluster.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephcluster.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephClusterLister interface { // cephClusterLister implements the CephClusterLister interface. type cephClusterLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephCluster] } // NewCephClusterLister returns a new CephClusterLister. func NewCephClusterLister(indexer cache.Indexer) CephClusterLister { - return &cephClusterLister{indexer: indexer} -} - -// List lists all CephClusters in the indexer. -func (s *cephClusterLister) List(selector labels.Selector) (ret []*v1.CephCluster, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephCluster)) - }) - return ret, err + return &cephClusterLister{listers.New[*v1.CephCluster](indexer, v1.Resource("cephcluster"))} } // CephClusters returns an object that can list and get CephClusters. func (s *cephClusterLister) CephClusters(namespace string) CephClusterNamespaceLister { - return cephClusterNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephClusterNamespaceLister{listers.NewNamespaced[*v1.CephCluster](s.ResourceIndexer, namespace)} } // CephClusterNamespaceLister helps list and get CephClusters. @@ -74,26 +66,5 @@ type CephClusterNamespaceLister interface { // cephClusterNamespaceLister implements the CephClusterNamespaceLister // interface. type cephClusterNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephClusters in the indexer for a given namespace. -func (s cephClusterNamespaceLister) List(selector labels.Selector) (ret []*v1.CephCluster, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephCluster)) - }) - return ret, err -} - -// Get retrieves the CephCluster from the indexer for a given namespace and name. -func (s cephClusterNamespaceLister) Get(name string) (*v1.CephCluster, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephcluster"), name) - } - return obj.(*v1.CephCluster), nil + listers.ResourceIndexer[*v1.CephCluster] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephcosidriver.go b/pkg/client/listers/ceph.rook.io/v1/cephcosidriver.go index fff30dd0a..080ce6c18 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephcosidriver.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephcosidriver.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephCOSIDriverLister interface { // cephCOSIDriverLister implements the CephCOSIDriverLister interface. type cephCOSIDriverLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephCOSIDriver] } // NewCephCOSIDriverLister returns a new CephCOSIDriverLister. func NewCephCOSIDriverLister(indexer cache.Indexer) CephCOSIDriverLister { - return &cephCOSIDriverLister{indexer: indexer} -} - -// List lists all CephCOSIDrivers in the indexer. -func (s *cephCOSIDriverLister) List(selector labels.Selector) (ret []*v1.CephCOSIDriver, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephCOSIDriver)) - }) - return ret, err + return &cephCOSIDriverLister{listers.New[*v1.CephCOSIDriver](indexer, v1.Resource("cephcosidriver"))} } // CephCOSIDrivers returns an object that can list and get CephCOSIDrivers. func (s *cephCOSIDriverLister) CephCOSIDrivers(namespace string) CephCOSIDriverNamespaceLister { - return cephCOSIDriverNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephCOSIDriverNamespaceLister{listers.NewNamespaced[*v1.CephCOSIDriver](s.ResourceIndexer, namespace)} } // CephCOSIDriverNamespaceLister helps list and get CephCOSIDrivers. @@ -74,26 +66,5 @@ type CephCOSIDriverNamespaceLister interface { // cephCOSIDriverNamespaceLister implements the CephCOSIDriverNamespaceLister // interface. type cephCOSIDriverNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephCOSIDrivers in the indexer for a given namespace. -func (s cephCOSIDriverNamespaceLister) List(selector labels.Selector) (ret []*v1.CephCOSIDriver, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephCOSIDriver)) - }) - return ret, err -} - -// Get retrieves the CephCOSIDriver from the indexer for a given namespace and name. -func (s cephCOSIDriverNamespaceLister) Get(name string) (*v1.CephCOSIDriver, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephcosidriver"), name) - } - return obj.(*v1.CephCOSIDriver), nil + listers.ResourceIndexer[*v1.CephCOSIDriver] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephfilesystem.go b/pkg/client/listers/ceph.rook.io/v1/cephfilesystem.go index c581c5d5d..007f86713 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephfilesystem.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephfilesystem.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephFilesystemLister interface { // cephFilesystemLister implements the CephFilesystemLister interface. type cephFilesystemLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephFilesystem] } // NewCephFilesystemLister returns a new CephFilesystemLister. func NewCephFilesystemLister(indexer cache.Indexer) CephFilesystemLister { - return &cephFilesystemLister{indexer: indexer} -} - -// List lists all CephFilesystems in the indexer. -func (s *cephFilesystemLister) List(selector labels.Selector) (ret []*v1.CephFilesystem, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephFilesystem)) - }) - return ret, err + return &cephFilesystemLister{listers.New[*v1.CephFilesystem](indexer, v1.Resource("cephfilesystem"))} } // CephFilesystems returns an object that can list and get CephFilesystems. func (s *cephFilesystemLister) CephFilesystems(namespace string) CephFilesystemNamespaceLister { - return cephFilesystemNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephFilesystemNamespaceLister{listers.NewNamespaced[*v1.CephFilesystem](s.ResourceIndexer, namespace)} } // CephFilesystemNamespaceLister helps list and get CephFilesystems. @@ -74,26 +66,5 @@ type CephFilesystemNamespaceLister interface { // cephFilesystemNamespaceLister implements the CephFilesystemNamespaceLister // interface. type cephFilesystemNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephFilesystems in the indexer for a given namespace. -func (s cephFilesystemNamespaceLister) List(selector labels.Selector) (ret []*v1.CephFilesystem, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephFilesystem)) - }) - return ret, err -} - -// Get retrieves the CephFilesystem from the indexer for a given namespace and name. -func (s cephFilesystemNamespaceLister) Get(name string) (*v1.CephFilesystem, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephfilesystem"), name) - } - return obj.(*v1.CephFilesystem), nil + listers.ResourceIndexer[*v1.CephFilesystem] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephfilesystemmirror.go b/pkg/client/listers/ceph.rook.io/v1/cephfilesystemmirror.go index a686b27e6..7109435ca 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephfilesystemmirror.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephfilesystemmirror.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephFilesystemMirrorLister interface { // cephFilesystemMirrorLister implements the CephFilesystemMirrorLister interface. type cephFilesystemMirrorLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephFilesystemMirror] } // NewCephFilesystemMirrorLister returns a new CephFilesystemMirrorLister. func NewCephFilesystemMirrorLister(indexer cache.Indexer) CephFilesystemMirrorLister { - return &cephFilesystemMirrorLister{indexer: indexer} -} - -// List lists all CephFilesystemMirrors in the indexer. -func (s *cephFilesystemMirrorLister) List(selector labels.Selector) (ret []*v1.CephFilesystemMirror, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephFilesystemMirror)) - }) - return ret, err + return &cephFilesystemMirrorLister{listers.New[*v1.CephFilesystemMirror](indexer, v1.Resource("cephfilesystemmirror"))} } // CephFilesystemMirrors returns an object that can list and get CephFilesystemMirrors. func (s *cephFilesystemMirrorLister) CephFilesystemMirrors(namespace string) CephFilesystemMirrorNamespaceLister { - return cephFilesystemMirrorNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephFilesystemMirrorNamespaceLister{listers.NewNamespaced[*v1.CephFilesystemMirror](s.ResourceIndexer, namespace)} } // CephFilesystemMirrorNamespaceLister helps list and get CephFilesystemMirrors. @@ -74,26 +66,5 @@ type CephFilesystemMirrorNamespaceLister interface { // cephFilesystemMirrorNamespaceLister implements the CephFilesystemMirrorNamespaceLister // interface. type cephFilesystemMirrorNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephFilesystemMirrors in the indexer for a given namespace. -func (s cephFilesystemMirrorNamespaceLister) List(selector labels.Selector) (ret []*v1.CephFilesystemMirror, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephFilesystemMirror)) - }) - return ret, err -} - -// Get retrieves the CephFilesystemMirror from the indexer for a given namespace and name. -func (s cephFilesystemMirrorNamespaceLister) Get(name string) (*v1.CephFilesystemMirror, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephfilesystemmirror"), name) - } - return obj.(*v1.CephFilesystemMirror), nil + listers.ResourceIndexer[*v1.CephFilesystemMirror] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephfilesystemsubvolumegroup.go b/pkg/client/listers/ceph.rook.io/v1/cephfilesystemsubvolumegroup.go index 5397d0a9e..61defe862 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephfilesystemsubvolumegroup.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephfilesystemsubvolumegroup.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephFilesystemSubVolumeGroupLister interface { // cephFilesystemSubVolumeGroupLister implements the CephFilesystemSubVolumeGroupLister interface. type cephFilesystemSubVolumeGroupLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephFilesystemSubVolumeGroup] } // NewCephFilesystemSubVolumeGroupLister returns a new CephFilesystemSubVolumeGroupLister. func NewCephFilesystemSubVolumeGroupLister(indexer cache.Indexer) CephFilesystemSubVolumeGroupLister { - return &cephFilesystemSubVolumeGroupLister{indexer: indexer} -} - -// List lists all CephFilesystemSubVolumeGroups in the indexer. -func (s *cephFilesystemSubVolumeGroupLister) List(selector labels.Selector) (ret []*v1.CephFilesystemSubVolumeGroup, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephFilesystemSubVolumeGroup)) - }) - return ret, err + return &cephFilesystemSubVolumeGroupLister{listers.New[*v1.CephFilesystemSubVolumeGroup](indexer, v1.Resource("cephfilesystemsubvolumegroup"))} } // CephFilesystemSubVolumeGroups returns an object that can list and get CephFilesystemSubVolumeGroups. func (s *cephFilesystemSubVolumeGroupLister) CephFilesystemSubVolumeGroups(namespace string) CephFilesystemSubVolumeGroupNamespaceLister { - return cephFilesystemSubVolumeGroupNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephFilesystemSubVolumeGroupNamespaceLister{listers.NewNamespaced[*v1.CephFilesystemSubVolumeGroup](s.ResourceIndexer, namespace)} } // CephFilesystemSubVolumeGroupNamespaceLister helps list and get CephFilesystemSubVolumeGroups. @@ -74,26 +66,5 @@ type CephFilesystemSubVolumeGroupNamespaceLister interface { // cephFilesystemSubVolumeGroupNamespaceLister implements the CephFilesystemSubVolumeGroupNamespaceLister // interface. type cephFilesystemSubVolumeGroupNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephFilesystemSubVolumeGroups in the indexer for a given namespace. -func (s cephFilesystemSubVolumeGroupNamespaceLister) List(selector labels.Selector) (ret []*v1.CephFilesystemSubVolumeGroup, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephFilesystemSubVolumeGroup)) - }) - return ret, err -} - -// Get retrieves the CephFilesystemSubVolumeGroup from the indexer for a given namespace and name. -func (s cephFilesystemSubVolumeGroupNamespaceLister) Get(name string) (*v1.CephFilesystemSubVolumeGroup, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephfilesystemsubvolumegroup"), name) - } - return obj.(*v1.CephFilesystemSubVolumeGroup), nil + listers.ResourceIndexer[*v1.CephFilesystemSubVolumeGroup] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephnfs.go b/pkg/client/listers/ceph.rook.io/v1/cephnfs.go index 5834cdc7a..ea2de13f1 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephnfs.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephnfs.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephNFSLister interface { // cephNFSLister implements the CephNFSLister interface. type cephNFSLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephNFS] } // NewCephNFSLister returns a new CephNFSLister. func NewCephNFSLister(indexer cache.Indexer) CephNFSLister { - return &cephNFSLister{indexer: indexer} -} - -// List lists all CephNFSes in the indexer. -func (s *cephNFSLister) List(selector labels.Selector) (ret []*v1.CephNFS, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephNFS)) - }) - return ret, err + return &cephNFSLister{listers.New[*v1.CephNFS](indexer, v1.Resource("cephnfs"))} } // CephNFSes returns an object that can list and get CephNFSes. func (s *cephNFSLister) CephNFSes(namespace string) CephNFSNamespaceLister { - return cephNFSNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephNFSNamespaceLister{listers.NewNamespaced[*v1.CephNFS](s.ResourceIndexer, namespace)} } // CephNFSNamespaceLister helps list and get CephNFSes. @@ -74,26 +66,5 @@ type CephNFSNamespaceLister interface { // cephNFSNamespaceLister implements the CephNFSNamespaceLister // interface. type cephNFSNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephNFSes in the indexer for a given namespace. -func (s cephNFSNamespaceLister) List(selector labels.Selector) (ret []*v1.CephNFS, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephNFS)) - }) - return ret, err -} - -// Get retrieves the CephNFS from the indexer for a given namespace and name. -func (s cephNFSNamespaceLister) Get(name string) (*v1.CephNFS, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephnfs"), name) - } - return obj.(*v1.CephNFS), nil + listers.ResourceIndexer[*v1.CephNFS] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephobjectrealm.go b/pkg/client/listers/ceph.rook.io/v1/cephobjectrealm.go index bd6cc248d..8cc8279eb 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephobjectrealm.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephobjectrealm.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephObjectRealmLister interface { // cephObjectRealmLister implements the CephObjectRealmLister interface. type cephObjectRealmLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephObjectRealm] } // NewCephObjectRealmLister returns a new CephObjectRealmLister. func NewCephObjectRealmLister(indexer cache.Indexer) CephObjectRealmLister { - return &cephObjectRealmLister{indexer: indexer} -} - -// List lists all CephObjectRealms in the indexer. -func (s *cephObjectRealmLister) List(selector labels.Selector) (ret []*v1.CephObjectRealm, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephObjectRealm)) - }) - return ret, err + return &cephObjectRealmLister{listers.New[*v1.CephObjectRealm](indexer, v1.Resource("cephobjectrealm"))} } // CephObjectRealms returns an object that can list and get CephObjectRealms. func (s *cephObjectRealmLister) CephObjectRealms(namespace string) CephObjectRealmNamespaceLister { - return cephObjectRealmNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephObjectRealmNamespaceLister{listers.NewNamespaced[*v1.CephObjectRealm](s.ResourceIndexer, namespace)} } // CephObjectRealmNamespaceLister helps list and get CephObjectRealms. @@ -74,26 +66,5 @@ type CephObjectRealmNamespaceLister interface { // cephObjectRealmNamespaceLister implements the CephObjectRealmNamespaceLister // interface. type cephObjectRealmNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephObjectRealms in the indexer for a given namespace. -func (s cephObjectRealmNamespaceLister) List(selector labels.Selector) (ret []*v1.CephObjectRealm, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephObjectRealm)) - }) - return ret, err -} - -// Get retrieves the CephObjectRealm from the indexer for a given namespace and name. -func (s cephObjectRealmNamespaceLister) Get(name string) (*v1.CephObjectRealm, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephobjectrealm"), name) - } - return obj.(*v1.CephObjectRealm), nil + listers.ResourceIndexer[*v1.CephObjectRealm] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephobjectstore.go b/pkg/client/listers/ceph.rook.io/v1/cephobjectstore.go index eae500108..b1ef8eb22 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephobjectstore.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephobjectstore.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephObjectStoreLister interface { // cephObjectStoreLister implements the CephObjectStoreLister interface. type cephObjectStoreLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephObjectStore] } // NewCephObjectStoreLister returns a new CephObjectStoreLister. func NewCephObjectStoreLister(indexer cache.Indexer) CephObjectStoreLister { - return &cephObjectStoreLister{indexer: indexer} -} - -// List lists all CephObjectStores in the indexer. -func (s *cephObjectStoreLister) List(selector labels.Selector) (ret []*v1.CephObjectStore, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephObjectStore)) - }) - return ret, err + return &cephObjectStoreLister{listers.New[*v1.CephObjectStore](indexer, v1.Resource("cephobjectstore"))} } // CephObjectStores returns an object that can list and get CephObjectStores. func (s *cephObjectStoreLister) CephObjectStores(namespace string) CephObjectStoreNamespaceLister { - return cephObjectStoreNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephObjectStoreNamespaceLister{listers.NewNamespaced[*v1.CephObjectStore](s.ResourceIndexer, namespace)} } // CephObjectStoreNamespaceLister helps list and get CephObjectStores. @@ -74,26 +66,5 @@ type CephObjectStoreNamespaceLister interface { // cephObjectStoreNamespaceLister implements the CephObjectStoreNamespaceLister // interface. type cephObjectStoreNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephObjectStores in the indexer for a given namespace. -func (s cephObjectStoreNamespaceLister) List(selector labels.Selector) (ret []*v1.CephObjectStore, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephObjectStore)) - }) - return ret, err -} - -// Get retrieves the CephObjectStore from the indexer for a given namespace and name. -func (s cephObjectStoreNamespaceLister) Get(name string) (*v1.CephObjectStore, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephobjectstore"), name) - } - return obj.(*v1.CephObjectStore), nil + listers.ResourceIndexer[*v1.CephObjectStore] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephobjectstoreuser.go b/pkg/client/listers/ceph.rook.io/v1/cephobjectstoreuser.go index 7def59fa6..fba3dcc82 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephobjectstoreuser.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephobjectstoreuser.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephObjectStoreUserLister interface { // cephObjectStoreUserLister implements the CephObjectStoreUserLister interface. type cephObjectStoreUserLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephObjectStoreUser] } // NewCephObjectStoreUserLister returns a new CephObjectStoreUserLister. func NewCephObjectStoreUserLister(indexer cache.Indexer) CephObjectStoreUserLister { - return &cephObjectStoreUserLister{indexer: indexer} -} - -// List lists all CephObjectStoreUsers in the indexer. -func (s *cephObjectStoreUserLister) List(selector labels.Selector) (ret []*v1.CephObjectStoreUser, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephObjectStoreUser)) - }) - return ret, err + return &cephObjectStoreUserLister{listers.New[*v1.CephObjectStoreUser](indexer, v1.Resource("cephobjectstoreuser"))} } // CephObjectStoreUsers returns an object that can list and get CephObjectStoreUsers. func (s *cephObjectStoreUserLister) CephObjectStoreUsers(namespace string) CephObjectStoreUserNamespaceLister { - return cephObjectStoreUserNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephObjectStoreUserNamespaceLister{listers.NewNamespaced[*v1.CephObjectStoreUser](s.ResourceIndexer, namespace)} } // CephObjectStoreUserNamespaceLister helps list and get CephObjectStoreUsers. @@ -74,26 +66,5 @@ type CephObjectStoreUserNamespaceLister interface { // cephObjectStoreUserNamespaceLister implements the CephObjectStoreUserNamespaceLister // interface. type cephObjectStoreUserNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephObjectStoreUsers in the indexer for a given namespace. -func (s cephObjectStoreUserNamespaceLister) List(selector labels.Selector) (ret []*v1.CephObjectStoreUser, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephObjectStoreUser)) - }) - return ret, err -} - -// Get retrieves the CephObjectStoreUser from the indexer for a given namespace and name. -func (s cephObjectStoreUserNamespaceLister) Get(name string) (*v1.CephObjectStoreUser, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephobjectstoreuser"), name) - } - return obj.(*v1.CephObjectStoreUser), nil + listers.ResourceIndexer[*v1.CephObjectStoreUser] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephobjectzone.go b/pkg/client/listers/ceph.rook.io/v1/cephobjectzone.go index 6f236f81e..4963f2c01 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephobjectzone.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephobjectzone.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephObjectZoneLister interface { // cephObjectZoneLister implements the CephObjectZoneLister interface. type cephObjectZoneLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephObjectZone] } // NewCephObjectZoneLister returns a new CephObjectZoneLister. func NewCephObjectZoneLister(indexer cache.Indexer) CephObjectZoneLister { - return &cephObjectZoneLister{indexer: indexer} -} - -// List lists all CephObjectZones in the indexer. -func (s *cephObjectZoneLister) List(selector labels.Selector) (ret []*v1.CephObjectZone, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephObjectZone)) - }) - return ret, err + return &cephObjectZoneLister{listers.New[*v1.CephObjectZone](indexer, v1.Resource("cephobjectzone"))} } // CephObjectZones returns an object that can list and get CephObjectZones. func (s *cephObjectZoneLister) CephObjectZones(namespace string) CephObjectZoneNamespaceLister { - return cephObjectZoneNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephObjectZoneNamespaceLister{listers.NewNamespaced[*v1.CephObjectZone](s.ResourceIndexer, namespace)} } // CephObjectZoneNamespaceLister helps list and get CephObjectZones. @@ -74,26 +66,5 @@ type CephObjectZoneNamespaceLister interface { // cephObjectZoneNamespaceLister implements the CephObjectZoneNamespaceLister // interface. type cephObjectZoneNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephObjectZones in the indexer for a given namespace. -func (s cephObjectZoneNamespaceLister) List(selector labels.Selector) (ret []*v1.CephObjectZone, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephObjectZone)) - }) - return ret, err -} - -// Get retrieves the CephObjectZone from the indexer for a given namespace and name. -func (s cephObjectZoneNamespaceLister) Get(name string) (*v1.CephObjectZone, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephobjectzone"), name) - } - return obj.(*v1.CephObjectZone), nil + listers.ResourceIndexer[*v1.CephObjectZone] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephobjectzonegroup.go b/pkg/client/listers/ceph.rook.io/v1/cephobjectzonegroup.go index 0253487f8..01231adb7 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephobjectzonegroup.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephobjectzonegroup.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephObjectZoneGroupLister interface { // cephObjectZoneGroupLister implements the CephObjectZoneGroupLister interface. type cephObjectZoneGroupLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephObjectZoneGroup] } // NewCephObjectZoneGroupLister returns a new CephObjectZoneGroupLister. func NewCephObjectZoneGroupLister(indexer cache.Indexer) CephObjectZoneGroupLister { - return &cephObjectZoneGroupLister{indexer: indexer} -} - -// List lists all CephObjectZoneGroups in the indexer. -func (s *cephObjectZoneGroupLister) List(selector labels.Selector) (ret []*v1.CephObjectZoneGroup, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephObjectZoneGroup)) - }) - return ret, err + return &cephObjectZoneGroupLister{listers.New[*v1.CephObjectZoneGroup](indexer, v1.Resource("cephobjectzonegroup"))} } // CephObjectZoneGroups returns an object that can list and get CephObjectZoneGroups. func (s *cephObjectZoneGroupLister) CephObjectZoneGroups(namespace string) CephObjectZoneGroupNamespaceLister { - return cephObjectZoneGroupNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephObjectZoneGroupNamespaceLister{listers.NewNamespaced[*v1.CephObjectZoneGroup](s.ResourceIndexer, namespace)} } // CephObjectZoneGroupNamespaceLister helps list and get CephObjectZoneGroups. @@ -74,26 +66,5 @@ type CephObjectZoneGroupNamespaceLister interface { // cephObjectZoneGroupNamespaceLister implements the CephObjectZoneGroupNamespaceLister // interface. type cephObjectZoneGroupNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephObjectZoneGroups in the indexer for a given namespace. -func (s cephObjectZoneGroupNamespaceLister) List(selector labels.Selector) (ret []*v1.CephObjectZoneGroup, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephObjectZoneGroup)) - }) - return ret, err -} - -// Get retrieves the CephObjectZoneGroup from the indexer for a given namespace and name. -func (s cephObjectZoneGroupNamespaceLister) Get(name string) (*v1.CephObjectZoneGroup, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephobjectzonegroup"), name) - } - return obj.(*v1.CephObjectZoneGroup), nil + listers.ResourceIndexer[*v1.CephObjectZoneGroup] } diff --git a/pkg/client/listers/ceph.rook.io/v1/cephrbdmirror.go b/pkg/client/listers/ceph.rook.io/v1/cephrbdmirror.go index dc8e2d5e0..2c66e40b3 100644 --- a/pkg/client/listers/ceph.rook.io/v1/cephrbdmirror.go +++ b/pkg/client/listers/ceph.rook.io/v1/cephrbdmirror.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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, @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CephRBDMirrorLister interface { // cephRBDMirrorLister implements the CephRBDMirrorLister interface. type cephRBDMirrorLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.CephRBDMirror] } // NewCephRBDMirrorLister returns a new CephRBDMirrorLister. func NewCephRBDMirrorLister(indexer cache.Indexer) CephRBDMirrorLister { - return &cephRBDMirrorLister{indexer: indexer} -} - -// List lists all CephRBDMirrors in the indexer. -func (s *cephRBDMirrorLister) List(selector labels.Selector) (ret []*v1.CephRBDMirror, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephRBDMirror)) - }) - return ret, err + return &cephRBDMirrorLister{listers.New[*v1.CephRBDMirror](indexer, v1.Resource("cephrbdmirror"))} } // CephRBDMirrors returns an object that can list and get CephRBDMirrors. func (s *cephRBDMirrorLister) CephRBDMirrors(namespace string) CephRBDMirrorNamespaceLister { - return cephRBDMirrorNamespaceLister{indexer: s.indexer, namespace: namespace} + return cephRBDMirrorNamespaceLister{listers.NewNamespaced[*v1.CephRBDMirror](s.ResourceIndexer, namespace)} } // CephRBDMirrorNamespaceLister helps list and get CephRBDMirrors. @@ -74,26 +66,5 @@ type CephRBDMirrorNamespaceLister interface { // cephRBDMirrorNamespaceLister implements the CephRBDMirrorNamespaceLister // interface. type cephRBDMirrorNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CephRBDMirrors in the indexer for a given namespace. -func (s cephRBDMirrorNamespaceLister) List(selector labels.Selector) (ret []*v1.CephRBDMirror, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.CephRBDMirror)) - }) - return ret, err -} - -// Get retrieves the CephRBDMirror from the indexer for a given namespace and name. -func (s cephRBDMirrorNamespaceLister) Get(name string) (*v1.CephRBDMirror, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("cephrbdmirror"), name) - } - return obj.(*v1.CephRBDMirror), nil + listers.ResourceIndexer[*v1.CephRBDMirror] } diff --git a/pkg/client/listers/ceph.rook.io/v1/expansion_generated.go b/pkg/client/listers/ceph.rook.io/v1/expansion_generated.go index e675b9167..a4d3eabcb 100644 --- a/pkg/client/listers/ceph.rook.io/v1/expansion_generated.go +++ b/pkg/client/listers/ceph.rook.io/v1/expansion_generated.go @@ -1,11 +1,11 @@ /* -Copyright The Kubernetes Authors. +Copyright 2018 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +    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,