diff --git a/multicluster/Makefile b/multicluster/Makefile index 5b39adf5ac0..4fa74f6c360 100644 --- a/multicluster/Makefile +++ b/multicluster/Makefile @@ -96,6 +96,9 @@ KUSTOMIZE = $(shell pwd)/bin/kustomize kustomize: ## Download kustomize locally if necessary. $(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v3@v3.8.7) +codegen: + ./hack/update-codegen.sh + # go-get-tool will 'go get' any package $2 and install it to $1. PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) define go-get-tool diff --git a/multicluster/apis/multicluster/v1alpha1/clusterclaim_types.go b/multicluster/apis/multicluster/v1alpha1/clusterclaim_types.go index 92533512e92..a0f1a237e06 100644 --- a/multicluster/apis/multicluster/v1alpha1/clusterclaim_types.go +++ b/multicluster/apis/multicluster/v1alpha1/clusterclaim_types.go @@ -27,6 +27,7 @@ const ( WellKnownClusterClaimClusterSet = "clusterSet.k8s.io" ) +// +genclient //+kubebuilder:object:root=true // ClusterClaim is the Schema for the clusterclaims API diff --git a/multicluster/apis/multicluster/v1alpha1/clusterset_types.go b/multicluster/apis/multicluster/v1alpha1/clusterset_types.go index cf23492c5cb..205b5190882 100644 --- a/multicluster/apis/multicluster/v1alpha1/clusterset_types.go +++ b/multicluster/apis/multicluster/v1alpha1/clusterset_types.go @@ -114,6 +114,7 @@ type ClusterSetStatus struct { ObservedGeneration int64 `json:"observedGeneration,omitempty"` } +// +genclient //+kubebuilder:object:root=true //+kubebuilder:subresource:status diff --git a/multicluster/apis/multicluster/v1alpha1/doc.go b/multicluster/apis/multicluster/v1alpha1/doc.go new file mode 100644 index 00000000000..385b64b20a6 --- /dev/null +++ b/multicluster/apis/multicluster/v1alpha1/doc.go @@ -0,0 +1,5 @@ +// +k8s:deepcopy-gen=package + +// Package v1 is the v1alpha1 version of the API. +// +groupName=multicluster.crd.antrea.io +package v1alpha1 diff --git a/multicluster/apis/multicluster/v1alpha1/memberclusterannounce_types.go b/multicluster/apis/multicluster/v1alpha1/memberclusterannounce_types.go index 2fc27d832f7..34bd401d0bf 100644 --- a/multicluster/apis/multicluster/v1alpha1/memberclusterannounce_types.go +++ b/multicluster/apis/multicluster/v1alpha1/memberclusterannounce_types.go @@ -20,6 +20,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +// +genclient //+kubebuilder:object:root=true // MemberClusterAnnounce is the Schema for the memberclusterannounces API diff --git a/multicluster/apis/multicluster/v1alpha1/register.go b/multicluster/apis/multicluster/v1alpha1/register.go new file mode 100644 index 00000000000..b84580412d2 --- /dev/null +++ b/multicluster/apis/multicluster/v1alpha1/register.go @@ -0,0 +1,13 @@ +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// SchemeGroupVersion is group version used to register these objects. +var SchemeGroupVersion = GroupVersion + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} diff --git a/multicluster/apis/multicluster/v1alpha1/resourceexport_types.go b/multicluster/apis/multicluster/v1alpha1/resourceexport_types.go index 6bf1eb4532d..100fe71982a 100644 --- a/multicluster/apis/multicluster/v1alpha1/resourceexport_types.go +++ b/multicluster/apis/multicluster/v1alpha1/resourceexport_types.go @@ -94,6 +94,7 @@ type ResourceExportStatus struct { Conditions []ResourceExportCondition `json:"conditions,omitempty"` } +// +genclient //+kubebuilder:object:root=true //+kubebuilder:subresource:status diff --git a/multicluster/apis/multicluster/v1alpha1/resourceexportfilter_types.go b/multicluster/apis/multicluster/v1alpha1/resourceexportfilter_types.go index 8415c83baa0..3c821b5aaf9 100644 --- a/multicluster/apis/multicluster/v1alpha1/resourceexportfilter_types.go +++ b/multicluster/apis/multicluster/v1alpha1/resourceexportfilter_types.go @@ -30,6 +30,7 @@ type ResourceExportFilterStatus struct { // TBD } +// +genclient //+kubebuilder:object:root=true //+kubebuilder:subresource:status diff --git a/multicluster/apis/multicluster/v1alpha1/resourceimport_types.go b/multicluster/apis/multicluster/v1alpha1/resourceimport_types.go index 04e815852df..d2223f6895c 100644 --- a/multicluster/apis/multicluster/v1alpha1/resourceimport_types.go +++ b/multicluster/apis/multicluster/v1alpha1/resourceimport_types.go @@ -99,6 +99,7 @@ type ResourceImportStatus struct { ClusterStatuses []ResourceImportClusterStatus `json:"clusterStatuses,omitempty"` } +// +genclient //+kubebuilder:object:root=true //+kubebuilder:subresource:status diff --git a/multicluster/apis/multicluster/v1alpha1/resourceimportfilter_types.go b/multicluster/apis/multicluster/v1alpha1/resourceimportfilter_types.go index abfc4020697..c5dc854904e 100644 --- a/multicluster/apis/multicluster/v1alpha1/resourceimportfilter_types.go +++ b/multicluster/apis/multicluster/v1alpha1/resourceimportfilter_types.go @@ -30,6 +30,7 @@ type ResourceImportFilterStatus struct { // TBD. } +// +genclient //+kubebuilder:object:root=true //+kubebuilder:subresource:status diff --git a/multicluster/hack/update-codegen-dockerized.sh b/multicluster/hack/update-codegen-dockerized.sh new file mode 100755 index 00000000000..671b862c3ed --- /dev/null +++ b/multicluster/hack/update-codegen-dockerized.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +# Copyright 2021 Antrea 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. + +set -o errexit +set -o nounset +set -o pipefail + +GOPATH=`go env GOPATH` +ANTREA_PKG="antrea.io/antrea" + +cd multicluster +rm -rf pkg/client/{clientset,informers,listers} + +$GOPATH/bin/client-gen \ + --clientset-name versioned \ + --input-base "${ANTREA_PKG}/multicluster/apis" \ + --input "multicluster/v1alpha1" \ + --output-package "${ANTREA_PKG}/multicluster/pkg/client/clientset" \ + --go-header-file hack/boilerplate.go.txt + +# Generate listers with K8s codegen tools. +$GOPATH/bin/lister-gen \ + --input-dirs "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha1" \ + --output-package "${ANTREA_PKG}/multicluster/pkg/client/listers" \ + --go-header-file hack/boilerplate.go.txt + + +# Generate informers with K8s codegen tools. +$GOPATH/bin/informer-gen \ + --input-dirs "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha1" \ + --versioned-clientset-package "${ANTREA_PKG}/multicluster/pkg/client/clientset/versioned" \ + --listers-package "${ANTREA_PKG}/multicluster/pkg/client/listers" \ + --output-package "${ANTREA_PKG}/multicluster/pkg/client/informers" \ + --go-header-file hack/boilerplate.go.txt + +$GOPATH/bin/deepcopy-gen \ + --input-dirs "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha1" \ + -O zz_generated.deepcopy \ + --go-header-file hack/boilerplate.go.txt + diff --git a/multicluster/hack/update-codegen.sh b/multicluster/hack/update-codegen.sh new file mode 100755 index 00000000000..d83426fd2c1 --- /dev/null +++ b/multicluster/hack/update-codegen.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +# Copyright 2021 Antrea 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. + +set -o errexit +set -o nounset +set -o pipefail + +ANTREA_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )" +IMAGE_NAME="antrea/codegen:kubernetes-1.21.0" + +function docker_run() { + docker pull ${IMAGE_NAME} + docker run --rm \ + -w /go/src/antrea.io/antrea \ + -v ${ANTREA_ROOT}:/go/src/antrea.io/antrea \ + "${IMAGE_NAME}" "$@" +} + +docker_run multicluster/hack/update-codegen-dockerized.sh diff --git a/multicluster/pkg/client/clientset/versioned/clientset.go b/multicluster/pkg/client/clientset/versioned/clientset.go new file mode 100644 index 00000000000..bb259f94f38 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/clientset.go @@ -0,0 +1,96 @@ +/* +Copyright 2021 Antrea 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. + +package versioned + +import ( + "fmt" + + multiclusterv1alpha1 "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1" + 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 + MulticlusterV1alpha1() multiclusterv1alpha1.MulticlusterV1alpha1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + multiclusterV1alpha1 *multiclusterv1alpha1.MulticlusterV1alpha1Client +} + +// MulticlusterV1alpha1 retrieves the MulticlusterV1alpha1Client +func (c *Clientset) MulticlusterV1alpha1() multiclusterv1alpha1.MulticlusterV1alpha1Interface { + return c.multiclusterV1alpha1 +} + +// 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. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfig will generate a rate-limiter in configShallowCopy. +func NewForConfig(c *rest.Config) (*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.multiclusterV1alpha1, err = multiclusterv1alpha1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + 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.multiclusterV1alpha1 = multiclusterv1alpha1.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.multiclusterV1alpha1 = multiclusterv1alpha1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/multicluster/pkg/client/clientset/versioned/doc.go b/multicluster/pkg/client/clientset/versioned/doc.go new file mode 100644 index 00000000000..9712fc11829 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2021 Antrea 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/multicluster/pkg/client/clientset/versioned/fake/clientset_generated.go b/multicluster/pkg/client/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 00000000000..3d7e46650e0 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,81 @@ +/* +Copyright 2021 Antrea 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. + +package fake + +import ( + clientset "antrea.io/antrea/multicluster/pkg/client/clientset/versioned" + multiclusterv1alpha1 "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1" + fakemulticlusterv1alpha1 "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/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) + } + } + + cs := &Clientset{tracker: o} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// 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 + tracker testing.ObjectTracker +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +func (c *Clientset) Tracker() testing.ObjectTracker { + return c.tracker +} + +var _ clientset.Interface = &Clientset{} + +// MulticlusterV1alpha1 retrieves the MulticlusterV1alpha1Client +func (c *Clientset) MulticlusterV1alpha1() multiclusterv1alpha1.MulticlusterV1alpha1Interface { + return &fakemulticlusterv1alpha1.FakeMulticlusterV1alpha1{Fake: &c.Fake} +} diff --git a/multicluster/pkg/client/clientset/versioned/fake/doc.go b/multicluster/pkg/client/clientset/versioned/fake/doc.go new file mode 100644 index 00000000000..5dbed648e3d --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2021 Antrea 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 fake clientset. +package fake diff --git a/multicluster/pkg/client/clientset/versioned/fake/register.go b/multicluster/pkg/client/clientset/versioned/fake/register.go new file mode 100644 index 00000000000..afa5a6d50b8 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/fake/register.go @@ -0,0 +1,55 @@ +/* +Copyright 2021 Antrea 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. + +package fake + +import ( + multiclusterv1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + 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" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) + +var localSchemeBuilder = runtime.SchemeBuilder{ + multiclusterv1alpha1.AddToScheme, +} + +// 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/kubernetes/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. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(scheme)) +} diff --git a/multicluster/pkg/client/clientset/versioned/scheme/doc.go b/multicluster/pkg/client/clientset/versioned/scheme/doc.go new file mode 100644 index 00000000000..39ac0ebcf10 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/scheme/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2021 Antrea 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 contains the scheme of the automatically generated clientset. +package scheme diff --git a/multicluster/pkg/client/clientset/versioned/scheme/register.go b/multicluster/pkg/client/clientset/versioned/scheme/register.go new file mode 100644 index 00000000000..65c0a88a2bd --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/scheme/register.go @@ -0,0 +1,55 @@ +/* +Copyright 2021 Antrea 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. + +package scheme + +import ( + multiclusterv1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + 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" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + multiclusterv1alpha1.AddToScheme, +} + +// 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/kubernetes/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. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(Scheme)) +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/clusterclaim.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/clusterclaim.go new file mode 100644 index 00000000000..14df10da7c7 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/clusterclaim.go @@ -0,0 +1,177 @@ +/* +Copyright 2021 Antrea 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. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/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" +) + +// ClusterClaimsGetter has a method to return a ClusterClaimInterface. +// A group's client should implement this interface. +type ClusterClaimsGetter interface { + ClusterClaims(namespace string) ClusterClaimInterface +} + +// ClusterClaimInterface has methods to work with ClusterClaim resources. +type ClusterClaimInterface interface { + Create(ctx context.Context, clusterClaim *v1alpha1.ClusterClaim, opts v1.CreateOptions) (*v1alpha1.ClusterClaim, error) + Update(ctx context.Context, clusterClaim *v1alpha1.ClusterClaim, opts v1.UpdateOptions) (*v1alpha1.ClusterClaim, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ClusterClaim, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterClaimList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterClaim, err error) + ClusterClaimExpansion +} + +// clusterClaims implements ClusterClaimInterface +type clusterClaims struct { + client rest.Interface + ns string +} + +// newClusterClaims returns a ClusterClaims +func newClusterClaims(c *MulticlusterV1alpha1Client, namespace string) *clusterClaims { + return &clusterClaims{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the clusterClaim, and returns the corresponding clusterClaim object, and an error if there is any. +func (c *clusterClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterClaim, err error) { + result = &v1alpha1.ClusterClaim{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusterclaims"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterClaims that match those selectors. +func (c *clusterClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterClaimList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.ClusterClaimList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusterclaims"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterClaims. +func (c *clusterClaims) Watch(ctx context.Context, opts v1.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("clusterclaims"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a clusterClaim and creates it. Returns the server's representation of the clusterClaim, and an error, if there is any. +func (c *clusterClaims) Create(ctx context.Context, clusterClaim *v1alpha1.ClusterClaim, opts v1.CreateOptions) (result *v1alpha1.ClusterClaim, err error) { + result = &v1alpha1.ClusterClaim{} + err = c.client.Post(). + Namespace(c.ns). + Resource("clusterclaims"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterClaim). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a clusterClaim and updates it. Returns the server's representation of the clusterClaim, and an error, if there is any. +func (c *clusterClaims) Update(ctx context.Context, clusterClaim *v1alpha1.ClusterClaim, opts v1.UpdateOptions) (result *v1alpha1.ClusterClaim, err error) { + result = &v1alpha1.ClusterClaim{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clusterclaims"). + Name(clusterClaim.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterClaim). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the clusterClaim and deletes it. Returns an error if one occurs. +func (c *clusterClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusterclaims"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.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("clusterclaims"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched clusterClaim. +func (c *clusterClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterClaim, err error) { + result = &v1alpha1.ClusterClaim{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("clusterclaims"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/clusterset.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/clusterset.go new file mode 100644 index 00000000000..354fc9d1f91 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/clusterset.go @@ -0,0 +1,194 @@ +/* +Copyright 2021 Antrea 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. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/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" +) + +// ClusterSetsGetter has a method to return a ClusterSetInterface. +// A group's client should implement this interface. +type ClusterSetsGetter interface { + ClusterSets(namespace string) ClusterSetInterface +} + +// ClusterSetInterface has methods to work with ClusterSet resources. +type ClusterSetInterface interface { + Create(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.CreateOptions) (*v1alpha1.ClusterSet, error) + Update(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.UpdateOptions) (*v1alpha1.ClusterSet, error) + UpdateStatus(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.UpdateOptions) (*v1alpha1.ClusterSet, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ClusterSet, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterSetList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterSet, err error) + ClusterSetExpansion +} + +// clusterSets implements ClusterSetInterface +type clusterSets struct { + client rest.Interface + ns string +} + +// newClusterSets returns a ClusterSets +func newClusterSets(c *MulticlusterV1alpha1Client, namespace string) *clusterSets { + return &clusterSets{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the clusterSet, and returns the corresponding clusterSet object, and an error if there is any. +func (c *clusterSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterSet, err error) { + result = &v1alpha1.ClusterSet{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clustersets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterSets that match those selectors. +func (c *clusterSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterSetList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.ClusterSetList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clustersets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterSets. +func (c *clusterSets) Watch(ctx context.Context, opts v1.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("clustersets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a clusterSet and creates it. Returns the server's representation of the clusterSet, and an error, if there is any. +func (c *clusterSets) Create(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.CreateOptions) (result *v1alpha1.ClusterSet, err error) { + result = &v1alpha1.ClusterSet{} + err = c.client.Post(). + Namespace(c.ns). + Resource("clustersets"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterSet). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a clusterSet and updates it. Returns the server's representation of the clusterSet, and an error, if there is any. +func (c *clusterSets) Update(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.UpdateOptions) (result *v1alpha1.ClusterSet, err error) { + result = &v1alpha1.ClusterSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clustersets"). + Name(clusterSet.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterSet). + Do(ctx). + 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 *clusterSets) UpdateStatus(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.UpdateOptions) (result *v1alpha1.ClusterSet, err error) { + result = &v1alpha1.ClusterSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clustersets"). + Name(clusterSet.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterSet). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the clusterSet and deletes it. Returns an error if one occurs. +func (c *clusterSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clustersets"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.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("clustersets"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched clusterSet. +func (c *clusterSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterSet, err error) { + result = &v1alpha1.ClusterSet{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("clustersets"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/doc.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/doc.go new file mode 100644 index 00000000000..af667f7bad2 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2021 Antrea 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 typed clients. +package v1alpha1 diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/doc.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/doc.go new file mode 100644 index 00000000000..02265d1ca8d --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2021 Antrea 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. + +// Package fake has the automatically generated clients. +package fake diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_clusterclaim.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_clusterclaim.go new file mode 100644 index 00000000000..d25958f8608 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_clusterclaim.go @@ -0,0 +1,129 @@ +/* +Copyright 2021 Antrea 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. + +package fake + +import ( + "context" + + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + 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" +) + +// FakeClusterClaims implements ClusterClaimInterface +type FakeClusterClaims struct { + Fake *FakeMulticlusterV1alpha1 + ns string +} + +var clusterclaimsResource = schema.GroupVersionResource{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Resource: "clusterclaims"} + +var clusterclaimsKind = schema.GroupVersionKind{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Kind: "ClusterClaim"} + +// Get takes name of the clusterClaim, and returns the corresponding clusterClaim object, and an error if there is any. +func (c *FakeClusterClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(clusterclaimsResource, c.ns, name), &v1alpha1.ClusterClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterClaim), err +} + +// List takes label and field selectors, and returns the list of ClusterClaims that match those selectors. +func (c *FakeClusterClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterClaimList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(clusterclaimsResource, clusterclaimsKind, c.ns, opts), &v1alpha1.ClusterClaimList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ClusterClaimList{ListMeta: obj.(*v1alpha1.ClusterClaimList).ListMeta} + for _, item := range obj.(*v1alpha1.ClusterClaimList).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 clusterClaims. +func (c *FakeClusterClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(clusterclaimsResource, c.ns, opts)) + +} + +// Create takes the representation of a clusterClaim and creates it. Returns the server's representation of the clusterClaim, and an error, if there is any. +func (c *FakeClusterClaims) Create(ctx context.Context, clusterClaim *v1alpha1.ClusterClaim, opts v1.CreateOptions) (result *v1alpha1.ClusterClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(clusterclaimsResource, c.ns, clusterClaim), &v1alpha1.ClusterClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterClaim), err +} + +// Update takes the representation of a clusterClaim and updates it. Returns the server's representation of the clusterClaim, and an error, if there is any. +func (c *FakeClusterClaims) Update(ctx context.Context, clusterClaim *v1alpha1.ClusterClaim, opts v1.UpdateOptions) (result *v1alpha1.ClusterClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(clusterclaimsResource, c.ns, clusterClaim), &v1alpha1.ClusterClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterClaim), err +} + +// Delete takes name of the clusterClaim and deletes it. Returns an error if one occurs. +func (c *FakeClusterClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(clusterclaimsResource, c.ns, name), &v1alpha1.ClusterClaim{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(clusterclaimsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.ClusterClaimList{}) + return err +} + +// Patch applies the patch and returns the patched clusterClaim. +func (c *FakeClusterClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(clusterclaimsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ClusterClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterClaim), err +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_clusterset.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_clusterset.go new file mode 100644 index 00000000000..8df9394bbb3 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_clusterset.go @@ -0,0 +1,141 @@ +/* +Copyright 2021 Antrea 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. + +package fake + +import ( + "context" + + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + 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" +) + +// FakeClusterSets implements ClusterSetInterface +type FakeClusterSets struct { + Fake *FakeMulticlusterV1alpha1 + ns string +} + +var clustersetsResource = schema.GroupVersionResource{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Resource: "clustersets"} + +var clustersetsKind = schema.GroupVersionKind{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Kind: "ClusterSet"} + +// Get takes name of the clusterSet, and returns the corresponding clusterSet object, and an error if there is any. +func (c *FakeClusterSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(clustersetsResource, c.ns, name), &v1alpha1.ClusterSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterSet), err +} + +// List takes label and field selectors, and returns the list of ClusterSets that match those selectors. +func (c *FakeClusterSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterSetList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(clustersetsResource, clustersetsKind, c.ns, opts), &v1alpha1.ClusterSetList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ClusterSetList{ListMeta: obj.(*v1alpha1.ClusterSetList).ListMeta} + for _, item := range obj.(*v1alpha1.ClusterSetList).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 clusterSets. +func (c *FakeClusterSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(clustersetsResource, c.ns, opts)) + +} + +// Create takes the representation of a clusterSet and creates it. Returns the server's representation of the clusterSet, and an error, if there is any. +func (c *FakeClusterSets) Create(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.CreateOptions) (result *v1alpha1.ClusterSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(clustersetsResource, c.ns, clusterSet), &v1alpha1.ClusterSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterSet), err +} + +// Update takes the representation of a clusterSet and updates it. Returns the server's representation of the clusterSet, and an error, if there is any. +func (c *FakeClusterSets) Update(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.UpdateOptions) (result *v1alpha1.ClusterSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(clustersetsResource, c.ns, clusterSet), &v1alpha1.ClusterSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterSet), 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 *FakeClusterSets) UpdateStatus(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.UpdateOptions) (*v1alpha1.ClusterSet, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(clustersetsResource, "status", c.ns, clusterSet), &v1alpha1.ClusterSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterSet), err +} + +// Delete takes name of the clusterSet and deletes it. Returns an error if one occurs. +func (c *FakeClusterSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(clustersetsResource, c.ns, name), &v1alpha1.ClusterSet{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(clustersetsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.ClusterSetList{}) + return err +} + +// Patch applies the patch and returns the patched clusterSet. +func (c *FakeClusterSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(clustersetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ClusterSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterSet), err +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_memberclusterannounce.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_memberclusterannounce.go new file mode 100644 index 00000000000..4bee9d1dd23 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_memberclusterannounce.go @@ -0,0 +1,129 @@ +/* +Copyright 2021 Antrea 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. + +package fake + +import ( + "context" + + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + 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" +) + +// FakeMemberClusterAnnounces implements MemberClusterAnnounceInterface +type FakeMemberClusterAnnounces struct { + Fake *FakeMulticlusterV1alpha1 + ns string +} + +var memberclusterannouncesResource = schema.GroupVersionResource{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Resource: "memberclusterannounces"} + +var memberclusterannouncesKind = schema.GroupVersionKind{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Kind: "MemberClusterAnnounce"} + +// Get takes name of the memberClusterAnnounce, and returns the corresponding memberClusterAnnounce object, and an error if there is any. +func (c *FakeMemberClusterAnnounces) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MemberClusterAnnounce, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(memberclusterannouncesResource, c.ns, name), &v1alpha1.MemberClusterAnnounce{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MemberClusterAnnounce), err +} + +// List takes label and field selectors, and returns the list of MemberClusterAnnounces that match those selectors. +func (c *FakeMemberClusterAnnounces) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MemberClusterAnnounceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(memberclusterannouncesResource, memberclusterannouncesKind, c.ns, opts), &v1alpha1.MemberClusterAnnounceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.MemberClusterAnnounceList{ListMeta: obj.(*v1alpha1.MemberClusterAnnounceList).ListMeta} + for _, item := range obj.(*v1alpha1.MemberClusterAnnounceList).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 memberClusterAnnounces. +func (c *FakeMemberClusterAnnounces) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(memberclusterannouncesResource, c.ns, opts)) + +} + +// Create takes the representation of a memberClusterAnnounce and creates it. Returns the server's representation of the memberClusterAnnounce, and an error, if there is any. +func (c *FakeMemberClusterAnnounces) Create(ctx context.Context, memberClusterAnnounce *v1alpha1.MemberClusterAnnounce, opts v1.CreateOptions) (result *v1alpha1.MemberClusterAnnounce, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(memberclusterannouncesResource, c.ns, memberClusterAnnounce), &v1alpha1.MemberClusterAnnounce{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MemberClusterAnnounce), err +} + +// Update takes the representation of a memberClusterAnnounce and updates it. Returns the server's representation of the memberClusterAnnounce, and an error, if there is any. +func (c *FakeMemberClusterAnnounces) Update(ctx context.Context, memberClusterAnnounce *v1alpha1.MemberClusterAnnounce, opts v1.UpdateOptions) (result *v1alpha1.MemberClusterAnnounce, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(memberclusterannouncesResource, c.ns, memberClusterAnnounce), &v1alpha1.MemberClusterAnnounce{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MemberClusterAnnounce), err +} + +// Delete takes name of the memberClusterAnnounce and deletes it. Returns an error if one occurs. +func (c *FakeMemberClusterAnnounces) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(memberclusterannouncesResource, c.ns, name), &v1alpha1.MemberClusterAnnounce{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMemberClusterAnnounces) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(memberclusterannouncesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.MemberClusterAnnounceList{}) + return err +} + +// Patch applies the patch and returns the patched memberClusterAnnounce. +func (c *FakeMemberClusterAnnounces) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MemberClusterAnnounce, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(memberclusterannouncesResource, c.ns, name, pt, data, subresources...), &v1alpha1.MemberClusterAnnounce{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MemberClusterAnnounce), err +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_multicluster_client.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_multicluster_client.go new file mode 100644 index 00000000000..30ac2ac7dae --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_multicluster_client.go @@ -0,0 +1,63 @@ +/* +Copyright 2021 Antrea 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. + +package fake + +import ( + v1alpha1 "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeMulticlusterV1alpha1 struct { + *testing.Fake +} + +func (c *FakeMulticlusterV1alpha1) ClusterClaims(namespace string) v1alpha1.ClusterClaimInterface { + return &FakeClusterClaims{c, namespace} +} + +func (c *FakeMulticlusterV1alpha1) ClusterSets(namespace string) v1alpha1.ClusterSetInterface { + return &FakeClusterSets{c, namespace} +} + +func (c *FakeMulticlusterV1alpha1) MemberClusterAnnounces(namespace string) v1alpha1.MemberClusterAnnounceInterface { + return &FakeMemberClusterAnnounces{c, namespace} +} + +func (c *FakeMulticlusterV1alpha1) ResourceExports(namespace string) v1alpha1.ResourceExportInterface { + return &FakeResourceExports{c, namespace} +} + +func (c *FakeMulticlusterV1alpha1) ResourceExportFilters(namespace string) v1alpha1.ResourceExportFilterInterface { + return &FakeResourceExportFilters{c, namespace} +} + +func (c *FakeMulticlusterV1alpha1) ResourceImports(namespace string) v1alpha1.ResourceImportInterface { + return &FakeResourceImports{c, namespace} +} + +func (c *FakeMulticlusterV1alpha1) ResourceImportFilters(namespace string) v1alpha1.ResourceImportFilterInterface { + return &FakeResourceImportFilters{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeMulticlusterV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceexport.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceexport.go new file mode 100644 index 00000000000..eb9f9a734a4 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceexport.go @@ -0,0 +1,141 @@ +/* +Copyright 2021 Antrea 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. + +package fake + +import ( + "context" + + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + 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" +) + +// FakeResourceExports implements ResourceExportInterface +type FakeResourceExports struct { + Fake *FakeMulticlusterV1alpha1 + ns string +} + +var resourceexportsResource = schema.GroupVersionResource{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Resource: "resourceexports"} + +var resourceexportsKind = schema.GroupVersionKind{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Kind: "ResourceExport"} + +// Get takes name of the resourceExport, and returns the corresponding resourceExport object, and an error if there is any. +func (c *FakeResourceExports) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceExport, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(resourceexportsResource, c.ns, name), &v1alpha1.ResourceExport{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceExport), err +} + +// List takes label and field selectors, and returns the list of ResourceExports that match those selectors. +func (c *FakeResourceExports) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ResourceExportList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(resourceexportsResource, resourceexportsKind, c.ns, opts), &v1alpha1.ResourceExportList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ResourceExportList{ListMeta: obj.(*v1alpha1.ResourceExportList).ListMeta} + for _, item := range obj.(*v1alpha1.ResourceExportList).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 resourceExports. +func (c *FakeResourceExports) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(resourceexportsResource, c.ns, opts)) + +} + +// Create takes the representation of a resourceExport and creates it. Returns the server's representation of the resourceExport, and an error, if there is any. +func (c *FakeResourceExports) Create(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.CreateOptions) (result *v1alpha1.ResourceExport, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(resourceexportsResource, c.ns, resourceExport), &v1alpha1.ResourceExport{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceExport), err +} + +// Update takes the representation of a resourceExport and updates it. Returns the server's representation of the resourceExport, and an error, if there is any. +func (c *FakeResourceExports) Update(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.UpdateOptions) (result *v1alpha1.ResourceExport, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(resourceexportsResource, c.ns, resourceExport), &v1alpha1.ResourceExport{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceExport), 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 *FakeResourceExports) UpdateStatus(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.UpdateOptions) (*v1alpha1.ResourceExport, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(resourceexportsResource, "status", c.ns, resourceExport), &v1alpha1.ResourceExport{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceExport), err +} + +// Delete takes name of the resourceExport and deletes it. Returns an error if one occurs. +func (c *FakeResourceExports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(resourceexportsResource, c.ns, name), &v1alpha1.ResourceExport{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeResourceExports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(resourceexportsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.ResourceExportList{}) + return err +} + +// Patch applies the patch and returns the patched resourceExport. +func (c *FakeResourceExports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceExport, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourceexportsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ResourceExport{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceExport), err +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceexportfilter.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceexportfilter.go new file mode 100644 index 00000000000..60aa67b4124 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceexportfilter.go @@ -0,0 +1,141 @@ +/* +Copyright 2021 Antrea 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. + +package fake + +import ( + "context" + + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + 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" +) + +// FakeResourceExportFilters implements ResourceExportFilterInterface +type FakeResourceExportFilters struct { + Fake *FakeMulticlusterV1alpha1 + ns string +} + +var resourceexportfiltersResource = schema.GroupVersionResource{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Resource: "resourceexportfilters"} + +var resourceexportfiltersKind = schema.GroupVersionKind{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Kind: "ResourceExportFilter"} + +// Get takes name of the resourceExportFilter, and returns the corresponding resourceExportFilter object, and an error if there is any. +func (c *FakeResourceExportFilters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceExportFilter, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(resourceexportfiltersResource, c.ns, name), &v1alpha1.ResourceExportFilter{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceExportFilter), err +} + +// List takes label and field selectors, and returns the list of ResourceExportFilters that match those selectors. +func (c *FakeResourceExportFilters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ResourceExportFilterList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(resourceexportfiltersResource, resourceexportfiltersKind, c.ns, opts), &v1alpha1.ResourceExportFilterList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ResourceExportFilterList{ListMeta: obj.(*v1alpha1.ResourceExportFilterList).ListMeta} + for _, item := range obj.(*v1alpha1.ResourceExportFilterList).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 resourceExportFilters. +func (c *FakeResourceExportFilters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(resourceexportfiltersResource, c.ns, opts)) + +} + +// Create takes the representation of a resourceExportFilter and creates it. Returns the server's representation of the resourceExportFilter, and an error, if there is any. +func (c *FakeResourceExportFilters) Create(ctx context.Context, resourceExportFilter *v1alpha1.ResourceExportFilter, opts v1.CreateOptions) (result *v1alpha1.ResourceExportFilter, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(resourceexportfiltersResource, c.ns, resourceExportFilter), &v1alpha1.ResourceExportFilter{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceExportFilter), err +} + +// Update takes the representation of a resourceExportFilter and updates it. Returns the server's representation of the resourceExportFilter, and an error, if there is any. +func (c *FakeResourceExportFilters) Update(ctx context.Context, resourceExportFilter *v1alpha1.ResourceExportFilter, opts v1.UpdateOptions) (result *v1alpha1.ResourceExportFilter, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(resourceexportfiltersResource, c.ns, resourceExportFilter), &v1alpha1.ResourceExportFilter{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceExportFilter), 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 *FakeResourceExportFilters) UpdateStatus(ctx context.Context, resourceExportFilter *v1alpha1.ResourceExportFilter, opts v1.UpdateOptions) (*v1alpha1.ResourceExportFilter, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(resourceexportfiltersResource, "status", c.ns, resourceExportFilter), &v1alpha1.ResourceExportFilter{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceExportFilter), err +} + +// Delete takes name of the resourceExportFilter and deletes it. Returns an error if one occurs. +func (c *FakeResourceExportFilters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(resourceexportfiltersResource, c.ns, name), &v1alpha1.ResourceExportFilter{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeResourceExportFilters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(resourceexportfiltersResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.ResourceExportFilterList{}) + return err +} + +// Patch applies the patch and returns the patched resourceExportFilter. +func (c *FakeResourceExportFilters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceExportFilter, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourceexportfiltersResource, c.ns, name, pt, data, subresources...), &v1alpha1.ResourceExportFilter{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceExportFilter), err +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceimport.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceimport.go new file mode 100644 index 00000000000..4d034c72dea --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceimport.go @@ -0,0 +1,141 @@ +/* +Copyright 2021 Antrea 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. + +package fake + +import ( + "context" + + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + 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" +) + +// FakeResourceImports implements ResourceImportInterface +type FakeResourceImports struct { + Fake *FakeMulticlusterV1alpha1 + ns string +} + +var resourceimportsResource = schema.GroupVersionResource{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Resource: "resourceimports"} + +var resourceimportsKind = schema.GroupVersionKind{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Kind: "ResourceImport"} + +// Get takes name of the resourceImport, and returns the corresponding resourceImport object, and an error if there is any. +func (c *FakeResourceImports) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceImport, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(resourceimportsResource, c.ns, name), &v1alpha1.ResourceImport{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceImport), err +} + +// List takes label and field selectors, and returns the list of ResourceImports that match those selectors. +func (c *FakeResourceImports) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ResourceImportList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(resourceimportsResource, resourceimportsKind, c.ns, opts), &v1alpha1.ResourceImportList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ResourceImportList{ListMeta: obj.(*v1alpha1.ResourceImportList).ListMeta} + for _, item := range obj.(*v1alpha1.ResourceImportList).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 resourceImports. +func (c *FakeResourceImports) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(resourceimportsResource, c.ns, opts)) + +} + +// Create takes the representation of a resourceImport and creates it. Returns the server's representation of the resourceImport, and an error, if there is any. +func (c *FakeResourceImports) Create(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.CreateOptions) (result *v1alpha1.ResourceImport, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(resourceimportsResource, c.ns, resourceImport), &v1alpha1.ResourceImport{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceImport), err +} + +// Update takes the representation of a resourceImport and updates it. Returns the server's representation of the resourceImport, and an error, if there is any. +func (c *FakeResourceImports) Update(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.UpdateOptions) (result *v1alpha1.ResourceImport, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(resourceimportsResource, c.ns, resourceImport), &v1alpha1.ResourceImport{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceImport), 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 *FakeResourceImports) UpdateStatus(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.UpdateOptions) (*v1alpha1.ResourceImport, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(resourceimportsResource, "status", c.ns, resourceImport), &v1alpha1.ResourceImport{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceImport), err +} + +// Delete takes name of the resourceImport and deletes it. Returns an error if one occurs. +func (c *FakeResourceImports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(resourceimportsResource, c.ns, name), &v1alpha1.ResourceImport{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeResourceImports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(resourceimportsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.ResourceImportList{}) + return err +} + +// Patch applies the patch and returns the patched resourceImport. +func (c *FakeResourceImports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceImport, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourceimportsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ResourceImport{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceImport), err +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceimportfilter.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceimportfilter.go new file mode 100644 index 00000000000..52757098b4a --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceimportfilter.go @@ -0,0 +1,141 @@ +/* +Copyright 2021 Antrea 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. + +package fake + +import ( + "context" + + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + 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" +) + +// FakeResourceImportFilters implements ResourceImportFilterInterface +type FakeResourceImportFilters struct { + Fake *FakeMulticlusterV1alpha1 + ns string +} + +var resourceimportfiltersResource = schema.GroupVersionResource{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Resource: "resourceimportfilters"} + +var resourceimportfiltersKind = schema.GroupVersionKind{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Kind: "ResourceImportFilter"} + +// Get takes name of the resourceImportFilter, and returns the corresponding resourceImportFilter object, and an error if there is any. +func (c *FakeResourceImportFilters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceImportFilter, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(resourceimportfiltersResource, c.ns, name), &v1alpha1.ResourceImportFilter{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceImportFilter), err +} + +// List takes label and field selectors, and returns the list of ResourceImportFilters that match those selectors. +func (c *FakeResourceImportFilters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ResourceImportFilterList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(resourceimportfiltersResource, resourceimportfiltersKind, c.ns, opts), &v1alpha1.ResourceImportFilterList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ResourceImportFilterList{ListMeta: obj.(*v1alpha1.ResourceImportFilterList).ListMeta} + for _, item := range obj.(*v1alpha1.ResourceImportFilterList).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 resourceImportFilters. +func (c *FakeResourceImportFilters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(resourceimportfiltersResource, c.ns, opts)) + +} + +// Create takes the representation of a resourceImportFilter and creates it. Returns the server's representation of the resourceImportFilter, and an error, if there is any. +func (c *FakeResourceImportFilters) Create(ctx context.Context, resourceImportFilter *v1alpha1.ResourceImportFilter, opts v1.CreateOptions) (result *v1alpha1.ResourceImportFilter, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(resourceimportfiltersResource, c.ns, resourceImportFilter), &v1alpha1.ResourceImportFilter{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceImportFilter), err +} + +// Update takes the representation of a resourceImportFilter and updates it. Returns the server's representation of the resourceImportFilter, and an error, if there is any. +func (c *FakeResourceImportFilters) Update(ctx context.Context, resourceImportFilter *v1alpha1.ResourceImportFilter, opts v1.UpdateOptions) (result *v1alpha1.ResourceImportFilter, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(resourceimportfiltersResource, c.ns, resourceImportFilter), &v1alpha1.ResourceImportFilter{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceImportFilter), 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 *FakeResourceImportFilters) UpdateStatus(ctx context.Context, resourceImportFilter *v1alpha1.ResourceImportFilter, opts v1.UpdateOptions) (*v1alpha1.ResourceImportFilter, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(resourceimportfiltersResource, "status", c.ns, resourceImportFilter), &v1alpha1.ResourceImportFilter{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceImportFilter), err +} + +// Delete takes name of the resourceImportFilter and deletes it. Returns an error if one occurs. +func (c *FakeResourceImportFilters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(resourceimportfiltersResource, c.ns, name), &v1alpha1.ResourceImportFilter{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeResourceImportFilters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(resourceimportfiltersResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.ResourceImportFilterList{}) + return err +} + +// Patch applies the patch and returns the patched resourceImportFilter. +func (c *FakeResourceImportFilters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceImportFilter, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourceimportfiltersResource, c.ns, name, pt, data, subresources...), &v1alpha1.ResourceImportFilter{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ResourceImportFilter), err +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/generated_expansion.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/generated_expansion.go new file mode 100644 index 00000000000..f666a0a8999 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/generated_expansion.go @@ -0,0 +1,32 @@ +/* +Copyright 2021 Antrea 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. + +package v1alpha1 + +type ClusterClaimExpansion interface{} + +type ClusterSetExpansion interface{} + +type MemberClusterAnnounceExpansion interface{} + +type ResourceExportExpansion interface{} + +type ResourceExportFilterExpansion interface{} + +type ResourceImportExpansion interface{} + +type ResourceImportFilterExpansion interface{} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/memberclusterannounce.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/memberclusterannounce.go new file mode 100644 index 00000000000..371b5d57860 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/memberclusterannounce.go @@ -0,0 +1,177 @@ +/* +Copyright 2021 Antrea 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. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/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" +) + +// MemberClusterAnnouncesGetter has a method to return a MemberClusterAnnounceInterface. +// A group's client should implement this interface. +type MemberClusterAnnouncesGetter interface { + MemberClusterAnnounces(namespace string) MemberClusterAnnounceInterface +} + +// MemberClusterAnnounceInterface has methods to work with MemberClusterAnnounce resources. +type MemberClusterAnnounceInterface interface { + Create(ctx context.Context, memberClusterAnnounce *v1alpha1.MemberClusterAnnounce, opts v1.CreateOptions) (*v1alpha1.MemberClusterAnnounce, error) + Update(ctx context.Context, memberClusterAnnounce *v1alpha1.MemberClusterAnnounce, opts v1.UpdateOptions) (*v1alpha1.MemberClusterAnnounce, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.MemberClusterAnnounce, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.MemberClusterAnnounceList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MemberClusterAnnounce, err error) + MemberClusterAnnounceExpansion +} + +// memberClusterAnnounces implements MemberClusterAnnounceInterface +type memberClusterAnnounces struct { + client rest.Interface + ns string +} + +// newMemberClusterAnnounces returns a MemberClusterAnnounces +func newMemberClusterAnnounces(c *MulticlusterV1alpha1Client, namespace string) *memberClusterAnnounces { + return &memberClusterAnnounces{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the memberClusterAnnounce, and returns the corresponding memberClusterAnnounce object, and an error if there is any. +func (c *memberClusterAnnounces) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MemberClusterAnnounce, err error) { + result = &v1alpha1.MemberClusterAnnounce{} + err = c.client.Get(). + Namespace(c.ns). + Resource("memberclusterannounces"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MemberClusterAnnounces that match those selectors. +func (c *memberClusterAnnounces) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MemberClusterAnnounceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.MemberClusterAnnounceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("memberclusterannounces"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested memberClusterAnnounces. +func (c *memberClusterAnnounces) Watch(ctx context.Context, opts v1.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("memberclusterannounces"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a memberClusterAnnounce and creates it. Returns the server's representation of the memberClusterAnnounce, and an error, if there is any. +func (c *memberClusterAnnounces) Create(ctx context.Context, memberClusterAnnounce *v1alpha1.MemberClusterAnnounce, opts v1.CreateOptions) (result *v1alpha1.MemberClusterAnnounce, err error) { + result = &v1alpha1.MemberClusterAnnounce{} + err = c.client.Post(). + Namespace(c.ns). + Resource("memberclusterannounces"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(memberClusterAnnounce). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a memberClusterAnnounce and updates it. Returns the server's representation of the memberClusterAnnounce, and an error, if there is any. +func (c *memberClusterAnnounces) Update(ctx context.Context, memberClusterAnnounce *v1alpha1.MemberClusterAnnounce, opts v1.UpdateOptions) (result *v1alpha1.MemberClusterAnnounce, err error) { + result = &v1alpha1.MemberClusterAnnounce{} + err = c.client.Put(). + Namespace(c.ns). + Resource("memberclusterannounces"). + Name(memberClusterAnnounce.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(memberClusterAnnounce). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the memberClusterAnnounce and deletes it. Returns an error if one occurs. +func (c *memberClusterAnnounces) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("memberclusterannounces"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *memberClusterAnnounces) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.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("memberclusterannounces"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched memberClusterAnnounce. +func (c *memberClusterAnnounces) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MemberClusterAnnounce, err error) { + result = &v1alpha1.MemberClusterAnnounce{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("memberclusterannounces"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/multicluster_client.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/multicluster_client.go new file mode 100644 index 00000000000..e3b1c38e45f --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/multicluster_client.go @@ -0,0 +1,118 @@ +/* +Copyright 2021 Antrea 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. + +package v1alpha1 + +import ( + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type MulticlusterV1alpha1Interface interface { + RESTClient() rest.Interface + ClusterClaimsGetter + ClusterSetsGetter + MemberClusterAnnouncesGetter + ResourceExportsGetter + ResourceExportFiltersGetter + ResourceImportsGetter + ResourceImportFiltersGetter +} + +// MulticlusterV1alpha1Client is used to interact with features provided by the multicluster.crd.antrea.io group. +type MulticlusterV1alpha1Client struct { + restClient rest.Interface +} + +func (c *MulticlusterV1alpha1Client) ClusterClaims(namespace string) ClusterClaimInterface { + return newClusterClaims(c, namespace) +} + +func (c *MulticlusterV1alpha1Client) ClusterSets(namespace string) ClusterSetInterface { + return newClusterSets(c, namespace) +} + +func (c *MulticlusterV1alpha1Client) MemberClusterAnnounces(namespace string) MemberClusterAnnounceInterface { + return newMemberClusterAnnounces(c, namespace) +} + +func (c *MulticlusterV1alpha1Client) ResourceExports(namespace string) ResourceExportInterface { + return newResourceExports(c, namespace) +} + +func (c *MulticlusterV1alpha1Client) ResourceExportFilters(namespace string) ResourceExportFilterInterface { + return newResourceExportFilters(c, namespace) +} + +func (c *MulticlusterV1alpha1Client) ResourceImports(namespace string) ResourceImportInterface { + return newResourceImports(c, namespace) +} + +func (c *MulticlusterV1alpha1Client) ResourceImportFilters(namespace string) ResourceImportFilterInterface { + return newResourceImportFilters(c, namespace) +} + +// NewForConfig creates a new MulticlusterV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*MulticlusterV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &MulticlusterV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new MulticlusterV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *MulticlusterV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new MulticlusterV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *MulticlusterV1alpha1Client { + return &MulticlusterV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *MulticlusterV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceexport.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceexport.go new file mode 100644 index 00000000000..4690d1ff212 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceexport.go @@ -0,0 +1,194 @@ +/* +Copyright 2021 Antrea 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. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/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" +) + +// ResourceExportsGetter has a method to return a ResourceExportInterface. +// A group's client should implement this interface. +type ResourceExportsGetter interface { + ResourceExports(namespace string) ResourceExportInterface +} + +// ResourceExportInterface has methods to work with ResourceExport resources. +type ResourceExportInterface interface { + Create(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.CreateOptions) (*v1alpha1.ResourceExport, error) + Update(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.UpdateOptions) (*v1alpha1.ResourceExport, error) + UpdateStatus(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.UpdateOptions) (*v1alpha1.ResourceExport, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ResourceExport, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ResourceExportList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceExport, err error) + ResourceExportExpansion +} + +// resourceExports implements ResourceExportInterface +type resourceExports struct { + client rest.Interface + ns string +} + +// newResourceExports returns a ResourceExports +func newResourceExports(c *MulticlusterV1alpha1Client, namespace string) *resourceExports { + return &resourceExports{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the resourceExport, and returns the corresponding resourceExport object, and an error if there is any. +func (c *resourceExports) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceExport, err error) { + result = &v1alpha1.ResourceExport{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourceexports"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ResourceExports that match those selectors. +func (c *resourceExports) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ResourceExportList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.ResourceExportList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourceexports"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested resourceExports. +func (c *resourceExports) Watch(ctx context.Context, opts v1.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("resourceexports"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a resourceExport and creates it. Returns the server's representation of the resourceExport, and an error, if there is any. +func (c *resourceExports) Create(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.CreateOptions) (result *v1alpha1.ResourceExport, err error) { + result = &v1alpha1.ResourceExport{} + err = c.client.Post(). + Namespace(c.ns). + Resource("resourceexports"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceExport). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a resourceExport and updates it. Returns the server's representation of the resourceExport, and an error, if there is any. +func (c *resourceExports) Update(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.UpdateOptions) (result *v1alpha1.ResourceExport, err error) { + result = &v1alpha1.ResourceExport{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourceexports"). + Name(resourceExport.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceExport). + Do(ctx). + 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 *resourceExports) UpdateStatus(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.UpdateOptions) (result *v1alpha1.ResourceExport, err error) { + result = &v1alpha1.ResourceExport{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourceexports"). + Name(resourceExport.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceExport). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the resourceExport and deletes it. Returns an error if one occurs. +func (c *resourceExports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("resourceexports"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *resourceExports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.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("resourceexports"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched resourceExport. +func (c *resourceExports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceExport, err error) { + result = &v1alpha1.ResourceExport{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("resourceexports"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceexportfilter.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceexportfilter.go new file mode 100644 index 00000000000..63c8c122f15 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceexportfilter.go @@ -0,0 +1,194 @@ +/* +Copyright 2021 Antrea 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. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/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" +) + +// ResourceExportFiltersGetter has a method to return a ResourceExportFilterInterface. +// A group's client should implement this interface. +type ResourceExportFiltersGetter interface { + ResourceExportFilters(namespace string) ResourceExportFilterInterface +} + +// ResourceExportFilterInterface has methods to work with ResourceExportFilter resources. +type ResourceExportFilterInterface interface { + Create(ctx context.Context, resourceExportFilter *v1alpha1.ResourceExportFilter, opts v1.CreateOptions) (*v1alpha1.ResourceExportFilter, error) + Update(ctx context.Context, resourceExportFilter *v1alpha1.ResourceExportFilter, opts v1.UpdateOptions) (*v1alpha1.ResourceExportFilter, error) + UpdateStatus(ctx context.Context, resourceExportFilter *v1alpha1.ResourceExportFilter, opts v1.UpdateOptions) (*v1alpha1.ResourceExportFilter, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ResourceExportFilter, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ResourceExportFilterList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceExportFilter, err error) + ResourceExportFilterExpansion +} + +// resourceExportFilters implements ResourceExportFilterInterface +type resourceExportFilters struct { + client rest.Interface + ns string +} + +// newResourceExportFilters returns a ResourceExportFilters +func newResourceExportFilters(c *MulticlusterV1alpha1Client, namespace string) *resourceExportFilters { + return &resourceExportFilters{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the resourceExportFilter, and returns the corresponding resourceExportFilter object, and an error if there is any. +func (c *resourceExportFilters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceExportFilter, err error) { + result = &v1alpha1.ResourceExportFilter{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourceexportfilters"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ResourceExportFilters that match those selectors. +func (c *resourceExportFilters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ResourceExportFilterList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.ResourceExportFilterList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourceexportfilters"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested resourceExportFilters. +func (c *resourceExportFilters) Watch(ctx context.Context, opts v1.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("resourceexportfilters"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a resourceExportFilter and creates it. Returns the server's representation of the resourceExportFilter, and an error, if there is any. +func (c *resourceExportFilters) Create(ctx context.Context, resourceExportFilter *v1alpha1.ResourceExportFilter, opts v1.CreateOptions) (result *v1alpha1.ResourceExportFilter, err error) { + result = &v1alpha1.ResourceExportFilter{} + err = c.client.Post(). + Namespace(c.ns). + Resource("resourceexportfilters"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceExportFilter). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a resourceExportFilter and updates it. Returns the server's representation of the resourceExportFilter, and an error, if there is any. +func (c *resourceExportFilters) Update(ctx context.Context, resourceExportFilter *v1alpha1.ResourceExportFilter, opts v1.UpdateOptions) (result *v1alpha1.ResourceExportFilter, err error) { + result = &v1alpha1.ResourceExportFilter{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourceexportfilters"). + Name(resourceExportFilter.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceExportFilter). + Do(ctx). + 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 *resourceExportFilters) UpdateStatus(ctx context.Context, resourceExportFilter *v1alpha1.ResourceExportFilter, opts v1.UpdateOptions) (result *v1alpha1.ResourceExportFilter, err error) { + result = &v1alpha1.ResourceExportFilter{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourceexportfilters"). + Name(resourceExportFilter.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceExportFilter). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the resourceExportFilter and deletes it. Returns an error if one occurs. +func (c *resourceExportFilters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("resourceexportfilters"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *resourceExportFilters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.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("resourceexportfilters"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched resourceExportFilter. +func (c *resourceExportFilters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceExportFilter, err error) { + result = &v1alpha1.ResourceExportFilter{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("resourceexportfilters"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceimport.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceimport.go new file mode 100644 index 00000000000..b3059c6efe0 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceimport.go @@ -0,0 +1,194 @@ +/* +Copyright 2021 Antrea 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. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/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" +) + +// ResourceImportsGetter has a method to return a ResourceImportInterface. +// A group's client should implement this interface. +type ResourceImportsGetter interface { + ResourceImports(namespace string) ResourceImportInterface +} + +// ResourceImportInterface has methods to work with ResourceImport resources. +type ResourceImportInterface interface { + Create(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.CreateOptions) (*v1alpha1.ResourceImport, error) + Update(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.UpdateOptions) (*v1alpha1.ResourceImport, error) + UpdateStatus(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.UpdateOptions) (*v1alpha1.ResourceImport, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ResourceImport, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ResourceImportList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceImport, err error) + ResourceImportExpansion +} + +// resourceImports implements ResourceImportInterface +type resourceImports struct { + client rest.Interface + ns string +} + +// newResourceImports returns a ResourceImports +func newResourceImports(c *MulticlusterV1alpha1Client, namespace string) *resourceImports { + return &resourceImports{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the resourceImport, and returns the corresponding resourceImport object, and an error if there is any. +func (c *resourceImports) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceImport, err error) { + result = &v1alpha1.ResourceImport{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourceimports"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ResourceImports that match those selectors. +func (c *resourceImports) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ResourceImportList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.ResourceImportList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourceimports"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested resourceImports. +func (c *resourceImports) Watch(ctx context.Context, opts v1.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("resourceimports"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a resourceImport and creates it. Returns the server's representation of the resourceImport, and an error, if there is any. +func (c *resourceImports) Create(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.CreateOptions) (result *v1alpha1.ResourceImport, err error) { + result = &v1alpha1.ResourceImport{} + err = c.client.Post(). + Namespace(c.ns). + Resource("resourceimports"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceImport). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a resourceImport and updates it. Returns the server's representation of the resourceImport, and an error, if there is any. +func (c *resourceImports) Update(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.UpdateOptions) (result *v1alpha1.ResourceImport, err error) { + result = &v1alpha1.ResourceImport{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourceimports"). + Name(resourceImport.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceImport). + Do(ctx). + 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 *resourceImports) UpdateStatus(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.UpdateOptions) (result *v1alpha1.ResourceImport, err error) { + result = &v1alpha1.ResourceImport{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourceimports"). + Name(resourceImport.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceImport). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the resourceImport and deletes it. Returns an error if one occurs. +func (c *resourceImports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("resourceimports"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *resourceImports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.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("resourceimports"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched resourceImport. +func (c *resourceImports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceImport, err error) { + result = &v1alpha1.ResourceImport{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("resourceimports"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceimportfilter.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceimportfilter.go new file mode 100644 index 00000000000..509250d2109 --- /dev/null +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceimportfilter.go @@ -0,0 +1,194 @@ +/* +Copyright 2021 Antrea 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. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/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" +) + +// ResourceImportFiltersGetter has a method to return a ResourceImportFilterInterface. +// A group's client should implement this interface. +type ResourceImportFiltersGetter interface { + ResourceImportFilters(namespace string) ResourceImportFilterInterface +} + +// ResourceImportFilterInterface has methods to work with ResourceImportFilter resources. +type ResourceImportFilterInterface interface { + Create(ctx context.Context, resourceImportFilter *v1alpha1.ResourceImportFilter, opts v1.CreateOptions) (*v1alpha1.ResourceImportFilter, error) + Update(ctx context.Context, resourceImportFilter *v1alpha1.ResourceImportFilter, opts v1.UpdateOptions) (*v1alpha1.ResourceImportFilter, error) + UpdateStatus(ctx context.Context, resourceImportFilter *v1alpha1.ResourceImportFilter, opts v1.UpdateOptions) (*v1alpha1.ResourceImportFilter, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ResourceImportFilter, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ResourceImportFilterList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceImportFilter, err error) + ResourceImportFilterExpansion +} + +// resourceImportFilters implements ResourceImportFilterInterface +type resourceImportFilters struct { + client rest.Interface + ns string +} + +// newResourceImportFilters returns a ResourceImportFilters +func newResourceImportFilters(c *MulticlusterV1alpha1Client, namespace string) *resourceImportFilters { + return &resourceImportFilters{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the resourceImportFilter, and returns the corresponding resourceImportFilter object, and an error if there is any. +func (c *resourceImportFilters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceImportFilter, err error) { + result = &v1alpha1.ResourceImportFilter{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourceimportfilters"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ResourceImportFilters that match those selectors. +func (c *resourceImportFilters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ResourceImportFilterList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.ResourceImportFilterList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourceimportfilters"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested resourceImportFilters. +func (c *resourceImportFilters) Watch(ctx context.Context, opts v1.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("resourceimportfilters"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a resourceImportFilter and creates it. Returns the server's representation of the resourceImportFilter, and an error, if there is any. +func (c *resourceImportFilters) Create(ctx context.Context, resourceImportFilter *v1alpha1.ResourceImportFilter, opts v1.CreateOptions) (result *v1alpha1.ResourceImportFilter, err error) { + result = &v1alpha1.ResourceImportFilter{} + err = c.client.Post(). + Namespace(c.ns). + Resource("resourceimportfilters"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceImportFilter). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a resourceImportFilter and updates it. Returns the server's representation of the resourceImportFilter, and an error, if there is any. +func (c *resourceImportFilters) Update(ctx context.Context, resourceImportFilter *v1alpha1.ResourceImportFilter, opts v1.UpdateOptions) (result *v1alpha1.ResourceImportFilter, err error) { + result = &v1alpha1.ResourceImportFilter{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourceimportfilters"). + Name(resourceImportFilter.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceImportFilter). + Do(ctx). + 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 *resourceImportFilters) UpdateStatus(ctx context.Context, resourceImportFilter *v1alpha1.ResourceImportFilter, opts v1.UpdateOptions) (result *v1alpha1.ResourceImportFilter, err error) { + result = &v1alpha1.ResourceImportFilter{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourceimportfilters"). + Name(resourceImportFilter.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceImportFilter). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the resourceImportFilter and deletes it. Returns an error if one occurs. +func (c *resourceImportFilters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("resourceimportfilters"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *resourceImportFilters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.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("resourceimportfilters"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched resourceImportFilter. +func (c *resourceImportFilters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceImportFilter, err error) { + result = &v1alpha1.ResourceImportFilter{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("resourceimportfilters"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/multicluster/pkg/client/informers/externalversions/factory.go b/multicluster/pkg/client/informers/externalversions/factory.go new file mode 100644 index 00000000000..be319166eab --- /dev/null +++ b/multicluster/pkg/client/informers/externalversions/factory.go @@ -0,0 +1,179 @@ +/* +Copyright 2021 Antrea 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 informer-gen. DO NOT EDIT. + +package externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + versioned "antrea.io/antrea/multicluster/pkg/client/clientset/versioned" + internalinterfaces "antrea.io/antrea/multicluster/pkg/client/informers/externalversions/internalinterfaces" + multicluster "antrea.io/antrea/multicluster/pkg/client/informers/externalversions/multicluster" + 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" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + 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 +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + 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) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Multicluster() multicluster.Interface +} + +func (f *sharedInformerFactory) Multicluster() multicluster.Interface { + return multicluster.New(f, f.namespace, f.tweakListOptions) +} diff --git a/multicluster/pkg/client/informers/externalversions/generic.go b/multicluster/pkg/client/informers/externalversions/generic.go new file mode 100644 index 00000000000..838bedf070a --- /dev/null +++ b/multicluster/pkg/client/informers/externalversions/generic.go @@ -0,0 +1,73 @@ +/* +Copyright 2021 Antrea 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 informer-gen. DO NOT EDIT. + +package externalversions + +import ( + "fmt" + + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=multicluster.crd.antrea.io, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("clusterclaims"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Multicluster().V1alpha1().ClusterClaims().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("clustersets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Multicluster().V1alpha1().ClusterSets().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("memberclusterannounces"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Multicluster().V1alpha1().MemberClusterAnnounces().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("resourceexports"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Multicluster().V1alpha1().ResourceExports().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("resourceexportfilters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Multicluster().V1alpha1().ResourceExportFilters().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("resourceimports"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Multicluster().V1alpha1().ResourceImports().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("resourceimportfilters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Multicluster().V1alpha1().ResourceImportFilters().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/multicluster/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/multicluster/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 00000000000..60b16b2702d --- /dev/null +++ b/multicluster/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,39 @@ +/* +Copyright 2021 Antrea 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 informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + versioned "antrea.io/antrea/multicluster/pkg/client/clientset/versioned" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" +) + +// NewInformerFunc takes versioned.Interface and time.Duration to return a 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 { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +// TweakListOptionsFunc is a function that transforms a v1.ListOptions. +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/multicluster/pkg/client/informers/externalversions/multicluster/interface.go b/multicluster/pkg/client/informers/externalversions/multicluster/interface.go new file mode 100644 index 00000000000..58b723c24b9 --- /dev/null +++ b/multicluster/pkg/client/informers/externalversions/multicluster/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 2021 Antrea 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 informer-gen. DO NOT EDIT. + +package multicluster + +import ( + internalinterfaces "antrea.io/antrea/multicluster/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "antrea.io/antrea/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/clusterclaim.go b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/clusterclaim.go new file mode 100644 index 00000000000..220a10605ed --- /dev/null +++ b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/clusterclaim.go @@ -0,0 +1,89 @@ +/* +Copyright 2021 Antrea 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + multiclusterv1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + versioned "antrea.io/antrea/multicluster/pkg/client/clientset/versioned" + internalinterfaces "antrea.io/antrea/multicluster/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "antrea.io/antrea/multicluster/pkg/client/listers/multicluster/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" +) + +// ClusterClaimInformer provides access to a shared informer and lister for +// ClusterClaims. +type ClusterClaimInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ClusterClaimLister +} + +type clusterClaimInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewClusterClaimInformer constructs a new informer for ClusterClaim 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 NewClusterClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterClaimInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterClaimInformer constructs a new informer for ClusterClaim 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 NewFilteredClusterClaimInformer(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) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MulticlusterV1alpha1().ClusterClaims(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MulticlusterV1alpha1().ClusterClaims(namespace).Watch(context.TODO(), options) + }, + }, + &multiclusterv1alpha1.ClusterClaim{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterClaimInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterClaimInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&multiclusterv1alpha1.ClusterClaim{}, f.defaultInformer) +} + +func (f *clusterClaimInformer) Lister() v1alpha1.ClusterClaimLister { + return v1alpha1.NewClusterClaimLister(f.Informer().GetIndexer()) +} diff --git a/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/clusterset.go b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/clusterset.go new file mode 100644 index 00000000000..14ba743b045 --- /dev/null +++ b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/clusterset.go @@ -0,0 +1,89 @@ +/* +Copyright 2021 Antrea 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + multiclusterv1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + versioned "antrea.io/antrea/multicluster/pkg/client/clientset/versioned" + internalinterfaces "antrea.io/antrea/multicluster/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "antrea.io/antrea/multicluster/pkg/client/listers/multicluster/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" +) + +// ClusterSetInformer provides access to a shared informer and lister for +// ClusterSets. +type ClusterSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ClusterSetLister +} + +type clusterSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewClusterSetInformer constructs a new informer for ClusterSet 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 NewClusterSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterSetInformer constructs a new informer for ClusterSet 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 NewFilteredClusterSetInformer(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) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MulticlusterV1alpha1().ClusterSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MulticlusterV1alpha1().ClusterSets(namespace).Watch(context.TODO(), options) + }, + }, + &multiclusterv1alpha1.ClusterSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&multiclusterv1alpha1.ClusterSet{}, f.defaultInformer) +} + +func (f *clusterSetInformer) Lister() v1alpha1.ClusterSetLister { + return v1alpha1.NewClusterSetLister(f.Informer().GetIndexer()) +} diff --git a/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/interface.go b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/interface.go new file mode 100644 index 00000000000..ff4c3100c97 --- /dev/null +++ b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/interface.go @@ -0,0 +1,86 @@ +/* +Copyright 2021 Antrea 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "antrea.io/antrea/multicluster/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ClusterClaims returns a ClusterClaimInformer. + ClusterClaims() ClusterClaimInformer + // ClusterSets returns a ClusterSetInformer. + ClusterSets() ClusterSetInformer + // MemberClusterAnnounces returns a MemberClusterAnnounceInformer. + MemberClusterAnnounces() MemberClusterAnnounceInformer + // ResourceExports returns a ResourceExportInformer. + ResourceExports() ResourceExportInformer + // ResourceExportFilters returns a ResourceExportFilterInformer. + ResourceExportFilters() ResourceExportFilterInformer + // ResourceImports returns a ResourceImportInformer. + ResourceImports() ResourceImportInformer + // ResourceImportFilters returns a ResourceImportFilterInformer. + ResourceImportFilters() ResourceImportFilterInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ClusterClaims returns a ClusterClaimInformer. +func (v *version) ClusterClaims() ClusterClaimInformer { + return &clusterClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ClusterSets returns a ClusterSetInformer. +func (v *version) ClusterSets() ClusterSetInformer { + return &clusterSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// MemberClusterAnnounces returns a MemberClusterAnnounceInformer. +func (v *version) MemberClusterAnnounces() MemberClusterAnnounceInformer { + return &memberClusterAnnounceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ResourceExports returns a ResourceExportInformer. +func (v *version) ResourceExports() ResourceExportInformer { + return &resourceExportInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ResourceExportFilters returns a ResourceExportFilterInformer. +func (v *version) ResourceExportFilters() ResourceExportFilterInformer { + return &resourceExportFilterInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ResourceImports returns a ResourceImportInformer. +func (v *version) ResourceImports() ResourceImportInformer { + return &resourceImportInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ResourceImportFilters returns a ResourceImportFilterInformer. +func (v *version) ResourceImportFilters() ResourceImportFilterInformer { + return &resourceImportFilterInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/memberclusterannounce.go b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/memberclusterannounce.go new file mode 100644 index 00000000000..12abd4dd561 --- /dev/null +++ b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/memberclusterannounce.go @@ -0,0 +1,89 @@ +/* +Copyright 2021 Antrea 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + multiclusterv1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + versioned "antrea.io/antrea/multicluster/pkg/client/clientset/versioned" + internalinterfaces "antrea.io/antrea/multicluster/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "antrea.io/antrea/multicluster/pkg/client/listers/multicluster/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" +) + +// MemberClusterAnnounceInformer provides access to a shared informer and lister for +// MemberClusterAnnounces. +type MemberClusterAnnounceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.MemberClusterAnnounceLister +} + +type memberClusterAnnounceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewMemberClusterAnnounceInformer constructs a new informer for MemberClusterAnnounce 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 NewMemberClusterAnnounceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMemberClusterAnnounceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredMemberClusterAnnounceInformer constructs a new informer for MemberClusterAnnounce 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 NewFilteredMemberClusterAnnounceInformer(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) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MulticlusterV1alpha1().MemberClusterAnnounces(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MulticlusterV1alpha1().MemberClusterAnnounces(namespace).Watch(context.TODO(), options) + }, + }, + &multiclusterv1alpha1.MemberClusterAnnounce{}, + resyncPeriod, + indexers, + ) +} + +func (f *memberClusterAnnounceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMemberClusterAnnounceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *memberClusterAnnounceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&multiclusterv1alpha1.MemberClusterAnnounce{}, f.defaultInformer) +} + +func (f *memberClusterAnnounceInformer) Lister() v1alpha1.MemberClusterAnnounceLister { + return v1alpha1.NewMemberClusterAnnounceLister(f.Informer().GetIndexer()) +} diff --git a/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/resourceexport.go b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/resourceexport.go new file mode 100644 index 00000000000..163b762e981 --- /dev/null +++ b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/resourceexport.go @@ -0,0 +1,89 @@ +/* +Copyright 2021 Antrea 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + multiclusterv1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + versioned "antrea.io/antrea/multicluster/pkg/client/clientset/versioned" + internalinterfaces "antrea.io/antrea/multicluster/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "antrea.io/antrea/multicluster/pkg/client/listers/multicluster/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" +) + +// ResourceExportInformer provides access to a shared informer and lister for +// ResourceExports. +type ResourceExportInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ResourceExportLister +} + +type resourceExportInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewResourceExportInformer constructs a new informer for ResourceExport 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 NewResourceExportInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredResourceExportInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredResourceExportInformer constructs a new informer for ResourceExport 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 NewFilteredResourceExportInformer(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) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MulticlusterV1alpha1().ResourceExports(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MulticlusterV1alpha1().ResourceExports(namespace).Watch(context.TODO(), options) + }, + }, + &multiclusterv1alpha1.ResourceExport{}, + resyncPeriod, + indexers, + ) +} + +func (f *resourceExportInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredResourceExportInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *resourceExportInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&multiclusterv1alpha1.ResourceExport{}, f.defaultInformer) +} + +func (f *resourceExportInformer) Lister() v1alpha1.ResourceExportLister { + return v1alpha1.NewResourceExportLister(f.Informer().GetIndexer()) +} diff --git a/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/resourceexportfilter.go b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/resourceexportfilter.go new file mode 100644 index 00000000000..43976c9a1a9 --- /dev/null +++ b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/resourceexportfilter.go @@ -0,0 +1,89 @@ +/* +Copyright 2021 Antrea 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + multiclusterv1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + versioned "antrea.io/antrea/multicluster/pkg/client/clientset/versioned" + internalinterfaces "antrea.io/antrea/multicluster/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "antrea.io/antrea/multicluster/pkg/client/listers/multicluster/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" +) + +// ResourceExportFilterInformer provides access to a shared informer and lister for +// ResourceExportFilters. +type ResourceExportFilterInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ResourceExportFilterLister +} + +type resourceExportFilterInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewResourceExportFilterInformer constructs a new informer for ResourceExportFilter 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 NewResourceExportFilterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredResourceExportFilterInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredResourceExportFilterInformer constructs a new informer for ResourceExportFilter 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 NewFilteredResourceExportFilterInformer(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) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MulticlusterV1alpha1().ResourceExportFilters(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MulticlusterV1alpha1().ResourceExportFilters(namespace).Watch(context.TODO(), options) + }, + }, + &multiclusterv1alpha1.ResourceExportFilter{}, + resyncPeriod, + indexers, + ) +} + +func (f *resourceExportFilterInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredResourceExportFilterInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *resourceExportFilterInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&multiclusterv1alpha1.ResourceExportFilter{}, f.defaultInformer) +} + +func (f *resourceExportFilterInformer) Lister() v1alpha1.ResourceExportFilterLister { + return v1alpha1.NewResourceExportFilterLister(f.Informer().GetIndexer()) +} diff --git a/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/resourceimport.go b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/resourceimport.go new file mode 100644 index 00000000000..357584eb62b --- /dev/null +++ b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/resourceimport.go @@ -0,0 +1,89 @@ +/* +Copyright 2021 Antrea 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + multiclusterv1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + versioned "antrea.io/antrea/multicluster/pkg/client/clientset/versioned" + internalinterfaces "antrea.io/antrea/multicluster/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "antrea.io/antrea/multicluster/pkg/client/listers/multicluster/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" +) + +// ResourceImportInformer provides access to a shared informer and lister for +// ResourceImports. +type ResourceImportInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ResourceImportLister +} + +type resourceImportInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewResourceImportInformer constructs a new informer for ResourceImport 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 NewResourceImportInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredResourceImportInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredResourceImportInformer constructs a new informer for ResourceImport 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 NewFilteredResourceImportInformer(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) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MulticlusterV1alpha1().ResourceImports(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MulticlusterV1alpha1().ResourceImports(namespace).Watch(context.TODO(), options) + }, + }, + &multiclusterv1alpha1.ResourceImport{}, + resyncPeriod, + indexers, + ) +} + +func (f *resourceImportInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredResourceImportInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *resourceImportInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&multiclusterv1alpha1.ResourceImport{}, f.defaultInformer) +} + +func (f *resourceImportInformer) Lister() v1alpha1.ResourceImportLister { + return v1alpha1.NewResourceImportLister(f.Informer().GetIndexer()) +} diff --git a/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/resourceimportfilter.go b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/resourceimportfilter.go new file mode 100644 index 00000000000..dc9082a1401 --- /dev/null +++ b/multicluster/pkg/client/informers/externalversions/multicluster/v1alpha1/resourceimportfilter.go @@ -0,0 +1,89 @@ +/* +Copyright 2021 Antrea 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + multiclusterv1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + versioned "antrea.io/antrea/multicluster/pkg/client/clientset/versioned" + internalinterfaces "antrea.io/antrea/multicluster/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "antrea.io/antrea/multicluster/pkg/client/listers/multicluster/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" +) + +// ResourceImportFilterInformer provides access to a shared informer and lister for +// ResourceImportFilters. +type ResourceImportFilterInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ResourceImportFilterLister +} + +type resourceImportFilterInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewResourceImportFilterInformer constructs a new informer for ResourceImportFilter 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 NewResourceImportFilterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredResourceImportFilterInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredResourceImportFilterInformer constructs a new informer for ResourceImportFilter 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 NewFilteredResourceImportFilterInformer(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) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MulticlusterV1alpha1().ResourceImportFilters(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MulticlusterV1alpha1().ResourceImportFilters(namespace).Watch(context.TODO(), options) + }, + }, + &multiclusterv1alpha1.ResourceImportFilter{}, + resyncPeriod, + indexers, + ) +} + +func (f *resourceImportFilterInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredResourceImportFilterInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *resourceImportFilterInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&multiclusterv1alpha1.ResourceImportFilter{}, f.defaultInformer) +} + +func (f *resourceImportFilterInformer) Lister() v1alpha1.ResourceImportFilterLister { + return v1alpha1.NewResourceImportFilterLister(f.Informer().GetIndexer()) +} diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha1/clusterclaim.go b/multicluster/pkg/client/listers/multicluster/v1alpha1/clusterclaim.go new file mode 100644 index 00000000000..e69fa004365 --- /dev/null +++ b/multicluster/pkg/client/listers/multicluster/v1alpha1/clusterclaim.go @@ -0,0 +1,98 @@ +/* +Copyright 2021 Antrea 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterClaimLister helps list ClusterClaims. +// All objects returned here must be treated as read-only. +type ClusterClaimLister interface { + // List lists all ClusterClaims in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ClusterClaim, err error) + // ClusterClaims returns an object that can list and get ClusterClaims. + ClusterClaims(namespace string) ClusterClaimNamespaceLister + ClusterClaimListerExpansion +} + +// clusterClaimLister implements the ClusterClaimLister interface. +type clusterClaimLister struct { + indexer cache.Indexer +} + +// NewClusterClaimLister returns a new ClusterClaimLister. +func NewClusterClaimLister(indexer cache.Indexer) ClusterClaimLister { + return &clusterClaimLister{indexer: indexer} +} + +// List lists all ClusterClaims in the indexer. +func (s *clusterClaimLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterClaim, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ClusterClaim)) + }) + return ret, err +} + +// ClusterClaims returns an object that can list and get ClusterClaims. +func (s *clusterClaimLister) ClusterClaims(namespace string) ClusterClaimNamespaceLister { + return clusterClaimNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ClusterClaimNamespaceLister helps list and get ClusterClaims. +// All objects returned here must be treated as read-only. +type ClusterClaimNamespaceLister interface { + // List lists all ClusterClaims in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ClusterClaim, err error) + // Get retrieves the ClusterClaim from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.ClusterClaim, error) + ClusterClaimNamespaceListerExpansion +} + +// clusterClaimNamespaceLister implements the ClusterClaimNamespaceLister +// interface. +type clusterClaimNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ClusterClaims in the indexer for a given namespace. +func (s clusterClaimNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterClaim, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ClusterClaim)) + }) + return ret, err +} + +// Get retrieves the ClusterClaim from the indexer for a given namespace and name. +func (s clusterClaimNamespaceLister) Get(name string) (*v1alpha1.ClusterClaim, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("clusterclaim"), name) + } + return obj.(*v1alpha1.ClusterClaim), nil +} diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha1/clusterset.go b/multicluster/pkg/client/listers/multicluster/v1alpha1/clusterset.go new file mode 100644 index 00000000000..2d414335fce --- /dev/null +++ b/multicluster/pkg/client/listers/multicluster/v1alpha1/clusterset.go @@ -0,0 +1,98 @@ +/* +Copyright 2021 Antrea 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterSetLister helps list ClusterSets. +// All objects returned here must be treated as read-only. +type ClusterSetLister interface { + // List lists all ClusterSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ClusterSet, err error) + // ClusterSets returns an object that can list and get ClusterSets. + ClusterSets(namespace string) ClusterSetNamespaceLister + ClusterSetListerExpansion +} + +// clusterSetLister implements the ClusterSetLister interface. +type clusterSetLister struct { + indexer cache.Indexer +} + +// NewClusterSetLister returns a new ClusterSetLister. +func NewClusterSetLister(indexer cache.Indexer) ClusterSetLister { + return &clusterSetLister{indexer: indexer} +} + +// List lists all ClusterSets in the indexer. +func (s *clusterSetLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ClusterSet)) + }) + return ret, err +} + +// ClusterSets returns an object that can list and get ClusterSets. +func (s *clusterSetLister) ClusterSets(namespace string) ClusterSetNamespaceLister { + return clusterSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ClusterSetNamespaceLister helps list and get ClusterSets. +// All objects returned here must be treated as read-only. +type ClusterSetNamespaceLister interface { + // List lists all ClusterSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ClusterSet, err error) + // Get retrieves the ClusterSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.ClusterSet, error) + ClusterSetNamespaceListerExpansion +} + +// clusterSetNamespaceLister implements the ClusterSetNamespaceLister +// interface. +type clusterSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ClusterSets in the indexer for a given namespace. +func (s clusterSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ClusterSet)) + }) + return ret, err +} + +// Get retrieves the ClusterSet from the indexer for a given namespace and name. +func (s clusterSetNamespaceLister) Get(name string) (*v1alpha1.ClusterSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("clusterset"), name) + } + return obj.(*v1alpha1.ClusterSet), nil +} diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha1/expansion_generated.go b/multicluster/pkg/client/listers/multicluster/v1alpha1/expansion_generated.go new file mode 100644 index 00000000000..80cd468ef4e --- /dev/null +++ b/multicluster/pkg/client/listers/multicluster/v1alpha1/expansion_generated.go @@ -0,0 +1,74 @@ +/* +Copyright 2021 Antrea 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +// ClusterClaimListerExpansion allows custom methods to be added to +// ClusterClaimLister. +type ClusterClaimListerExpansion interface{} + +// ClusterClaimNamespaceListerExpansion allows custom methods to be added to +// ClusterClaimNamespaceLister. +type ClusterClaimNamespaceListerExpansion interface{} + +// ClusterSetListerExpansion allows custom methods to be added to +// ClusterSetLister. +type ClusterSetListerExpansion interface{} + +// ClusterSetNamespaceListerExpansion allows custom methods to be added to +// ClusterSetNamespaceLister. +type ClusterSetNamespaceListerExpansion interface{} + +// MemberClusterAnnounceListerExpansion allows custom methods to be added to +// MemberClusterAnnounceLister. +type MemberClusterAnnounceListerExpansion interface{} + +// MemberClusterAnnounceNamespaceListerExpansion allows custom methods to be added to +// MemberClusterAnnounceNamespaceLister. +type MemberClusterAnnounceNamespaceListerExpansion interface{} + +// ResourceExportListerExpansion allows custom methods to be added to +// ResourceExportLister. +type ResourceExportListerExpansion interface{} + +// ResourceExportNamespaceListerExpansion allows custom methods to be added to +// ResourceExportNamespaceLister. +type ResourceExportNamespaceListerExpansion interface{} + +// ResourceExportFilterListerExpansion allows custom methods to be added to +// ResourceExportFilterLister. +type ResourceExportFilterListerExpansion interface{} + +// ResourceExportFilterNamespaceListerExpansion allows custom methods to be added to +// ResourceExportFilterNamespaceLister. +type ResourceExportFilterNamespaceListerExpansion interface{} + +// ResourceImportListerExpansion allows custom methods to be added to +// ResourceImportLister. +type ResourceImportListerExpansion interface{} + +// ResourceImportNamespaceListerExpansion allows custom methods to be added to +// ResourceImportNamespaceLister. +type ResourceImportNamespaceListerExpansion interface{} + +// ResourceImportFilterListerExpansion allows custom methods to be added to +// ResourceImportFilterLister. +type ResourceImportFilterListerExpansion interface{} + +// ResourceImportFilterNamespaceListerExpansion allows custom methods to be added to +// ResourceImportFilterNamespaceLister. +type ResourceImportFilterNamespaceListerExpansion interface{} diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha1/memberclusterannounce.go b/multicluster/pkg/client/listers/multicluster/v1alpha1/memberclusterannounce.go new file mode 100644 index 00000000000..a5acf118cec --- /dev/null +++ b/multicluster/pkg/client/listers/multicluster/v1alpha1/memberclusterannounce.go @@ -0,0 +1,98 @@ +/* +Copyright 2021 Antrea 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MemberClusterAnnounceLister helps list MemberClusterAnnounces. +// All objects returned here must be treated as read-only. +type MemberClusterAnnounceLister interface { + // List lists all MemberClusterAnnounces in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.MemberClusterAnnounce, err error) + // MemberClusterAnnounces returns an object that can list and get MemberClusterAnnounces. + MemberClusterAnnounces(namespace string) MemberClusterAnnounceNamespaceLister + MemberClusterAnnounceListerExpansion +} + +// memberClusterAnnounceLister implements the MemberClusterAnnounceLister interface. +type memberClusterAnnounceLister struct { + indexer cache.Indexer +} + +// NewMemberClusterAnnounceLister returns a new MemberClusterAnnounceLister. +func NewMemberClusterAnnounceLister(indexer cache.Indexer) MemberClusterAnnounceLister { + return &memberClusterAnnounceLister{indexer: indexer} +} + +// List lists all MemberClusterAnnounces in the indexer. +func (s *memberClusterAnnounceLister) List(selector labels.Selector) (ret []*v1alpha1.MemberClusterAnnounce, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.MemberClusterAnnounce)) + }) + return ret, err +} + +// MemberClusterAnnounces returns an object that can list and get MemberClusterAnnounces. +func (s *memberClusterAnnounceLister) MemberClusterAnnounces(namespace string) MemberClusterAnnounceNamespaceLister { + return memberClusterAnnounceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// MemberClusterAnnounceNamespaceLister helps list and get MemberClusterAnnounces. +// All objects returned here must be treated as read-only. +type MemberClusterAnnounceNamespaceLister interface { + // List lists all MemberClusterAnnounces in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.MemberClusterAnnounce, err error) + // Get retrieves the MemberClusterAnnounce from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.MemberClusterAnnounce, error) + MemberClusterAnnounceNamespaceListerExpansion +} + +// memberClusterAnnounceNamespaceLister implements the MemberClusterAnnounceNamespaceLister +// interface. +type memberClusterAnnounceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all MemberClusterAnnounces in the indexer for a given namespace. +func (s memberClusterAnnounceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.MemberClusterAnnounce, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.MemberClusterAnnounce)) + }) + return ret, err +} + +// Get retrieves the MemberClusterAnnounce from the indexer for a given namespace and name. +func (s memberClusterAnnounceNamespaceLister) Get(name string) (*v1alpha1.MemberClusterAnnounce, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("memberclusterannounce"), name) + } + return obj.(*v1alpha1.MemberClusterAnnounce), nil +} diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceexport.go b/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceexport.go new file mode 100644 index 00000000000..5b1c20c29f4 --- /dev/null +++ b/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceexport.go @@ -0,0 +1,98 @@ +/* +Copyright 2021 Antrea 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ResourceExportLister helps list ResourceExports. +// All objects returned here must be treated as read-only. +type ResourceExportLister interface { + // List lists all ResourceExports in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ResourceExport, err error) + // ResourceExports returns an object that can list and get ResourceExports. + ResourceExports(namespace string) ResourceExportNamespaceLister + ResourceExportListerExpansion +} + +// resourceExportLister implements the ResourceExportLister interface. +type resourceExportLister struct { + indexer cache.Indexer +} + +// NewResourceExportLister returns a new ResourceExportLister. +func NewResourceExportLister(indexer cache.Indexer) ResourceExportLister { + return &resourceExportLister{indexer: indexer} +} + +// List lists all ResourceExports in the indexer. +func (s *resourceExportLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceExport, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ResourceExport)) + }) + return ret, err +} + +// ResourceExports returns an object that can list and get ResourceExports. +func (s *resourceExportLister) ResourceExports(namespace string) ResourceExportNamespaceLister { + return resourceExportNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ResourceExportNamespaceLister helps list and get ResourceExports. +// All objects returned here must be treated as read-only. +type ResourceExportNamespaceLister interface { + // List lists all ResourceExports in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ResourceExport, err error) + // Get retrieves the ResourceExport from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.ResourceExport, error) + ResourceExportNamespaceListerExpansion +} + +// resourceExportNamespaceLister implements the ResourceExportNamespaceLister +// interface. +type resourceExportNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ResourceExports in the indexer for a given namespace. +func (s resourceExportNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceExport, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ResourceExport)) + }) + return ret, err +} + +// Get retrieves the ResourceExport from the indexer for a given namespace and name. +func (s resourceExportNamespaceLister) Get(name string) (*v1alpha1.ResourceExport, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("resourceexport"), name) + } + return obj.(*v1alpha1.ResourceExport), nil +} diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceexportfilter.go b/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceexportfilter.go new file mode 100644 index 00000000000..e65bf197f5e --- /dev/null +++ b/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceexportfilter.go @@ -0,0 +1,98 @@ +/* +Copyright 2021 Antrea 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ResourceExportFilterLister helps list ResourceExportFilters. +// All objects returned here must be treated as read-only. +type ResourceExportFilterLister interface { + // List lists all ResourceExportFilters in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ResourceExportFilter, err error) + // ResourceExportFilters returns an object that can list and get ResourceExportFilters. + ResourceExportFilters(namespace string) ResourceExportFilterNamespaceLister + ResourceExportFilterListerExpansion +} + +// resourceExportFilterLister implements the ResourceExportFilterLister interface. +type resourceExportFilterLister struct { + indexer cache.Indexer +} + +// NewResourceExportFilterLister returns a new ResourceExportFilterLister. +func NewResourceExportFilterLister(indexer cache.Indexer) ResourceExportFilterLister { + return &resourceExportFilterLister{indexer: indexer} +} + +// List lists all ResourceExportFilters in the indexer. +func (s *resourceExportFilterLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceExportFilter, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ResourceExportFilter)) + }) + return ret, err +} + +// ResourceExportFilters returns an object that can list and get ResourceExportFilters. +func (s *resourceExportFilterLister) ResourceExportFilters(namespace string) ResourceExportFilterNamespaceLister { + return resourceExportFilterNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ResourceExportFilterNamespaceLister helps list and get ResourceExportFilters. +// All objects returned here must be treated as read-only. +type ResourceExportFilterNamespaceLister interface { + // List lists all ResourceExportFilters in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ResourceExportFilter, err error) + // Get retrieves the ResourceExportFilter from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.ResourceExportFilter, error) + ResourceExportFilterNamespaceListerExpansion +} + +// resourceExportFilterNamespaceLister implements the ResourceExportFilterNamespaceLister +// interface. +type resourceExportFilterNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ResourceExportFilters in the indexer for a given namespace. +func (s resourceExportFilterNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceExportFilter, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ResourceExportFilter)) + }) + return ret, err +} + +// Get retrieves the ResourceExportFilter from the indexer for a given namespace and name. +func (s resourceExportFilterNamespaceLister) Get(name string) (*v1alpha1.ResourceExportFilter, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("resourceexportfilter"), name) + } + return obj.(*v1alpha1.ResourceExportFilter), nil +} diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceimport.go b/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceimport.go new file mode 100644 index 00000000000..9e5fd8c51eb --- /dev/null +++ b/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceimport.go @@ -0,0 +1,98 @@ +/* +Copyright 2021 Antrea 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ResourceImportLister helps list ResourceImports. +// All objects returned here must be treated as read-only. +type ResourceImportLister interface { + // List lists all ResourceImports in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ResourceImport, err error) + // ResourceImports returns an object that can list and get ResourceImports. + ResourceImports(namespace string) ResourceImportNamespaceLister + ResourceImportListerExpansion +} + +// resourceImportLister implements the ResourceImportLister interface. +type resourceImportLister struct { + indexer cache.Indexer +} + +// NewResourceImportLister returns a new ResourceImportLister. +func NewResourceImportLister(indexer cache.Indexer) ResourceImportLister { + return &resourceImportLister{indexer: indexer} +} + +// List lists all ResourceImports in the indexer. +func (s *resourceImportLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceImport, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ResourceImport)) + }) + return ret, err +} + +// ResourceImports returns an object that can list and get ResourceImports. +func (s *resourceImportLister) ResourceImports(namespace string) ResourceImportNamespaceLister { + return resourceImportNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ResourceImportNamespaceLister helps list and get ResourceImports. +// All objects returned here must be treated as read-only. +type ResourceImportNamespaceLister interface { + // List lists all ResourceImports in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ResourceImport, err error) + // Get retrieves the ResourceImport from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.ResourceImport, error) + ResourceImportNamespaceListerExpansion +} + +// resourceImportNamespaceLister implements the ResourceImportNamespaceLister +// interface. +type resourceImportNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ResourceImports in the indexer for a given namespace. +func (s resourceImportNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceImport, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ResourceImport)) + }) + return ret, err +} + +// Get retrieves the ResourceImport from the indexer for a given namespace and name. +func (s resourceImportNamespaceLister) Get(name string) (*v1alpha1.ResourceImport, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("resourceimport"), name) + } + return obj.(*v1alpha1.ResourceImport), nil +} diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceimportfilter.go b/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceimportfilter.go new file mode 100644 index 00000000000..74b5046b72e --- /dev/null +++ b/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceimportfilter.go @@ -0,0 +1,98 @@ +/* +Copyright 2021 Antrea 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ResourceImportFilterLister helps list ResourceImportFilters. +// All objects returned here must be treated as read-only. +type ResourceImportFilterLister interface { + // List lists all ResourceImportFilters in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ResourceImportFilter, err error) + // ResourceImportFilters returns an object that can list and get ResourceImportFilters. + ResourceImportFilters(namespace string) ResourceImportFilterNamespaceLister + ResourceImportFilterListerExpansion +} + +// resourceImportFilterLister implements the ResourceImportFilterLister interface. +type resourceImportFilterLister struct { + indexer cache.Indexer +} + +// NewResourceImportFilterLister returns a new ResourceImportFilterLister. +func NewResourceImportFilterLister(indexer cache.Indexer) ResourceImportFilterLister { + return &resourceImportFilterLister{indexer: indexer} +} + +// List lists all ResourceImportFilters in the indexer. +func (s *resourceImportFilterLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceImportFilter, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ResourceImportFilter)) + }) + return ret, err +} + +// ResourceImportFilters returns an object that can list and get ResourceImportFilters. +func (s *resourceImportFilterLister) ResourceImportFilters(namespace string) ResourceImportFilterNamespaceLister { + return resourceImportFilterNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ResourceImportFilterNamespaceLister helps list and get ResourceImportFilters. +// All objects returned here must be treated as read-only. +type ResourceImportFilterNamespaceLister interface { + // List lists all ResourceImportFilters in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ResourceImportFilter, err error) + // Get retrieves the ResourceImportFilter from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.ResourceImportFilter, error) + ResourceImportFilterNamespaceListerExpansion +} + +// resourceImportFilterNamespaceLister implements the ResourceImportFilterNamespaceLister +// interface. +type resourceImportFilterNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ResourceImportFilters in the indexer for a given namespace. +func (s resourceImportFilterNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceImportFilter, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ResourceImportFilter)) + }) + return ret, err +} + +// Get retrieves the ResourceImportFilter from the indexer for a given namespace and name. +func (s resourceImportFilterNamespaceLister) Get(name string) (*v1alpha1.ResourceImportFilter, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("resourceimportfilter"), name) + } + return obj.(*v1alpha1.ResourceImportFilter), nil +}