From f811c0966c5c7f320d25228c0081ddc8f4e79bd4 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Sat, 17 Feb 2018 12:24:03 -0800 Subject: [PATCH] Use official code generator scripts (#336) --- client/{ => clientset/versioned}/clientset.go | 4 +- client/{ => clientset/versioned}/doc.go | 2 +- .../versioned}/fake/clientset_generated.go | 6 +- client/{ => clientset/versioned}/fake/doc.go | 0 .../versioned}/fake/register.go | 0 .../versioned}/scheme/doc.go | 0 .../versioned}/scheme/register.go | 0 .../versioned}/typed/stash/v1alpha1/doc.go | 0 .../typed/stash/v1alpha1}/fake/doc.go | 0 .../stash/v1alpha1/fake/fake_recovery.go | 0 .../typed/stash/v1alpha1/fake/fake_restic.go | 0 .../stash/v1alpha1/fake/fake_stash_client.go | 2 +- .../stash/v1alpha1/generated_expansion.go | 0 .../typed/stash/v1alpha1/recovery.go | 2 +- .../versioned}/typed/stash/v1alpha1/restic.go | 2 +- .../typed/stash/v1alpha1/stash_client.go | 2 +- .../typed/stash/v1alpha1/util/kubernetes.go | 0 .../typed/stash/v1alpha1/util/recovery.go | 2 +- .../typed/stash/v1alpha1/util/restic.go | 2 +- .../informers}/externalversions/factory.go | 19 +- .../informers}/externalversions/generic.go | 1 + .../internalinterfaces/factory_interfaces.go | 7 +- .../externalversions/stash/interface.go | 4 +- .../stash/v1alpha1/interface.go | 2 +- .../stash/v1alpha1/recovery.go | 15 +- .../externalversions/stash/v1alpha1/restic.go | 15 +- client/internalclientset/clientset.go | 90 --------- client/internalclientset/doc.go | 18 -- .../fake/clientset_generated.go | 66 ------- client/internalclientset/fake/doc.go | 18 -- client/internalclientset/fake/register.go | 53 ------ client/internalclientset/scheme/register.go | 47 ----- .../typed/stash/internalversion/doc.go | 18 -- .../internalversion/fake/fake_recovery.go | 138 -------------- .../stash/internalversion/fake/fake_restic.go | 138 -------------- .../internalversion/fake/fake_stash_client.go | 42 ----- .../internalversion/generated_expansion.go | 21 --- .../typed/stash/internalversion/recovery.go | 172 ------------------ .../typed/stash/internalversion/restic.go | 172 ------------------ .../stash/internalversion/stash_client.go | 104 ----------- .../stash/v1alpha1/expansion_generated.go | 0 .../listers}/stash/v1alpha1/recovery.go | 0 .../listers}/stash/v1alpha1/restic.go | 0 client/scheme/doc.go | 18 -- client/typed/stash/v1alpha1/fake/doc.go | 18 -- hack/codegen.sh | 87 +-------- listers/apis/stash/expansion_generated.go | 35 ---- listers/apis/stash/recovery.go | 94 ---------- listers/apis/stash/restic.go | 94 ---------- 49 files changed, 55 insertions(+), 1475 deletions(-) rename client/{ => clientset/versioned}/clientset.go (96%) rename client/{ => clientset/versioned}/doc.go (97%) rename client/{ => clientset/versioned}/fake/clientset_generated.go (90%) rename client/{ => clientset/versioned}/fake/doc.go (100%) rename client/{ => clientset/versioned}/fake/register.go (100%) rename client/{internalclientset => clientset/versioned}/scheme/doc.go (100%) rename client/{ => clientset/versioned}/scheme/register.go (100%) rename client/{ => clientset/versioned}/typed/stash/v1alpha1/doc.go (100%) rename client/{internalclientset/typed/stash/internalversion => clientset/versioned/typed/stash/v1alpha1}/fake/doc.go (100%) rename client/{ => clientset/versioned}/typed/stash/v1alpha1/fake/fake_recovery.go (100%) rename client/{ => clientset/versioned}/typed/stash/v1alpha1/fake/fake_restic.go (100%) rename client/{ => clientset/versioned}/typed/stash/v1alpha1/fake/fake_stash_client.go (93%) rename client/{ => clientset/versioned}/typed/stash/v1alpha1/generated_expansion.go (100%) rename client/{ => clientset/versioned}/typed/stash/v1alpha1/recovery.go (98%) rename client/{ => clientset/versioned}/typed/stash/v1alpha1/restic.go (98%) rename client/{ => clientset/versioned}/typed/stash/v1alpha1/stash_client.go (97%) rename client/{ => clientset/versioned}/typed/stash/v1alpha1/util/kubernetes.go (100%) rename client/{ => clientset/versioned}/typed/stash/v1alpha1/util/recovery.go (97%) rename client/{ => clientset/versioned}/typed/stash/v1alpha1/util/restic.go (97%) rename {informers => client/informers}/externalversions/factory.go (86%) rename {informers => client/informers}/externalversions/generic.go (99%) rename {informers => client/informers}/externalversions/internalinterfaces/factory_interfaces.go (87%) rename {informers => client/informers}/externalversions/stash/interface.go (88%) rename {informers => client/informers}/externalversions/stash/v1alpha1/interface.go (94%) rename {informers => client/informers}/externalversions/stash/v1alpha1/recovery.go (79%) rename {informers => client/informers}/externalversions/stash/v1alpha1/restic.go (79%) delete mode 100644 client/internalclientset/clientset.go delete mode 100644 client/internalclientset/doc.go delete mode 100644 client/internalclientset/fake/clientset_generated.go delete mode 100644 client/internalclientset/fake/doc.go delete mode 100644 client/internalclientset/fake/register.go delete mode 100644 client/internalclientset/scheme/register.go delete mode 100644 client/internalclientset/typed/stash/internalversion/doc.go delete mode 100644 client/internalclientset/typed/stash/internalversion/fake/fake_recovery.go delete mode 100644 client/internalclientset/typed/stash/internalversion/fake/fake_restic.go delete mode 100644 client/internalclientset/typed/stash/internalversion/fake/fake_stash_client.go delete mode 100644 client/internalclientset/typed/stash/internalversion/generated_expansion.go delete mode 100644 client/internalclientset/typed/stash/internalversion/recovery.go delete mode 100644 client/internalclientset/typed/stash/internalversion/restic.go delete mode 100644 client/internalclientset/typed/stash/internalversion/stash_client.go rename {listers => client/listers}/stash/v1alpha1/expansion_generated.go (100%) rename {listers => client/listers}/stash/v1alpha1/recovery.go (100%) rename {listers => client/listers}/stash/v1alpha1/restic.go (100%) delete mode 100644 client/scheme/doc.go delete mode 100644 client/typed/stash/v1alpha1/fake/doc.go delete mode 100644 listers/apis/stash/expansion_generated.go delete mode 100644 listers/apis/stash/recovery.go delete mode 100644 listers/apis/stash/restic.go diff --git a/client/clientset.go b/client/clientset/versioned/clientset.go similarity index 96% rename from client/clientset.go rename to client/clientset/versioned/clientset.go index 5bff7f8e0..c9cdc3aba 100644 --- a/client/clientset.go +++ b/client/clientset/versioned/clientset.go @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -package client +package versioned import ( - stashv1alpha1 "github.com/appscode/stash/client/typed/stash/v1alpha1" + stashv1alpha1 "github.com/appscode/stash/client/clientset/versioned/typed/stash/v1alpha1" glog "github.com/golang/glog" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" diff --git a/client/doc.go b/client/clientset/versioned/doc.go similarity index 97% rename from client/doc.go rename to client/clientset/versioned/doc.go index 3dc9b94b5..49fff27fa 100644 --- a/client/doc.go +++ b/client/clientset/versioned/doc.go @@ -15,4 +15,4 @@ limitations under the License. */ // This package has the automatically generated clientset. -package client +package versioned diff --git a/client/fake/clientset_generated.go b/client/clientset/versioned/fake/clientset_generated.go similarity index 90% rename from client/fake/clientset_generated.go rename to client/clientset/versioned/fake/clientset_generated.go index dd34159df..8758326af 100644 --- a/client/fake/clientset_generated.go +++ b/client/clientset/versioned/fake/clientset_generated.go @@ -17,9 +17,9 @@ limitations under the License. package fake import ( - clientset "github.com/appscode/stash/client" - stashv1alpha1 "github.com/appscode/stash/client/typed/stash/v1alpha1" - fakestashv1alpha1 "github.com/appscode/stash/client/typed/stash/v1alpha1/fake" + clientset "github.com/appscode/stash/client/clientset/versioned" + stashv1alpha1 "github.com/appscode/stash/client/clientset/versioned/typed/stash/v1alpha1" + fakestashv1alpha1 "github.com/appscode/stash/client/clientset/versioned/typed/stash/v1alpha1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" diff --git a/client/fake/doc.go b/client/clientset/versioned/fake/doc.go similarity index 100% rename from client/fake/doc.go rename to client/clientset/versioned/fake/doc.go diff --git a/client/fake/register.go b/client/clientset/versioned/fake/register.go similarity index 100% rename from client/fake/register.go rename to client/clientset/versioned/fake/register.go diff --git a/client/internalclientset/scheme/doc.go b/client/clientset/versioned/scheme/doc.go similarity index 100% rename from client/internalclientset/scheme/doc.go rename to client/clientset/versioned/scheme/doc.go diff --git a/client/scheme/register.go b/client/clientset/versioned/scheme/register.go similarity index 100% rename from client/scheme/register.go rename to client/clientset/versioned/scheme/register.go diff --git a/client/typed/stash/v1alpha1/doc.go b/client/clientset/versioned/typed/stash/v1alpha1/doc.go similarity index 100% rename from client/typed/stash/v1alpha1/doc.go rename to client/clientset/versioned/typed/stash/v1alpha1/doc.go diff --git a/client/internalclientset/typed/stash/internalversion/fake/doc.go b/client/clientset/versioned/typed/stash/v1alpha1/fake/doc.go similarity index 100% rename from client/internalclientset/typed/stash/internalversion/fake/doc.go rename to client/clientset/versioned/typed/stash/v1alpha1/fake/doc.go diff --git a/client/typed/stash/v1alpha1/fake/fake_recovery.go b/client/clientset/versioned/typed/stash/v1alpha1/fake/fake_recovery.go similarity index 100% rename from client/typed/stash/v1alpha1/fake/fake_recovery.go rename to client/clientset/versioned/typed/stash/v1alpha1/fake/fake_recovery.go diff --git a/client/typed/stash/v1alpha1/fake/fake_restic.go b/client/clientset/versioned/typed/stash/v1alpha1/fake/fake_restic.go similarity index 100% rename from client/typed/stash/v1alpha1/fake/fake_restic.go rename to client/clientset/versioned/typed/stash/v1alpha1/fake/fake_restic.go diff --git a/client/typed/stash/v1alpha1/fake/fake_stash_client.go b/client/clientset/versioned/typed/stash/v1alpha1/fake/fake_stash_client.go similarity index 93% rename from client/typed/stash/v1alpha1/fake/fake_stash_client.go rename to client/clientset/versioned/typed/stash/v1alpha1/fake/fake_stash_client.go index f99f7a985..065af1a0f 100644 --- a/client/typed/stash/v1alpha1/fake/fake_stash_client.go +++ b/client/clientset/versioned/typed/stash/v1alpha1/fake/fake_stash_client.go @@ -17,7 +17,7 @@ limitations under the License. package fake import ( - v1alpha1 "github.com/appscode/stash/client/typed/stash/v1alpha1" + v1alpha1 "github.com/appscode/stash/client/clientset/versioned/typed/stash/v1alpha1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) diff --git a/client/typed/stash/v1alpha1/generated_expansion.go b/client/clientset/versioned/typed/stash/v1alpha1/generated_expansion.go similarity index 100% rename from client/typed/stash/v1alpha1/generated_expansion.go rename to client/clientset/versioned/typed/stash/v1alpha1/generated_expansion.go diff --git a/client/typed/stash/v1alpha1/recovery.go b/client/clientset/versioned/typed/stash/v1alpha1/recovery.go similarity index 98% rename from client/typed/stash/v1alpha1/recovery.go rename to client/clientset/versioned/typed/stash/v1alpha1/recovery.go index 8198dcaf2..4ffa066ec 100644 --- a/client/typed/stash/v1alpha1/recovery.go +++ b/client/clientset/versioned/typed/stash/v1alpha1/recovery.go @@ -18,7 +18,7 @@ package v1alpha1 import ( v1alpha1 "github.com/appscode/stash/apis/stash/v1alpha1" - scheme "github.com/appscode/stash/client/scheme" + scheme "github.com/appscode/stash/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" diff --git a/client/typed/stash/v1alpha1/restic.go b/client/clientset/versioned/typed/stash/v1alpha1/restic.go similarity index 98% rename from client/typed/stash/v1alpha1/restic.go rename to client/clientset/versioned/typed/stash/v1alpha1/restic.go index 33f1c90a4..5c9b8f1fe 100644 --- a/client/typed/stash/v1alpha1/restic.go +++ b/client/clientset/versioned/typed/stash/v1alpha1/restic.go @@ -18,7 +18,7 @@ package v1alpha1 import ( v1alpha1 "github.com/appscode/stash/apis/stash/v1alpha1" - scheme "github.com/appscode/stash/client/scheme" + scheme "github.com/appscode/stash/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" diff --git a/client/typed/stash/v1alpha1/stash_client.go b/client/clientset/versioned/typed/stash/v1alpha1/stash_client.go similarity index 97% rename from client/typed/stash/v1alpha1/stash_client.go rename to client/clientset/versioned/typed/stash/v1alpha1/stash_client.go index 78b513516..44f5d5518 100644 --- a/client/typed/stash/v1alpha1/stash_client.go +++ b/client/clientset/versioned/typed/stash/v1alpha1/stash_client.go @@ -18,7 +18,7 @@ package v1alpha1 import ( v1alpha1 "github.com/appscode/stash/apis/stash/v1alpha1" - "github.com/appscode/stash/client/scheme" + "github.com/appscode/stash/client/clientset/versioned/scheme" serializer "k8s.io/apimachinery/pkg/runtime/serializer" rest "k8s.io/client-go/rest" ) diff --git a/client/typed/stash/v1alpha1/util/kubernetes.go b/client/clientset/versioned/typed/stash/v1alpha1/util/kubernetes.go similarity index 100% rename from client/typed/stash/v1alpha1/util/kubernetes.go rename to client/clientset/versioned/typed/stash/v1alpha1/util/kubernetes.go diff --git a/client/typed/stash/v1alpha1/util/recovery.go b/client/clientset/versioned/typed/stash/v1alpha1/util/recovery.go similarity index 97% rename from client/typed/stash/v1alpha1/util/recovery.go rename to client/clientset/versioned/typed/stash/v1alpha1/util/recovery.go index 473e99438..31ef37fad 100644 --- a/client/typed/stash/v1alpha1/util/recovery.go +++ b/client/clientset/versioned/typed/stash/v1alpha1/util/recovery.go @@ -8,7 +8,7 @@ import ( "github.com/appscode/go/log" "github.com/appscode/kutil" api "github.com/appscode/stash/apis/stash/v1alpha1" - cs "github.com/appscode/stash/client/typed/stash/v1alpha1" + cs "github.com/appscode/stash/client/clientset/versioned/typed/stash/v1alpha1" "github.com/golang/glog" kerr "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/client/typed/stash/v1alpha1/util/restic.go b/client/clientset/versioned/typed/stash/v1alpha1/util/restic.go similarity index 97% rename from client/typed/stash/v1alpha1/util/restic.go rename to client/clientset/versioned/typed/stash/v1alpha1/util/restic.go index c8e273a25..5c1128dcc 100644 --- a/client/typed/stash/v1alpha1/util/restic.go +++ b/client/clientset/versioned/typed/stash/v1alpha1/util/restic.go @@ -6,7 +6,7 @@ import ( "github.com/appscode/kutil" api "github.com/appscode/stash/apis/stash/v1alpha1" - cs "github.com/appscode/stash/client/typed/stash/v1alpha1" + cs "github.com/appscode/stash/client/clientset/versioned/typed/stash/v1alpha1" "github.com/golang/glog" kerr "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/informers/externalversions/factory.go b/client/informers/externalversions/factory.go similarity index 86% rename from informers/externalversions/factory.go rename to client/informers/externalversions/factory.go index e01d0d76d..e2066ded2 100644 --- a/informers/externalversions/factory.go +++ b/client/informers/externalversions/factory.go @@ -19,20 +19,21 @@ limitations under the License. package externalversions import ( - client "github.com/appscode/stash/client" - internalinterfaces "github.com/appscode/stash/informers/externalversions/internalinterfaces" - stash "github.com/appscode/stash/informers/externalversions/stash" + reflect "reflect" + sync "sync" + time "time" + + versioned "github.com/appscode/stash/client/clientset/versioned" + internalinterfaces "github.com/appscode/stash/client/informers/externalversions/internalinterfaces" + stash "github.com/appscode/stash/client/informers/externalversions/stash" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" - reflect "reflect" - sync "sync" - time "time" ) type sharedInformerFactory struct { - client client.Interface + client versioned.Interface namespace string tweakListOptions internalinterfaces.TweakListOptionsFunc lock sync.Mutex @@ -45,14 +46,14 @@ type sharedInformerFactory struct { } // NewSharedInformerFactory constructs a new instance of sharedInformerFactory -func NewSharedInformerFactory(client client.Interface, defaultResync time.Duration) SharedInformerFactory { +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { return NewFilteredSharedInformerFactory(client, defaultResync, v1.NamespaceAll, nil) } // NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. // Listers obtained via this SharedInformerFactory will be subject to the same filters // as specified here. -func NewFilteredSharedInformerFactory(client client.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { return &sharedInformerFactory{ client: client, namespace: namespace, diff --git a/informers/externalversions/generic.go b/client/informers/externalversions/generic.go similarity index 99% rename from informers/externalversions/generic.go rename to client/informers/externalversions/generic.go index 4ecb2cc80..c7f51b4dc 100644 --- a/informers/externalversions/generic.go +++ b/client/informers/externalversions/generic.go @@ -20,6 +20,7 @@ package externalversions import ( "fmt" + v1alpha1 "github.com/appscode/stash/apis/stash/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" diff --git a/informers/externalversions/internalinterfaces/factory_interfaces.go b/client/informers/externalversions/internalinterfaces/factory_interfaces.go similarity index 87% rename from informers/externalversions/internalinterfaces/factory_interfaces.go rename to client/informers/externalversions/internalinterfaces/factory_interfaces.go index a9c4f1d72..72b87b052 100644 --- a/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -19,14 +19,15 @@ limitations under the License. package internalinterfaces import ( - client "github.com/appscode/stash/client" + time "time" + + versioned "github.com/appscode/stash/client/clientset/versioned" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" cache "k8s.io/client-go/tools/cache" - time "time" ) -type NewInformerFunc func(client.Interface, time.Duration) cache.SharedIndexInformer +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer // SharedInformerFactory a small interface to allow for adding an informer without an import cycle type SharedInformerFactory interface { diff --git a/informers/externalversions/stash/interface.go b/client/informers/externalversions/stash/interface.go similarity index 88% rename from informers/externalversions/stash/interface.go rename to client/informers/externalversions/stash/interface.go index 03d5bcceb..ffa5401d1 100644 --- a/informers/externalversions/stash/interface.go +++ b/client/informers/externalversions/stash/interface.go @@ -19,8 +19,8 @@ limitations under the License. package stash import ( - internalinterfaces "github.com/appscode/stash/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/appscode/stash/informers/externalversions/stash/v1alpha1" + internalinterfaces "github.com/appscode/stash/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/appscode/stash/client/informers/externalversions/stash/v1alpha1" ) // Interface provides access to each of this group's versions. diff --git a/informers/externalversions/stash/v1alpha1/interface.go b/client/informers/externalversions/stash/v1alpha1/interface.go similarity index 94% rename from informers/externalversions/stash/v1alpha1/interface.go rename to client/informers/externalversions/stash/v1alpha1/interface.go index 5948ae15d..f045d521f 100644 --- a/informers/externalversions/stash/v1alpha1/interface.go +++ b/client/informers/externalversions/stash/v1alpha1/interface.go @@ -19,7 +19,7 @@ limitations under the License. package v1alpha1 import ( - internalinterfaces "github.com/appscode/stash/informers/externalversions/internalinterfaces" + internalinterfaces "github.com/appscode/stash/client/informers/externalversions/internalinterfaces" ) // Interface provides access to all the informers in this group version. diff --git a/informers/externalversions/stash/v1alpha1/recovery.go b/client/informers/externalversions/stash/v1alpha1/recovery.go similarity index 79% rename from informers/externalversions/stash/v1alpha1/recovery.go rename to client/informers/externalversions/stash/v1alpha1/recovery.go index 8ac8c9abd..84d383df6 100644 --- a/informers/externalversions/stash/v1alpha1/recovery.go +++ b/client/informers/externalversions/stash/v1alpha1/recovery.go @@ -19,15 +19,16 @@ limitations under the License. package v1alpha1 import ( + time "time" + stash_v1alpha1 "github.com/appscode/stash/apis/stash/v1alpha1" - client "github.com/appscode/stash/client" - internalinterfaces "github.com/appscode/stash/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/appscode/stash/listers/stash/v1alpha1" + versioned "github.com/appscode/stash/client/clientset/versioned" + internalinterfaces "github.com/appscode/stash/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/appscode/stash/client/listers/stash/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - time "time" ) // RecoveryInformer provides access to a shared informer and lister for @@ -46,14 +47,14 @@ type recoveryInformer struct { // NewRecoveryInformer constructs a new informer for Recovery type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewRecoveryInformer(client client.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { +func NewRecoveryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredRecoveryInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredRecoveryInformer constructs a new informer for Recovery type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewFilteredRecoveryInformer(client client.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { +func NewFilteredRecoveryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { @@ -75,7 +76,7 @@ func NewFilteredRecoveryInformer(client client.Interface, namespace string, resy ) } -func (f *recoveryInformer) defaultInformer(client client.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { +func (f *recoveryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredRecoveryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } diff --git a/informers/externalversions/stash/v1alpha1/restic.go b/client/informers/externalversions/stash/v1alpha1/restic.go similarity index 79% rename from informers/externalversions/stash/v1alpha1/restic.go rename to client/informers/externalversions/stash/v1alpha1/restic.go index be012e9cd..a48cabe3d 100644 --- a/informers/externalversions/stash/v1alpha1/restic.go +++ b/client/informers/externalversions/stash/v1alpha1/restic.go @@ -19,15 +19,16 @@ limitations under the License. package v1alpha1 import ( + time "time" + stash_v1alpha1 "github.com/appscode/stash/apis/stash/v1alpha1" - client "github.com/appscode/stash/client" - internalinterfaces "github.com/appscode/stash/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/appscode/stash/listers/stash/v1alpha1" + versioned "github.com/appscode/stash/client/clientset/versioned" + internalinterfaces "github.com/appscode/stash/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/appscode/stash/client/listers/stash/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - time "time" ) // ResticInformer provides access to a shared informer and lister for @@ -46,14 +47,14 @@ type resticInformer struct { // NewResticInformer constructs a new informer for Restic type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewResticInformer(client client.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { +func NewResticInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredResticInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredResticInformer constructs a new informer for Restic type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewFilteredResticInformer(client client.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { +func NewFilteredResticInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { @@ -75,7 +76,7 @@ func NewFilteredResticInformer(client client.Interface, namespace string, resync ) } -func (f *resticInformer) defaultInformer(client client.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { +func (f *resticInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredResticInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } diff --git a/client/internalclientset/clientset.go b/client/internalclientset/clientset.go deleted file mode 100644 index d59065545..000000000 --- a/client/internalclientset/clientset.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package internalclientset - -import ( - stashinternalversion "github.com/appscode/stash/client/internalclientset/typed/stash/internalversion" - glog "github.com/golang/glog" - discovery "k8s.io/client-go/discovery" - rest "k8s.io/client-go/rest" - flowcontrol "k8s.io/client-go/util/flowcontrol" -) - -type Interface interface { - Discovery() discovery.DiscoveryInterface - Stash() stashinternalversion.StashInterface -} - -// Clientset contains the clients for groups. Each group has exactly one -// version included in a Clientset. -type Clientset struct { - *discovery.DiscoveryClient - stash *stashinternalversion.StashClient -} - -// Stash retrieves the StashClient -func (c *Clientset) Stash() stashinternalversion.StashInterface { - return c.stash -} - -// Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - if c == nil { - return nil - } - return c.DiscoveryClient -} - -// NewForConfig creates a new Clientset for the given config. -func NewForConfig(c *rest.Config) (*Clientset, error) { - configShallowCopy := *c - if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { - configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) - } - var cs Clientset - var err error - cs.stash, err = stashinternalversion.NewForConfig(&configShallowCopy) - if err != nil { - return nil, err - } - - cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) - if err != nil { - glog.Errorf("failed to create the DiscoveryClient: %v", err) - return nil, err - } - return &cs, nil -} - -// NewForConfigOrDie creates a new Clientset for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *Clientset { - var cs Clientset - cs.stash = stashinternalversion.NewForConfigOrDie(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) - return &cs -} - -// New creates a new Clientset for the given RESTClient. -func New(c rest.Interface) *Clientset { - var cs Clientset - cs.stash = stashinternalversion.New(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClient(c) - return &cs -} diff --git a/client/internalclientset/doc.go b/client/internalclientset/doc.go deleted file mode 100644 index 3a7c37724..000000000 --- a/client/internalclientset/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// This package has the automatically generated clientset. -package internalclientset diff --git a/client/internalclientset/fake/clientset_generated.go b/client/internalclientset/fake/clientset_generated.go deleted file mode 100644 index 3e101df8d..000000000 --- a/client/internalclientset/fake/clientset_generated.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package fake - -import ( - clientset "github.com/appscode/stash/client/internalclientset" - stashinternalversion "github.com/appscode/stash/client/internalclientset/typed/stash/internalversion" - fakestashinternalversion "github.com/appscode/stash/client/internalclientset/typed/stash/internalversion/fake" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/discovery" - fakediscovery "k8s.io/client-go/discovery/fake" - "k8s.io/client-go/testing" -) - -// NewSimpleClientset returns a clientset that will respond with the provided objects. -// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement -// for a real clientset and is mostly useful in simple unit tests. -func NewSimpleClientset(objects ...runtime.Object) *Clientset { - o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) - for _, obj := range objects { - if err := o.Add(obj); err != nil { - panic(err) - } - } - - fakePtr := testing.Fake{} - fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) - fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) - - return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} -} - -// Clientset implements clientset.Interface. Meant to be embedded into a -// struct to get a default implementation. This makes faking out just the method -// you want to test easier. -type Clientset struct { - testing.Fake - discovery *fakediscovery.FakeDiscovery -} - -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - return c.discovery -} - -var _ clientset.Interface = &Clientset{} - -// Stash retrieves the StashClient -func (c *Clientset) Stash() stashinternalversion.StashInterface { - return &fakestashinternalversion.FakeStash{Fake: &c.Fake} -} diff --git a/client/internalclientset/fake/doc.go b/client/internalclientset/fake/doc.go deleted file mode 100644 index cd3892df6..000000000 --- a/client/internalclientset/fake/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// This package has the automatically generated fake clientset. -package fake diff --git a/client/internalclientset/fake/register.go b/client/internalclientset/fake/register.go deleted file mode 100644 index 34c6a718c..000000000 --- a/client/internalclientset/fake/register.go +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package fake - -import ( - stashinternalversion "github.com/appscode/stash/apis/stash" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" -) - -var scheme = runtime.NewScheme() -var codecs = serializer.NewCodecFactory(scheme) -var parameterCodec = runtime.NewParameterCodec(scheme) - -func init() { - v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) - AddToScheme(scheme) -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kuberentes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -func AddToScheme(scheme *runtime.Scheme) { - stashinternalversion.AddToScheme(scheme) - -} diff --git a/client/internalclientset/scheme/register.go b/client/internalclientset/scheme/register.go deleted file mode 100644 index 402d989af..000000000 --- a/client/internalclientset/scheme/register.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package scheme - -import ( - os "os" - - stash "github.com/appscode/stash/apis/stash/install" - announced "k8s.io/apimachinery/pkg/apimachinery/announced" - registered "k8s.io/apimachinery/pkg/apimachinery/registered" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" -) - -var Scheme = runtime.NewScheme() -var Codecs = serializer.NewCodecFactory(Scheme) -var ParameterCodec = runtime.NewParameterCodec(Scheme) - -var Registry = registered.NewOrDie(os.Getenv("KUBE_API_VERSIONS")) -var GroupFactoryRegistry = make(announced.APIGroupFactoryRegistry) - -func init() { - v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) - Install(GroupFactoryRegistry, Registry, Scheme) -} - -// Install registers the API group and adds types to a scheme -func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) { - stash.Install(groupFactoryRegistry, registry, scheme) - -} diff --git a/client/internalclientset/typed/stash/internalversion/doc.go b/client/internalclientset/typed/stash/internalversion/doc.go deleted file mode 100644 index 64b892e29..000000000 --- a/client/internalclientset/typed/stash/internalversion/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// This package has the automatically generated typed clients. -package internalversion diff --git a/client/internalclientset/typed/stash/internalversion/fake/fake_recovery.go b/client/internalclientset/typed/stash/internalversion/fake/fake_recovery.go deleted file mode 100644 index c8e16f427..000000000 --- a/client/internalclientset/typed/stash/internalversion/fake/fake_recovery.go +++ /dev/null @@ -1,138 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package fake - -import ( - stash "github.com/appscode/stash/apis/stash" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeRecoveries implements RecoveryInterface -type FakeRecoveries struct { - Fake *FakeStash - ns string -} - -var recoveriesResource = schema.GroupVersionResource{Group: "stash.appscode.com", Version: "", Resource: "recoveries"} - -var recoveriesKind = schema.GroupVersionKind{Group: "stash.appscode.com", Version: "", Kind: "Recovery"} - -// Get takes name of the recovery, and returns the corresponding recovery object, and an error if there is any. -func (c *FakeRecoveries) Get(name string, options v1.GetOptions) (result *stash.Recovery, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(recoveriesResource, c.ns, name), &stash.Recovery{}) - - if obj == nil { - return nil, err - } - return obj.(*stash.Recovery), err -} - -// List takes label and field selectors, and returns the list of Recoveries that match those selectors. -func (c *FakeRecoveries) List(opts v1.ListOptions) (result *stash.RecoveryList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(recoveriesResource, recoveriesKind, c.ns, opts), &stash.RecoveryList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &stash.RecoveryList{} - for _, item := range obj.(*stash.RecoveryList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested recoveries. -func (c *FakeRecoveries) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(recoveriesResource, c.ns, opts)) - -} - -// Create takes the representation of a recovery and creates it. Returns the server's representation of the recovery, and an error, if there is any. -func (c *FakeRecoveries) Create(recovery *stash.Recovery) (result *stash.Recovery, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(recoveriesResource, c.ns, recovery), &stash.Recovery{}) - - if obj == nil { - return nil, err - } - return obj.(*stash.Recovery), err -} - -// Update takes the representation of a recovery and updates it. Returns the server's representation of the recovery, and an error, if there is any. -func (c *FakeRecoveries) Update(recovery *stash.Recovery) (result *stash.Recovery, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(recoveriesResource, c.ns, recovery), &stash.Recovery{}) - - if obj == nil { - return nil, err - } - return obj.(*stash.Recovery), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeRecoveries) UpdateStatus(recovery *stash.Recovery) (*stash.Recovery, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(recoveriesResource, "status", c.ns, recovery), &stash.Recovery{}) - - if obj == nil { - return nil, err - } - return obj.(*stash.Recovery), err -} - -// Delete takes name of the recovery and deletes it. Returns an error if one occurs. -func (c *FakeRecoveries) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(recoveriesResource, c.ns, name), &stash.Recovery{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeRecoveries) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(recoveriesResource, c.ns, listOptions) - - _, err := c.Fake.Invokes(action, &stash.RecoveryList{}) - return err -} - -// Patch applies the patch and returns the patched recovery. -func (c *FakeRecoveries) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *stash.Recovery, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(recoveriesResource, c.ns, name, data, subresources...), &stash.Recovery{}) - - if obj == nil { - return nil, err - } - return obj.(*stash.Recovery), err -} diff --git a/client/internalclientset/typed/stash/internalversion/fake/fake_restic.go b/client/internalclientset/typed/stash/internalversion/fake/fake_restic.go deleted file mode 100644 index ecfad070c..000000000 --- a/client/internalclientset/typed/stash/internalversion/fake/fake_restic.go +++ /dev/null @@ -1,138 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package fake - -import ( - stash "github.com/appscode/stash/apis/stash" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeRestics implements ResticInterface -type FakeRestics struct { - Fake *FakeStash - ns string -} - -var resticsResource = schema.GroupVersionResource{Group: "stash.appscode.com", Version: "", Resource: "restics"} - -var resticsKind = schema.GroupVersionKind{Group: "stash.appscode.com", Version: "", Kind: "Restic"} - -// Get takes name of the restic, and returns the corresponding restic object, and an error if there is any. -func (c *FakeRestics) Get(name string, options v1.GetOptions) (result *stash.Restic, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(resticsResource, c.ns, name), &stash.Restic{}) - - if obj == nil { - return nil, err - } - return obj.(*stash.Restic), err -} - -// List takes label and field selectors, and returns the list of Restics that match those selectors. -func (c *FakeRestics) List(opts v1.ListOptions) (result *stash.ResticList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(resticsResource, resticsKind, c.ns, opts), &stash.ResticList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &stash.ResticList{} - for _, item := range obj.(*stash.ResticList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested restics. -func (c *FakeRestics) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(resticsResource, c.ns, opts)) - -} - -// Create takes the representation of a restic and creates it. Returns the server's representation of the restic, and an error, if there is any. -func (c *FakeRestics) Create(restic *stash.Restic) (result *stash.Restic, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(resticsResource, c.ns, restic), &stash.Restic{}) - - if obj == nil { - return nil, err - } - return obj.(*stash.Restic), err -} - -// Update takes the representation of a restic and updates it. Returns the server's representation of the restic, and an error, if there is any. -func (c *FakeRestics) Update(restic *stash.Restic) (result *stash.Restic, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(resticsResource, c.ns, restic), &stash.Restic{}) - - if obj == nil { - return nil, err - } - return obj.(*stash.Restic), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeRestics) UpdateStatus(restic *stash.Restic) (*stash.Restic, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(resticsResource, "status", c.ns, restic), &stash.Restic{}) - - if obj == nil { - return nil, err - } - return obj.(*stash.Restic), err -} - -// Delete takes name of the restic and deletes it. Returns an error if one occurs. -func (c *FakeRestics) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(resticsResource, c.ns, name), &stash.Restic{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeRestics) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(resticsResource, c.ns, listOptions) - - _, err := c.Fake.Invokes(action, &stash.ResticList{}) - return err -} - -// Patch applies the patch and returns the patched restic. -func (c *FakeRestics) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *stash.Restic, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(resticsResource, c.ns, name, data, subresources...), &stash.Restic{}) - - if obj == nil { - return nil, err - } - return obj.(*stash.Restic), err -} diff --git a/client/internalclientset/typed/stash/internalversion/fake/fake_stash_client.go b/client/internalclientset/typed/stash/internalversion/fake/fake_stash_client.go deleted file mode 100644 index d835d54af..000000000 --- a/client/internalclientset/typed/stash/internalversion/fake/fake_stash_client.go +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package fake - -import ( - internalversion "github.com/appscode/stash/client/internalclientset/typed/stash/internalversion" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeStash struct { - *testing.Fake -} - -func (c *FakeStash) Recoveries(namespace string) internalversion.RecoveryInterface { - return &FakeRecoveries{c, namespace} -} - -func (c *FakeStash) Restics(namespace string) internalversion.ResticInterface { - return &FakeRestics{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeStash) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/client/internalclientset/typed/stash/internalversion/generated_expansion.go b/client/internalclientset/typed/stash/internalversion/generated_expansion.go deleted file mode 100644 index 86edacaa2..000000000 --- a/client/internalclientset/typed/stash/internalversion/generated_expansion.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package internalversion - -type RecoveryExpansion interface{} - -type ResticExpansion interface{} diff --git a/client/internalclientset/typed/stash/internalversion/recovery.go b/client/internalclientset/typed/stash/internalversion/recovery.go deleted file mode 100644 index d408d77fe..000000000 --- a/client/internalclientset/typed/stash/internalversion/recovery.go +++ /dev/null @@ -1,172 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package internalversion - -import ( - stash "github.com/appscode/stash/apis/stash" - scheme "github.com/appscode/stash/client/internalclientset/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// RecoveriesGetter has a method to return a RecoveryInterface. -// A group's client should implement this interface. -type RecoveriesGetter interface { - Recoveries(namespace string) RecoveryInterface -} - -// RecoveryInterface has methods to work with Recovery resources. -type RecoveryInterface interface { - Create(*stash.Recovery) (*stash.Recovery, error) - Update(*stash.Recovery) (*stash.Recovery, error) - UpdateStatus(*stash.Recovery) (*stash.Recovery, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*stash.Recovery, error) - List(opts v1.ListOptions) (*stash.RecoveryList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *stash.Recovery, err error) - RecoveryExpansion -} - -// recoveries implements RecoveryInterface -type recoveries struct { - client rest.Interface - ns string -} - -// newRecoveries returns a Recoveries -func newRecoveries(c *StashClient, namespace string) *recoveries { - return &recoveries{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the recovery, and returns the corresponding recovery object, and an error if there is any. -func (c *recoveries) Get(name string, options v1.GetOptions) (result *stash.Recovery, err error) { - result = &stash.Recovery{} - err = c.client.Get(). - Namespace(c.ns). - Resource("recoveries"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Recoveries that match those selectors. -func (c *recoveries) List(opts v1.ListOptions) (result *stash.RecoveryList, err error) { - result = &stash.RecoveryList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("recoveries"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested recoveries. -func (c *recoveries) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("recoveries"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a recovery and creates it. Returns the server's representation of the recovery, and an error, if there is any. -func (c *recoveries) Create(recovery *stash.Recovery) (result *stash.Recovery, err error) { - result = &stash.Recovery{} - err = c.client.Post(). - Namespace(c.ns). - Resource("recoveries"). - Body(recovery). - Do(). - Into(result) - return -} - -// Update takes the representation of a recovery and updates it. Returns the server's representation of the recovery, and an error, if there is any. -func (c *recoveries) Update(recovery *stash.Recovery) (result *stash.Recovery, err error) { - result = &stash.Recovery{} - err = c.client.Put(). - Namespace(c.ns). - Resource("recoveries"). - Name(recovery.Name). - Body(recovery). - Do(). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *recoveries) UpdateStatus(recovery *stash.Recovery) (result *stash.Recovery, err error) { - result = &stash.Recovery{} - err = c.client.Put(). - Namespace(c.ns). - Resource("recoveries"). - Name(recovery.Name). - SubResource("status"). - Body(recovery). - Do(). - Into(result) - return -} - -// Delete takes name of the recovery and deletes it. Returns an error if one occurs. -func (c *recoveries) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("recoveries"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *recoveries) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("recoveries"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched recovery. -func (c *recoveries) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *stash.Recovery, err error) { - result = &stash.Recovery{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("recoveries"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/client/internalclientset/typed/stash/internalversion/restic.go b/client/internalclientset/typed/stash/internalversion/restic.go deleted file mode 100644 index d6384349d..000000000 --- a/client/internalclientset/typed/stash/internalversion/restic.go +++ /dev/null @@ -1,172 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package internalversion - -import ( - stash "github.com/appscode/stash/apis/stash" - scheme "github.com/appscode/stash/client/internalclientset/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// ResticsGetter has a method to return a ResticInterface. -// A group's client should implement this interface. -type ResticsGetter interface { - Restics(namespace string) ResticInterface -} - -// ResticInterface has methods to work with Restic resources. -type ResticInterface interface { - Create(*stash.Restic) (*stash.Restic, error) - Update(*stash.Restic) (*stash.Restic, error) - UpdateStatus(*stash.Restic) (*stash.Restic, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*stash.Restic, error) - List(opts v1.ListOptions) (*stash.ResticList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *stash.Restic, err error) - ResticExpansion -} - -// restics implements ResticInterface -type restics struct { - client rest.Interface - ns string -} - -// newRestics returns a Restics -func newRestics(c *StashClient, namespace string) *restics { - return &restics{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the restic, and returns the corresponding restic object, and an error if there is any. -func (c *restics) Get(name string, options v1.GetOptions) (result *stash.Restic, err error) { - result = &stash.Restic{} - err = c.client.Get(). - Namespace(c.ns). - Resource("restics"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Restics that match those selectors. -func (c *restics) List(opts v1.ListOptions) (result *stash.ResticList, err error) { - result = &stash.ResticList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("restics"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested restics. -func (c *restics) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("restics"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a restic and creates it. Returns the server's representation of the restic, and an error, if there is any. -func (c *restics) Create(restic *stash.Restic) (result *stash.Restic, err error) { - result = &stash.Restic{} - err = c.client.Post(). - Namespace(c.ns). - Resource("restics"). - Body(restic). - Do(). - Into(result) - return -} - -// Update takes the representation of a restic and updates it. Returns the server's representation of the restic, and an error, if there is any. -func (c *restics) Update(restic *stash.Restic) (result *stash.Restic, err error) { - result = &stash.Restic{} - err = c.client.Put(). - Namespace(c.ns). - Resource("restics"). - Name(restic.Name). - Body(restic). - Do(). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *restics) UpdateStatus(restic *stash.Restic) (result *stash.Restic, err error) { - result = &stash.Restic{} - err = c.client.Put(). - Namespace(c.ns). - Resource("restics"). - Name(restic.Name). - SubResource("status"). - Body(restic). - Do(). - Into(result) - return -} - -// Delete takes name of the restic and deletes it. Returns an error if one occurs. -func (c *restics) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("restics"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *restics) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("restics"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched restic. -func (c *restics) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *stash.Restic, err error) { - result = &stash.Restic{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("restics"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/client/internalclientset/typed/stash/internalversion/stash_client.go b/client/internalclientset/typed/stash/internalversion/stash_client.go deleted file mode 100644 index 7094db7fd..000000000 --- a/client/internalclientset/typed/stash/internalversion/stash_client.go +++ /dev/null @@ -1,104 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package internalversion - -import ( - "github.com/appscode/stash/client/internalclientset/scheme" - rest "k8s.io/client-go/rest" -) - -type StashInterface interface { - RESTClient() rest.Interface - RecoveriesGetter - ResticsGetter -} - -// StashClient is used to interact with features provided by the stash.appscode.com group. -type StashClient struct { - restClient rest.Interface -} - -func (c *StashClient) Recoveries(namespace string) RecoveryInterface { - return newRecoveries(c, namespace) -} - -func (c *StashClient) Restics(namespace string) ResticInterface { - return newRestics(c, namespace) -} - -// NewForConfig creates a new StashClient for the given config. -func NewForConfig(c *rest.Config) (*StashClient, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &StashClient{client}, nil -} - -// NewForConfigOrDie creates a new StashClient for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *StashClient { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new StashClient for the given RESTClient. -func New(c rest.Interface) *StashClient { - return &StashClient{c} -} - -func setConfigDefaults(config *rest.Config) error { - g, err := scheme.Registry.Group("stash.appscode.com") - if err != nil { - return err - } - - config.APIPath = "/apis" - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group { - gv := g.GroupVersion - config.GroupVersion = &gv - } - config.NegotiatedSerializer = scheme.Codecs - - if config.QPS == 0 { - config.QPS = 5 - } - if config.Burst == 0 { - config.Burst = 10 - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *StashClient) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/listers/stash/v1alpha1/expansion_generated.go b/client/listers/stash/v1alpha1/expansion_generated.go similarity index 100% rename from listers/stash/v1alpha1/expansion_generated.go rename to client/listers/stash/v1alpha1/expansion_generated.go diff --git a/listers/stash/v1alpha1/recovery.go b/client/listers/stash/v1alpha1/recovery.go similarity index 100% rename from listers/stash/v1alpha1/recovery.go rename to client/listers/stash/v1alpha1/recovery.go diff --git a/listers/stash/v1alpha1/restic.go b/client/listers/stash/v1alpha1/restic.go similarity index 100% rename from listers/stash/v1alpha1/restic.go rename to client/listers/stash/v1alpha1/restic.go diff --git a/client/scheme/doc.go b/client/scheme/doc.go deleted file mode 100644 index e1497e818..000000000 --- a/client/scheme/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// This package contains the scheme of the automatically generated clientset. -package scheme diff --git a/client/typed/stash/v1alpha1/fake/doc.go b/client/typed/stash/v1alpha1/fake/doc.go deleted file mode 100644 index 75cb003bb..000000000 --- a/client/typed/stash/v1alpha1/fake/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package fake has the automatically generated clients. -package fake diff --git a/hack/codegen.sh b/hack/codegen.sh index 1564f2523..f43a3079a 100755 --- a/hack/codegen.sh +++ b/hack/codegen.sh @@ -6,88 +6,19 @@ GOPATH=$(go env GOPATH) PACKAGE_NAME=github.com/appscode/stash REPO_ROOT="$GOPATH/src/$PACKAGE_NAME" DOCKER_REPO_ROOT="/go/src/$PACKAGE_NAME" +DOCKER_CODEGEN_PKG="/go/src/k8s.io/code-generator" pushd $REPO_ROOT -## Remove ugorji stuff -rm "$REPO_ROOT"/apis/stash/v1alpha1/*.generated.go +rm -rf "$REPO_ROOT"/apis/stash/v1alpha1/*.generated.go -# Generate defaults docker run --rm -ti -u $(id -u):$(id -g) \ - -v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \ - -w "$DOCKER_REPO_ROOT" \ - appscode/gengo:release-1.9 defaulter-gen \ - --v 1 --logtostderr \ - --go-header-file "hack/gengo/boilerplate.go.txt" \ - --input-dirs "$PACKAGE_NAME/apis/stash" \ - --input-dirs "$PACKAGE_NAME/apis/stash/v1alpha1" \ - --extra-peer-dirs "$PACKAGE_NAME/apis/stash" \ - --extra-peer-dirs "$PACKAGE_NAME/apis/stash/v1alpha1" \ - --output-file-base "zz_generated.defaults" - -# Generate deep copies -docker run --rm -ti -u $(id -u):$(id -g) \ - -v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \ - -w "$DOCKER_REPO_ROOT" \ - appscode/gengo:release-1.9 deepcopy-gen \ - --v 1 --logtostderr \ - --go-header-file "hack/gengo/boilerplate.go.txt" \ - --input-dirs "$PACKAGE_NAME/apis/stash" \ - --input-dirs "$PACKAGE_NAME/apis/stash/v1alpha1" \ - --output-file-base zz_generated.deepcopy - -# Generate conversions -docker run --rm -ti -u $(id -u):$(id -g) \ - -v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \ - -w "$DOCKER_REPO_ROOT" \ - appscode/gengo:release-1.9 conversion-gen \ - --v 1 --logtostderr \ - --go-header-file "hack/gengo/boilerplate.go.txt" \ - --input-dirs "$PACKAGE_NAME/apis/stash" \ - --input-dirs "$PACKAGE_NAME/apis/stash/v1alpha1" \ - --output-file-base zz_generated.conversion - -# Generate the internal clientset (client/clientset_generated/internalclientset) -docker run --rm -ti -u $(id -u):$(id -g) \ - -v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \ - -w "$DOCKER_REPO_ROOT" \ - appscode/gengo:release-1.9 client-gen \ - --go-header-file "hack/gengo/boilerplate.go.txt" \ - --input-base "$PACKAGE_NAME/apis/" \ - --input "stash/" \ - --clientset-path "$PACKAGE_NAME/client/" \ - --clientset-name internalclientset - -# Generate the versioned clientset (client/clientset_generated/clientset) -docker run --rm -ti -u $(id -u):$(id -g) \ - -v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \ - -w "$DOCKER_REPO_ROOT" \ - appscode/gengo:release-1.9 client-gen \ - --go-header-file "hack/gengo/boilerplate.go.txt" \ - --input-base "$PACKAGE_NAME/apis/" \ - --input "stash/v1alpha1" \ - --clientset-path "$PACKAGE_NAME/" \ - --clientset-name "client" - -# generate lister -docker run --rm -ti -u $(id -u):$(id -g) \ - -v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \ - -w "$DOCKER_REPO_ROOT" \ - appscode/gengo:release-1.9 lister-gen \ - --go-header-file "hack/gengo/boilerplate.go.txt" \ - --input-dirs="$PACKAGE_NAME/apis/stash" \ - --input-dirs="$PACKAGE_NAME/apis/stash/v1alpha1" \ - --output-package "$PACKAGE_NAME/listers" - -# generate informer -docker run --rm -ti -u $(id -u):$(id -g) \ - -v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \ - -w "$DOCKER_REPO_ROOT" \ - appscode/gengo:release-1.9 informer-gen \ - --go-header-file "hack/gengo/boilerplate.go.txt" \ - --input-dirs "$PACKAGE_NAME/apis/stash/v1alpha1" \ - --versioned-clientset-package "$PACKAGE_NAME/client" \ - --listers-package "$PACKAGE_NAME/listers" \ - --output-package "$PACKAGE_NAME/informers" + -v "$REPO_ROOT":"$DOCKER_REPO_ROOT" \ + -w "$DOCKER_REPO_ROOT" \ + appscode/gengo:release-1.9 "$DOCKER_CODEGEN_PKG"/generate-groups.sh "deepcopy,client,informer,lister" \ + github.com/appscode/stash/client \ + github.com/appscode/stash/apis \ + stash:v1alpha1 \ + --go-header-file "$DOCKER_REPO_ROOT/hack/gengo/boilerplate.go.txt" popd diff --git a/listers/apis/stash/expansion_generated.go b/listers/apis/stash/expansion_generated.go deleted file mode 100644 index cd1638a18..000000000 --- a/listers/apis/stash/expansion_generated.go +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// This file was automatically generated by lister-gen - -package stash - -// RecoveryListerExpansion allows custom methods to be added to -// RecoveryLister. -type RecoveryListerExpansion interface{} - -// RecoveryNamespaceListerExpansion allows custom methods to be added to -// RecoveryNamespaceLister. -type RecoveryNamespaceListerExpansion interface{} - -// ResticListerExpansion allows custom methods to be added to -// ResticLister. -type ResticListerExpansion interface{} - -// ResticNamespaceListerExpansion allows custom methods to be added to -// ResticNamespaceLister. -type ResticNamespaceListerExpansion interface{} diff --git a/listers/apis/stash/recovery.go b/listers/apis/stash/recovery.go deleted file mode 100644 index a7f9289a6..000000000 --- a/listers/apis/stash/recovery.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// This file was automatically generated by lister-gen - -package stash - -import ( - stash "github.com/appscode/stash/apis/stash" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// RecoveryLister helps list Recoveries. -type RecoveryLister interface { - // List lists all Recoveries in the indexer. - List(selector labels.Selector) (ret []*stash.Recovery, err error) - // Recoveries returns an object that can list and get Recoveries. - Recoveries(namespace string) RecoveryNamespaceLister - RecoveryListerExpansion -} - -// recoveryLister implements the RecoveryLister interface. -type recoveryLister struct { - indexer cache.Indexer -} - -// NewRecoveryLister returns a new RecoveryLister. -func NewRecoveryLister(indexer cache.Indexer) RecoveryLister { - return &recoveryLister{indexer: indexer} -} - -// List lists all Recoveries in the indexer. -func (s *recoveryLister) List(selector labels.Selector) (ret []*stash.Recovery, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*stash.Recovery)) - }) - return ret, err -} - -// Recoveries returns an object that can list and get Recoveries. -func (s *recoveryLister) Recoveries(namespace string) RecoveryNamespaceLister { - return recoveryNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// RecoveryNamespaceLister helps list and get Recoveries. -type RecoveryNamespaceLister interface { - // List lists all Recoveries in the indexer for a given namespace. - List(selector labels.Selector) (ret []*stash.Recovery, err error) - // Get retrieves the Recovery from the indexer for a given namespace and name. - Get(name string) (*stash.Recovery, error) - RecoveryNamespaceListerExpansion -} - -// recoveryNamespaceLister implements the RecoveryNamespaceLister -// interface. -type recoveryNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Recoveries in the indexer for a given namespace. -func (s recoveryNamespaceLister) List(selector labels.Selector) (ret []*stash.Recovery, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*stash.Recovery)) - }) - return ret, err -} - -// Get retrieves the Recovery from the indexer for a given namespace and name. -func (s recoveryNamespaceLister) Get(name string) (*stash.Recovery, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(stash.Resource("recovery"), name) - } - return obj.(*stash.Recovery), nil -} diff --git a/listers/apis/stash/restic.go b/listers/apis/stash/restic.go deleted file mode 100644 index 985658f3e..000000000 --- a/listers/apis/stash/restic.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright 2018 The Stash Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// This file was automatically generated by lister-gen - -package stash - -import ( - stash "github.com/appscode/stash/apis/stash" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// ResticLister helps list Restics. -type ResticLister interface { - // List lists all Restics in the indexer. - List(selector labels.Selector) (ret []*stash.Restic, err error) - // Restics returns an object that can list and get Restics. - Restics(namespace string) ResticNamespaceLister - ResticListerExpansion -} - -// resticLister implements the ResticLister interface. -type resticLister struct { - indexer cache.Indexer -} - -// NewResticLister returns a new ResticLister. -func NewResticLister(indexer cache.Indexer) ResticLister { - return &resticLister{indexer: indexer} -} - -// List lists all Restics in the indexer. -func (s *resticLister) List(selector labels.Selector) (ret []*stash.Restic, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*stash.Restic)) - }) - return ret, err -} - -// Restics returns an object that can list and get Restics. -func (s *resticLister) Restics(namespace string) ResticNamespaceLister { - return resticNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ResticNamespaceLister helps list and get Restics. -type ResticNamespaceLister interface { - // List lists all Restics in the indexer for a given namespace. - List(selector labels.Selector) (ret []*stash.Restic, err error) - // Get retrieves the Restic from the indexer for a given namespace and name. - Get(name string) (*stash.Restic, error) - ResticNamespaceListerExpansion -} - -// resticNamespaceLister implements the ResticNamespaceLister -// interface. -type resticNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Restics in the indexer for a given namespace. -func (s resticNamespaceLister) List(selector labels.Selector) (ret []*stash.Restic, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*stash.Restic)) - }) - return ret, err -} - -// Get retrieves the Restic from the indexer for a given namespace and name. -func (s resticNamespaceLister) Get(name string) (*stash.Restic, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(stash.Resource("restic"), name) - } - return obj.(*stash.Restic), nil -}