diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 2094bd43a0a..5198e221d3c 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -20,6 +20,9 @@ jobs: restore-keys: | ${{ runner.os }}-go- + - name: Verify Generated clientset is up to date + run: make verify-clientset + - name: Test run: make test diff --git a/Makefile b/Makefile index 0f6808a7c6c..f7282bf6d10 100644 --- a/Makefile +++ b/Makefile @@ -126,3 +126,16 @@ pkg/scalers/liiklus/LiiklusService.pb.go: hack/LiiklusService.proto pkg/scalers/liiklus/mocks/mock_liiklus.go: pkg/scalers/liiklus/LiiklusService.pb.go mockgen github.com/kedacore/keda/pkg/scalers/liiklus LiiklusServiceClient > pkg/scalers/liiklus/mocks/mock_liiklus.go + +################################################## +# Clientset # +################################################## +.PHONY: verify-clientset +verify-clientset: + $(GO_BUILD_VARS) go mod vendor + ./hack/verify-codegen.sh + +.PHONY: generate-clientset +generate-clientset: + $(GO_BUILD_VARS) go mod vendor + ./hack/update-codegen.sh \ No newline at end of file diff --git a/go.mod b/go.mod index a99efd13b27..370751999f5 100644 --- a/go.mod +++ b/go.mod @@ -41,6 +41,7 @@ require ( k8s.io/api v0.17.4 k8s.io/apimachinery v0.17.4 k8s.io/client-go v12.0.0+incompatible + k8s.io/code-generator v0.17.4 k8s.io/klog v1.0.0 k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a k8s.io/metrics v0.17.4 diff --git a/go.sum b/go.sum index a2e4189f961..d5824b52c6d 100644 --- a/go.sum +++ b/go.sum @@ -995,6 +995,7 @@ golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136 h1:A1gGSx58LAGVHUUsOf7IiR0u8Xb6W51gRwfDBhkdcaw= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -1162,8 +1163,10 @@ gomodules.xyz/jsonpatch/v2 v2.0.1 h1:xyiBuvkD2g5n7cYzx6u2sxQvsAy4QJsZFCzGVdzOXZ0 gomodules.xyz/jsonpatch/v2 v2.0.1/go.mod h1:IhYNNY4jnS53ZnfE4PAmpKtDpTCj1JFXc+3mwe7XcUU= gomodules.xyz/jsonpatch/v3 v3.0.1/go.mod h1:CBhndykehEwTOlEfnsfJwvkFQbSN8YZFr9M+cIHAJto= gomodules.xyz/orderedmap v0.1.0/go.mod h1:g9/TPUCm1t2gwD3j3zfV8uylyYhVdCNSi+xCEIu7yTU= +gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485 h1:OB/uP/Puiu5vS5QMRPrXCDWUPb+kt8f1KW8oQzFejQw= gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e h1:jRyg0XfpwWlhEV8mDfdNGBeSJM2fuyh9Yjrnd8kF2Ts= gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmKJ7gzohV1XkqsFehRA2FbsbkopSuQ= google.golang.org/api v0.10.0 h1:7tmAxx3oKE98VMZ+SBZzvYYWRQ9HODBxmC8mXUsraSQ= google.golang.org/api v0.10.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -1280,6 +1283,7 @@ k8s.io/code-generator v0.17.0/go.mod h1:DVmfPQgxQENqDIzVR2ddLXMH34qeszkKSdH/N+s+ k8s.io/code-generator v0.17.1/go.mod h1:DVmfPQgxQENqDIzVR2ddLXMH34qeszkKSdH/N+s+38s= k8s.io/code-generator v0.17.2/go.mod h1:DVmfPQgxQENqDIzVR2ddLXMH34qeszkKSdH/N+s+38s= k8s.io/code-generator v0.17.3/go.mod h1:l8BLVwASXQZTo2xamW5mQNFCe1XPiAesVq7Y1t7PiQQ= +k8s.io/code-generator v0.17.4 h1:C3uu/IvQclEIO4ouUOXuoKWfc4765mYe0uebStg9CaY= k8s.io/code-generator v0.17.4/go.mod h1:l8BLVwASXQZTo2xamW5mQNFCe1XPiAesVq7Y1t7PiQQ= k8s.io/component-base v0.0.0-20190918160511-547f6c5d7090/go.mod h1:933PBGtQFJky3TEwYx4aEPZ4IxqhWh3R6DCmzqIn1hA= k8s.io/component-base v0.16.7/go.mod h1:ikdyfezOFMu5O0qJjy/Y9eXwj+fV3pVwdmt0ulVcIR0= @@ -1290,6 +1294,7 @@ k8s.io/component-base v0.17.4 h1:H9cdWZyiGVJfWmWIcHd66IsNBWTk1iEgU7D4kJksEnw= k8s.io/component-base v0.17.4/go.mod h1:5BRqHMbbQPm2kKu35v3G+CpVq4K0RJKC7TRioF0I9lE= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20191010091904-7fa3014cb28f h1:eW/6wVuHNZgQJmFesyAxu0cvj0WAHHUuGaLbPcmNY3Q= k8s.io/gengo v0.0.0-20191010091904-7fa3014cb28f/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/helm v2.16.3+incompatible/go.mod h1:LZzlS4LQBHfciFOurYBFkCMTaZ0D1l+p0teMg7TSULI= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= diff --git a/hack/boilerplate.go.txt b/hack/boilerplate.go.txt new file mode 100644 index 00000000000..22a8df315b1 --- /dev/null +++ b/hack/boilerplate.go.txt @@ -0,0 +1,15 @@ +/* +Copyright 2020 The KEDA 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. +*/ \ No newline at end of file diff --git a/hack/tools.go b/hack/tools.go new file mode 100644 index 00000000000..7a21725cf10 --- /dev/null +++ b/hack/tools.go @@ -0,0 +1,6 @@ +// +build tools + +// This package imports things required by build scripts, to force `go mod` to see them as dependencies +package tools + +import _ "k8s.io/code-generator" diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh new file mode 100755 index 00000000000..82a531cdcac --- /dev/null +++ b/hack/update-codegen.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. +CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)} + +# generate the code with: +# --output-base because this script should also be able to run inside the vendor dir of +# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir +# instead of the $GOPATH directly. For normal projects this can be dropped. +# bash "${CODEGEN_PKG}"/generate-groups.sh "deepcopy,client,informer,lister" \ +# Deepcopy is generated by operator-sdk +bash "${CODEGEN_PKG}"/generate-groups.sh "client,informer,lister" \ + github.com/kedacore/keda/pkg/generated github.com/kedacore/keda/pkg/apis \ + keda:v1alpha1 \ + --go-header-file "${SCRIPT_ROOT}"/hack/boilerplate.go.txt + +# To use your own boilerplate text append: +# --go-header-file "${SCRIPT_ROOT}"/hack/custom-boilerplate.go.txt diff --git a/hack/verify-codegen.sh b/hack/verify-codegen.sh new file mode 100755 index 00000000000..b347be7ae7f --- /dev/null +++ b/hack/verify-codegen.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. + +DIFFROOT="${SCRIPT_ROOT}/pkg" +TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/pkg" +_tmp="${SCRIPT_ROOT}/_tmp" + +cleanup() { + rm -rf "${_tmp}" +} +trap "cleanup" EXIT SIGINT + +cleanup + +mkdir -p "${TMP_DIFFROOT}" +cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}" + +"${SCRIPT_ROOT}/hack/update-codegen.sh" +echo "diffing ${DIFFROOT} against freshly generated codegen" +ret=0 +diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$? +cp -a "${TMP_DIFFROOT}"/* "${DIFFROOT}" +if [[ $ret -eq 0 ]] +then + echo "${DIFFROOT} up to date." +else + echo "${DIFFROOT} is out of date. Please run make generate-clientset" + exit 1 +fi diff --git a/pkg/apis/keda/v1alpha1/register.go b/pkg/apis/keda/v1alpha1/register.go index aba835fd428..9f2d63accea 100644 --- a/pkg/apis/keda/v1alpha1/register.go +++ b/pkg/apis/keda/v1alpha1/register.go @@ -16,4 +16,20 @@ var ( // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} + + // added for generated clientset + // AddToScheme is a global function that registers this API group & version to a scheme + AddToScheme = SchemeBuilder.AddToScheme ) + +// added for generated clientset +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// added for generated clientset +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} \ No newline at end of file diff --git a/pkg/apis/keda/v1alpha1/scaledjob_types.go b/pkg/apis/keda/v1alpha1/scaledjob_types.go index d89019a4d6b..6c35243e91a 100644 --- a/pkg/apis/keda/v1alpha1/scaledjob_types.go +++ b/pkg/apis/keda/v1alpha1/scaledjob_types.go @@ -5,7 +5,11 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -// ScaledJobSpec defines the desired state of ScaledJob + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ScaledJob is the Schema for the scaledjobs API // +k8s:openapi-gen=true // +kubebuilder:subresource:status // +kubebuilder:resource:path=scaledobjects,scope=Namespaced @@ -13,6 +17,16 @@ import ( // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status" // +kubebuilder:printcolumn:name="Active",type="string",JSONPath=".status.conditions[?(@.type==\"Active\")].status" // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +type ScaledJob struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ScaledJobSpec `json:"spec,omitempty"` + Status ScaledJobStatus `json:"status,omitempty"` +} + +// ScaledJobSpec defines the desired state of ScaledJob +// +k8s:openapi-gen=true type ScaledJobSpec struct { // TODO define the spec @@ -42,19 +56,6 @@ type ScaledJobStatus struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// ScaledJob is the Schema for the scaledjobs API -// +kubebuilder:subresource:status -// +kubebuilder:resource:path=scaledjobs,scope=Namespaced -type ScaledJob struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec ScaledJobSpec `json:"spec,omitempty"` - Status ScaledJobStatus `json:"status,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - // ScaledJobList contains a list of ScaledJob type ScaledJobList struct { metav1.TypeMeta `json:",inline"` diff --git a/pkg/apis/keda/v1alpha1/scaledobject_types.go b/pkg/apis/keda/v1alpha1/scaledobject_types.go index 81d020abe8f..7483413e2fd 100644 --- a/pkg/apis/keda/v1alpha1/scaledobject_types.go +++ b/pkg/apis/keda/v1alpha1/scaledobject_types.go @@ -4,6 +4,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +// +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ScaledObject is a specification for a ScaledObject resource diff --git a/pkg/apis/keda/v1alpha1/triggerauthentication_types.go b/pkg/apis/keda/v1alpha1/triggerauthentication_types.go index 83715fca531..79adf064c2c 100644 --- a/pkg/apis/keda/v1alpha1/triggerauthentication_types.go +++ b/pkg/apis/keda/v1alpha1/triggerauthentication_types.go @@ -20,6 +20,7 @@ type TriggerAuthenticationSpec struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // TriggerAuthentication defines how a trigger can authenticate +// +genclient // +k8s:openapi-gen=true // +kubebuilder:resource:path=triggerauthentications,scope=Namespaced type TriggerAuthentication struct { diff --git a/pkg/apis/keda/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/keda/v1alpha1/zz_generated.deepcopy.go index 6f036e805f5..093d5cabc33 100644 --- a/pkg/apis/keda/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/keda/v1alpha1/zz_generated.deepcopy.go @@ -1,5 +1,20 @@ // +build !ignore_autogenerated +/* +Copyright 2020 The KEDA 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 operator-sdk. DO NOT EDIT. package v1alpha1 diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go new file mode 100644 index 00000000000..a1c0788a889 --- /dev/null +++ b/pkg/generated/clientset/versioned/clientset.go @@ -0,0 +1,96 @@ +/* +Copyright 2020 The KEDA 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" + + kedav1alpha1 "github.com/kedacore/keda/pkg/generated/clientset/versioned/typed/keda/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 + KedaV1alpha1() kedav1alpha1.KedaV1alpha1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + kedaV1alpha1 *kedav1alpha1.KedaV1alpha1Client +} + +// KedaV1alpha1 retrieves the KedaV1alpha1Client +func (c *Clientset) KedaV1alpha1() kedav1alpha1.KedaV1alpha1Interface { + return c.kedaV1alpha1 +} + +// 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.kedaV1alpha1, err = kedav1alpha1.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.kedaV1alpha1 = kedav1alpha1.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.kedaV1alpha1 = kedav1alpha1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/pkg/generated/clientset/versioned/doc.go b/pkg/generated/clientset/versioned/doc.go new file mode 100644 index 00000000000..54893d3eed3 --- /dev/null +++ b/pkg/generated/clientset/versioned/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2020 The KEDA Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package versioned diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 00000000000..f56226cd03b --- /dev/null +++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,81 @@ +/* +Copyright 2020 The KEDA 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 "github.com/kedacore/keda/pkg/generated/clientset/versioned" + kedav1alpha1 "github.com/kedacore/keda/pkg/generated/clientset/versioned/typed/keda/v1alpha1" + fakekedav1alpha1 "github.com/kedacore/keda/pkg/generated/clientset/versioned/typed/keda/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{} + +// KedaV1alpha1 retrieves the KedaV1alpha1Client +func (c *Clientset) KedaV1alpha1() kedav1alpha1.KedaV1alpha1Interface { + return &fakekedav1alpha1.FakeKedaV1alpha1{Fake: &c.Fake} +} diff --git a/pkg/generated/clientset/versioned/fake/doc.go b/pkg/generated/clientset/versioned/fake/doc.go new file mode 100644 index 00000000000..ae870132280 --- /dev/null +++ b/pkg/generated/clientset/versioned/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2020 The KEDA 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/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go new file mode 100644 index 00000000000..63ee3f56c19 --- /dev/null +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -0,0 +1,55 @@ +/* +Copyright 2020 The KEDA 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 ( + kedav1alpha1 "github.com/kedacore/keda/pkg/apis/keda/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{ + kedav1alpha1.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/pkg/generated/clientset/versioned/scheme/doc.go b/pkg/generated/clientset/versioned/scheme/doc.go new file mode 100644 index 00000000000..99cfd499649 --- /dev/null +++ b/pkg/generated/clientset/versioned/scheme/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2020 The KEDA 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/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go new file mode 100644 index 00000000000..4fd3772086a --- /dev/null +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -0,0 +1,55 @@ +/* +Copyright 2020 The KEDA 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 ( + kedav1alpha1 "github.com/kedacore/keda/pkg/apis/keda/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{ + kedav1alpha1.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/pkg/generated/clientset/versioned/typed/keda/v1alpha1/doc.go b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/doc.go new file mode 100644 index 00000000000..aade9d0df7d --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2020 The KEDA 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/pkg/generated/clientset/versioned/typed/keda/v1alpha1/fake/doc.go b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/fake/doc.go new file mode 100644 index 00000000000..6c063b8e00f --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2020 The KEDA 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/pkg/generated/clientset/versioned/typed/keda/v1alpha1/fake/fake_keda_client.go b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/fake/fake_keda_client.go new file mode 100644 index 00000000000..40ff2d3dd99 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/fake/fake_keda_client.go @@ -0,0 +1,47 @@ +/* +Copyright 2020 The KEDA 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 "github.com/kedacore/keda/pkg/generated/clientset/versioned/typed/keda/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeKedaV1alpha1 struct { + *testing.Fake +} + +func (c *FakeKedaV1alpha1) ScaledJobs(namespace string) v1alpha1.ScaledJobInterface { + return &FakeScaledJobs{c, namespace} +} + +func (c *FakeKedaV1alpha1) ScaledObjects(namespace string) v1alpha1.ScaledObjectInterface { + return &FakeScaledObjects{c, namespace} +} + +func (c *FakeKedaV1alpha1) TriggerAuthentications(namespace string) v1alpha1.TriggerAuthenticationInterface { + return &FakeTriggerAuthentications{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeKedaV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/generated/clientset/versioned/typed/keda/v1alpha1/fake/fake_scaledjob.go b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/fake/fake_scaledjob.go new file mode 100644 index 00000000000..76a78b68368 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/fake/fake_scaledjob.go @@ -0,0 +1,139 @@ +/* +Copyright 2020 The KEDA 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 "github.com/kedacore/keda/pkg/apis/keda/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" +) + +// FakeScaledJobs implements ScaledJobInterface +type FakeScaledJobs struct { + Fake *FakeKedaV1alpha1 + ns string +} + +var scaledjobsResource = schema.GroupVersionResource{Group: "keda.sh", Version: "v1alpha1", Resource: "scaledjobs"} + +var scaledjobsKind = schema.GroupVersionKind{Group: "keda.sh", Version: "v1alpha1", Kind: "ScaledJob"} + +// Get takes name of the scaledJob, and returns the corresponding scaledJob object, and an error if there is any. +func (c *FakeScaledJobs) Get(name string, options v1.GetOptions) (result *v1alpha1.ScaledJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(scaledjobsResource, c.ns, name), &v1alpha1.ScaledJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ScaledJob), err +} + +// List takes label and field selectors, and returns the list of ScaledJobs that match those selectors. +func (c *FakeScaledJobs) List(opts v1.ListOptions) (result *v1alpha1.ScaledJobList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(scaledjobsResource, scaledjobsKind, c.ns, opts), &v1alpha1.ScaledJobList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ScaledJobList{ListMeta: obj.(*v1alpha1.ScaledJobList).ListMeta} + for _, item := range obj.(*v1alpha1.ScaledJobList).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 scaledJobs. +func (c *FakeScaledJobs) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(scaledjobsResource, c.ns, opts)) + +} + +// Create takes the representation of a scaledJob and creates it. Returns the server's representation of the scaledJob, and an error, if there is any. +func (c *FakeScaledJobs) Create(scaledJob *v1alpha1.ScaledJob) (result *v1alpha1.ScaledJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(scaledjobsResource, c.ns, scaledJob), &v1alpha1.ScaledJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ScaledJob), err +} + +// Update takes the representation of a scaledJob and updates it. Returns the server's representation of the scaledJob, and an error, if there is any. +func (c *FakeScaledJobs) Update(scaledJob *v1alpha1.ScaledJob) (result *v1alpha1.ScaledJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(scaledjobsResource, c.ns, scaledJob), &v1alpha1.ScaledJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ScaledJob), 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 *FakeScaledJobs) UpdateStatus(scaledJob *v1alpha1.ScaledJob) (*v1alpha1.ScaledJob, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(scaledjobsResource, "status", c.ns, scaledJob), &v1alpha1.ScaledJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ScaledJob), err +} + +// Delete takes name of the scaledJob and deletes it. Returns an error if one occurs. +func (c *FakeScaledJobs) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(scaledjobsResource, c.ns, name), &v1alpha1.ScaledJob{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeScaledJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(scaledjobsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.ScaledJobList{}) + return err +} + +// Patch applies the patch and returns the patched scaledJob. +func (c *FakeScaledJobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ScaledJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(scaledjobsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ScaledJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ScaledJob), err +} diff --git a/pkg/generated/clientset/versioned/typed/keda/v1alpha1/fake/fake_scaledobject.go b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/fake/fake_scaledobject.go new file mode 100644 index 00000000000..8d2d4381e03 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/fake/fake_scaledobject.go @@ -0,0 +1,139 @@ +/* +Copyright 2020 The KEDA 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 "github.com/kedacore/keda/pkg/apis/keda/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" +) + +// FakeScaledObjects implements ScaledObjectInterface +type FakeScaledObjects struct { + Fake *FakeKedaV1alpha1 + ns string +} + +var scaledobjectsResource = schema.GroupVersionResource{Group: "keda.sh", Version: "v1alpha1", Resource: "scaledobjects"} + +var scaledobjectsKind = schema.GroupVersionKind{Group: "keda.sh", Version: "v1alpha1", Kind: "ScaledObject"} + +// Get takes name of the scaledObject, and returns the corresponding scaledObject object, and an error if there is any. +func (c *FakeScaledObjects) Get(name string, options v1.GetOptions) (result *v1alpha1.ScaledObject, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(scaledobjectsResource, c.ns, name), &v1alpha1.ScaledObject{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ScaledObject), err +} + +// List takes label and field selectors, and returns the list of ScaledObjects that match those selectors. +func (c *FakeScaledObjects) List(opts v1.ListOptions) (result *v1alpha1.ScaledObjectList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(scaledobjectsResource, scaledobjectsKind, c.ns, opts), &v1alpha1.ScaledObjectList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ScaledObjectList{ListMeta: obj.(*v1alpha1.ScaledObjectList).ListMeta} + for _, item := range obj.(*v1alpha1.ScaledObjectList).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 scaledObjects. +func (c *FakeScaledObjects) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(scaledobjectsResource, c.ns, opts)) + +} + +// Create takes the representation of a scaledObject and creates it. Returns the server's representation of the scaledObject, and an error, if there is any. +func (c *FakeScaledObjects) Create(scaledObject *v1alpha1.ScaledObject) (result *v1alpha1.ScaledObject, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(scaledobjectsResource, c.ns, scaledObject), &v1alpha1.ScaledObject{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ScaledObject), err +} + +// Update takes the representation of a scaledObject and updates it. Returns the server's representation of the scaledObject, and an error, if there is any. +func (c *FakeScaledObjects) Update(scaledObject *v1alpha1.ScaledObject) (result *v1alpha1.ScaledObject, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(scaledobjectsResource, c.ns, scaledObject), &v1alpha1.ScaledObject{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ScaledObject), 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 *FakeScaledObjects) UpdateStatus(scaledObject *v1alpha1.ScaledObject) (*v1alpha1.ScaledObject, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(scaledobjectsResource, "status", c.ns, scaledObject), &v1alpha1.ScaledObject{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ScaledObject), err +} + +// Delete takes name of the scaledObject and deletes it. Returns an error if one occurs. +func (c *FakeScaledObjects) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(scaledobjectsResource, c.ns, name), &v1alpha1.ScaledObject{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeScaledObjects) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(scaledobjectsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.ScaledObjectList{}) + return err +} + +// Patch applies the patch and returns the patched scaledObject. +func (c *FakeScaledObjects) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ScaledObject, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(scaledobjectsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ScaledObject{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ScaledObject), err +} diff --git a/pkg/generated/clientset/versioned/typed/keda/v1alpha1/fake/fake_triggerauthentication.go b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/fake/fake_triggerauthentication.go new file mode 100644 index 00000000000..d0da6b74e42 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/fake/fake_triggerauthentication.go @@ -0,0 +1,127 @@ +/* +Copyright 2020 The KEDA 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 "github.com/kedacore/keda/pkg/apis/keda/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" +) + +// FakeTriggerAuthentications implements TriggerAuthenticationInterface +type FakeTriggerAuthentications struct { + Fake *FakeKedaV1alpha1 + ns string +} + +var triggerauthenticationsResource = schema.GroupVersionResource{Group: "keda.sh", Version: "v1alpha1", Resource: "triggerauthentications"} + +var triggerauthenticationsKind = schema.GroupVersionKind{Group: "keda.sh", Version: "v1alpha1", Kind: "TriggerAuthentication"} + +// Get takes name of the triggerAuthentication, and returns the corresponding triggerAuthentication object, and an error if there is any. +func (c *FakeTriggerAuthentications) Get(name string, options v1.GetOptions) (result *v1alpha1.TriggerAuthentication, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(triggerauthenticationsResource, c.ns, name), &v1alpha1.TriggerAuthentication{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.TriggerAuthentication), err +} + +// List takes label and field selectors, and returns the list of TriggerAuthentications that match those selectors. +func (c *FakeTriggerAuthentications) List(opts v1.ListOptions) (result *v1alpha1.TriggerAuthenticationList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(triggerauthenticationsResource, triggerauthenticationsKind, c.ns, opts), &v1alpha1.TriggerAuthenticationList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.TriggerAuthenticationList{ListMeta: obj.(*v1alpha1.TriggerAuthenticationList).ListMeta} + for _, item := range obj.(*v1alpha1.TriggerAuthenticationList).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 triggerAuthentications. +func (c *FakeTriggerAuthentications) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(triggerauthenticationsResource, c.ns, opts)) + +} + +// Create takes the representation of a triggerAuthentication and creates it. Returns the server's representation of the triggerAuthentication, and an error, if there is any. +func (c *FakeTriggerAuthentications) Create(triggerAuthentication *v1alpha1.TriggerAuthentication) (result *v1alpha1.TriggerAuthentication, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(triggerauthenticationsResource, c.ns, triggerAuthentication), &v1alpha1.TriggerAuthentication{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.TriggerAuthentication), err +} + +// Update takes the representation of a triggerAuthentication and updates it. Returns the server's representation of the triggerAuthentication, and an error, if there is any. +func (c *FakeTriggerAuthentications) Update(triggerAuthentication *v1alpha1.TriggerAuthentication) (result *v1alpha1.TriggerAuthentication, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(triggerauthenticationsResource, c.ns, triggerAuthentication), &v1alpha1.TriggerAuthentication{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.TriggerAuthentication), err +} + +// Delete takes name of the triggerAuthentication and deletes it. Returns an error if one occurs. +func (c *FakeTriggerAuthentications) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(triggerauthenticationsResource, c.ns, name), &v1alpha1.TriggerAuthentication{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeTriggerAuthentications) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(triggerauthenticationsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.TriggerAuthenticationList{}) + return err +} + +// Patch applies the patch and returns the patched triggerAuthentication. +func (c *FakeTriggerAuthentications) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.TriggerAuthentication, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(triggerauthenticationsResource, c.ns, name, pt, data, subresources...), &v1alpha1.TriggerAuthentication{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.TriggerAuthentication), err +} diff --git a/pkg/generated/clientset/versioned/typed/keda/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/generated_expansion.go new file mode 100644 index 00000000000..849f7b4aa89 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/generated_expansion.go @@ -0,0 +1,24 @@ +/* +Copyright 2020 The KEDA 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 ScaledJobExpansion interface{} + +type ScaledObjectExpansion interface{} + +type TriggerAuthenticationExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/keda/v1alpha1/keda_client.go b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/keda_client.go new file mode 100644 index 00000000000..0eb6a76ab08 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/keda_client.go @@ -0,0 +1,98 @@ +/* +Copyright 2020 The KEDA 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 "github.com/kedacore/keda/pkg/apis/keda/v1alpha1" + "github.com/kedacore/keda/pkg/generated/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type KedaV1alpha1Interface interface { + RESTClient() rest.Interface + ScaledJobsGetter + ScaledObjectsGetter + TriggerAuthenticationsGetter +} + +// KedaV1alpha1Client is used to interact with features provided by the keda.sh group. +type KedaV1alpha1Client struct { + restClient rest.Interface +} + +func (c *KedaV1alpha1Client) ScaledJobs(namespace string) ScaledJobInterface { + return newScaledJobs(c, namespace) +} + +func (c *KedaV1alpha1Client) ScaledObjects(namespace string) ScaledObjectInterface { + return newScaledObjects(c, namespace) +} + +func (c *KedaV1alpha1Client) TriggerAuthentications(namespace string) TriggerAuthenticationInterface { + return newTriggerAuthentications(c, namespace) +} + +// NewForConfig creates a new KedaV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*KedaV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &KedaV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new KedaV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *KedaV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new KedaV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *KedaV1alpha1Client { + return &KedaV1alpha1Client{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 *KedaV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/generated/clientset/versioned/typed/keda/v1alpha1/scaledjob.go b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/scaledjob.go new file mode 100644 index 00000000000..9ca1d48b9b9 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/scaledjob.go @@ -0,0 +1,190 @@ +/* +Copyright 2020 The KEDA 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 ( + "time" + + v1alpha1 "github.com/kedacore/keda/pkg/apis/keda/v1alpha1" + scheme "github.com/kedacore/keda/pkg/generated/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" +) + +// ScaledJobsGetter has a method to return a ScaledJobInterface. +// A group's client should implement this interface. +type ScaledJobsGetter interface { + ScaledJobs(namespace string) ScaledJobInterface +} + +// ScaledJobInterface has methods to work with ScaledJob resources. +type ScaledJobInterface interface { + Create(*v1alpha1.ScaledJob) (*v1alpha1.ScaledJob, error) + Update(*v1alpha1.ScaledJob) (*v1alpha1.ScaledJob, error) + UpdateStatus(*v1alpha1.ScaledJob) (*v1alpha1.ScaledJob, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.ScaledJob, error) + List(opts v1.ListOptions) (*v1alpha1.ScaledJobList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ScaledJob, err error) + ScaledJobExpansion +} + +// scaledJobs implements ScaledJobInterface +type scaledJobs struct { + client rest.Interface + ns string +} + +// newScaledJobs returns a ScaledJobs +func newScaledJobs(c *KedaV1alpha1Client, namespace string) *scaledJobs { + return &scaledJobs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the scaledJob, and returns the corresponding scaledJob object, and an error if there is any. +func (c *scaledJobs) Get(name string, options v1.GetOptions) (result *v1alpha1.ScaledJob, err error) { + result = &v1alpha1.ScaledJob{} + err = c.client.Get(). + Namespace(c.ns). + Resource("scaledjobs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ScaledJobs that match those selectors. +func (c *scaledJobs) List(opts v1.ListOptions) (result *v1alpha1.ScaledJobList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.ScaledJobList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("scaledjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested scaledJobs. +func (c *scaledJobs) Watch(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("scaledjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a scaledJob and creates it. Returns the server's representation of the scaledJob, and an error, if there is any. +func (c *scaledJobs) Create(scaledJob *v1alpha1.ScaledJob) (result *v1alpha1.ScaledJob, err error) { + result = &v1alpha1.ScaledJob{} + err = c.client.Post(). + Namespace(c.ns). + Resource("scaledjobs"). + Body(scaledJob). + Do(). + Into(result) + return +} + +// Update takes the representation of a scaledJob and updates it. Returns the server's representation of the scaledJob, and an error, if there is any. +func (c *scaledJobs) Update(scaledJob *v1alpha1.ScaledJob) (result *v1alpha1.ScaledJob, err error) { + result = &v1alpha1.ScaledJob{} + err = c.client.Put(). + Namespace(c.ns). + Resource("scaledjobs"). + Name(scaledJob.Name). + Body(scaledJob). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *scaledJobs) UpdateStatus(scaledJob *v1alpha1.ScaledJob) (result *v1alpha1.ScaledJob, err error) { + result = &v1alpha1.ScaledJob{} + err = c.client.Put(). + Namespace(c.ns). + Resource("scaledjobs"). + Name(scaledJob.Name). + SubResource("status"). + Body(scaledJob). + Do(). + Into(result) + return +} + +// Delete takes name of the scaledJob and deletes it. Returns an error if one occurs. +func (c *scaledJobs) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("scaledjobs"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *scaledJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("scaledjobs"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched scaledJob. +func (c *scaledJobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ScaledJob, err error) { + result = &v1alpha1.ScaledJob{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("scaledjobs"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/generated/clientset/versioned/typed/keda/v1alpha1/scaledobject.go b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/scaledobject.go new file mode 100644 index 00000000000..9ffae8ce523 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/scaledobject.go @@ -0,0 +1,190 @@ +/* +Copyright 2020 The KEDA 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 ( + "time" + + v1alpha1 "github.com/kedacore/keda/pkg/apis/keda/v1alpha1" + scheme "github.com/kedacore/keda/pkg/generated/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" +) + +// ScaledObjectsGetter has a method to return a ScaledObjectInterface. +// A group's client should implement this interface. +type ScaledObjectsGetter interface { + ScaledObjects(namespace string) ScaledObjectInterface +} + +// ScaledObjectInterface has methods to work with ScaledObject resources. +type ScaledObjectInterface interface { + Create(*v1alpha1.ScaledObject) (*v1alpha1.ScaledObject, error) + Update(*v1alpha1.ScaledObject) (*v1alpha1.ScaledObject, error) + UpdateStatus(*v1alpha1.ScaledObject) (*v1alpha1.ScaledObject, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.ScaledObject, error) + List(opts v1.ListOptions) (*v1alpha1.ScaledObjectList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ScaledObject, err error) + ScaledObjectExpansion +} + +// scaledObjects implements ScaledObjectInterface +type scaledObjects struct { + client rest.Interface + ns string +} + +// newScaledObjects returns a ScaledObjects +func newScaledObjects(c *KedaV1alpha1Client, namespace string) *scaledObjects { + return &scaledObjects{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the scaledObject, and returns the corresponding scaledObject object, and an error if there is any. +func (c *scaledObjects) Get(name string, options v1.GetOptions) (result *v1alpha1.ScaledObject, err error) { + result = &v1alpha1.ScaledObject{} + err = c.client.Get(). + Namespace(c.ns). + Resource("scaledobjects"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ScaledObjects that match those selectors. +func (c *scaledObjects) List(opts v1.ListOptions) (result *v1alpha1.ScaledObjectList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.ScaledObjectList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("scaledobjects"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested scaledObjects. +func (c *scaledObjects) Watch(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("scaledobjects"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a scaledObject and creates it. Returns the server's representation of the scaledObject, and an error, if there is any. +func (c *scaledObjects) Create(scaledObject *v1alpha1.ScaledObject) (result *v1alpha1.ScaledObject, err error) { + result = &v1alpha1.ScaledObject{} + err = c.client.Post(). + Namespace(c.ns). + Resource("scaledobjects"). + Body(scaledObject). + Do(). + Into(result) + return +} + +// Update takes the representation of a scaledObject and updates it. Returns the server's representation of the scaledObject, and an error, if there is any. +func (c *scaledObjects) Update(scaledObject *v1alpha1.ScaledObject) (result *v1alpha1.ScaledObject, err error) { + result = &v1alpha1.ScaledObject{} + err = c.client.Put(). + Namespace(c.ns). + Resource("scaledobjects"). + Name(scaledObject.Name). + Body(scaledObject). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *scaledObjects) UpdateStatus(scaledObject *v1alpha1.ScaledObject) (result *v1alpha1.ScaledObject, err error) { + result = &v1alpha1.ScaledObject{} + err = c.client.Put(). + Namespace(c.ns). + Resource("scaledobjects"). + Name(scaledObject.Name). + SubResource("status"). + Body(scaledObject). + Do(). + Into(result) + return +} + +// Delete takes name of the scaledObject and deletes it. Returns an error if one occurs. +func (c *scaledObjects) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("scaledobjects"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *scaledObjects) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("scaledobjects"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched scaledObject. +func (c *scaledObjects) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ScaledObject, err error) { + result = &v1alpha1.ScaledObject{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("scaledobjects"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/generated/clientset/versioned/typed/keda/v1alpha1/triggerauthentication.go b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/triggerauthentication.go new file mode 100644 index 00000000000..6764687e6f1 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/keda/v1alpha1/triggerauthentication.go @@ -0,0 +1,173 @@ +/* +Copyright 2020 The KEDA 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 ( + "time" + + v1alpha1 "github.com/kedacore/keda/pkg/apis/keda/v1alpha1" + scheme "github.com/kedacore/keda/pkg/generated/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" +) + +// TriggerAuthenticationsGetter has a method to return a TriggerAuthenticationInterface. +// A group's client should implement this interface. +type TriggerAuthenticationsGetter interface { + TriggerAuthentications(namespace string) TriggerAuthenticationInterface +} + +// TriggerAuthenticationInterface has methods to work with TriggerAuthentication resources. +type TriggerAuthenticationInterface interface { + Create(*v1alpha1.TriggerAuthentication) (*v1alpha1.TriggerAuthentication, error) + Update(*v1alpha1.TriggerAuthentication) (*v1alpha1.TriggerAuthentication, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.TriggerAuthentication, error) + List(opts v1.ListOptions) (*v1alpha1.TriggerAuthenticationList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.TriggerAuthentication, err error) + TriggerAuthenticationExpansion +} + +// triggerAuthentications implements TriggerAuthenticationInterface +type triggerAuthentications struct { + client rest.Interface + ns string +} + +// newTriggerAuthentications returns a TriggerAuthentications +func newTriggerAuthentications(c *KedaV1alpha1Client, namespace string) *triggerAuthentications { + return &triggerAuthentications{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the triggerAuthentication, and returns the corresponding triggerAuthentication object, and an error if there is any. +func (c *triggerAuthentications) Get(name string, options v1.GetOptions) (result *v1alpha1.TriggerAuthentication, err error) { + result = &v1alpha1.TriggerAuthentication{} + err = c.client.Get(). + Namespace(c.ns). + Resource("triggerauthentications"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of TriggerAuthentications that match those selectors. +func (c *triggerAuthentications) List(opts v1.ListOptions) (result *v1alpha1.TriggerAuthenticationList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.TriggerAuthenticationList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("triggerauthentications"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested triggerAuthentications. +func (c *triggerAuthentications) Watch(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("triggerauthentications"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a triggerAuthentication and creates it. Returns the server's representation of the triggerAuthentication, and an error, if there is any. +func (c *triggerAuthentications) Create(triggerAuthentication *v1alpha1.TriggerAuthentication) (result *v1alpha1.TriggerAuthentication, err error) { + result = &v1alpha1.TriggerAuthentication{} + err = c.client.Post(). + Namespace(c.ns). + Resource("triggerauthentications"). + Body(triggerAuthentication). + Do(). + Into(result) + return +} + +// Update takes the representation of a triggerAuthentication and updates it. Returns the server's representation of the triggerAuthentication, and an error, if there is any. +func (c *triggerAuthentications) Update(triggerAuthentication *v1alpha1.TriggerAuthentication) (result *v1alpha1.TriggerAuthentication, err error) { + result = &v1alpha1.TriggerAuthentication{} + err = c.client.Put(). + Namespace(c.ns). + Resource("triggerauthentications"). + Name(triggerAuthentication.Name). + Body(triggerAuthentication). + Do(). + Into(result) + return +} + +// Delete takes name of the triggerAuthentication and deletes it. Returns an error if one occurs. +func (c *triggerAuthentications) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("triggerauthentications"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *triggerAuthentications) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("triggerauthentications"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched triggerAuthentication. +func (c *triggerAuthentications) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.TriggerAuthentication, err error) { + result = &v1alpha1.TriggerAuthentication{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("triggerauthentications"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go new file mode 100644 index 00000000000..4bbd90c5c7a --- /dev/null +++ b/pkg/generated/informers/externalversions/factory.go @@ -0,0 +1,179 @@ +/* +Copyright 2020 The KEDA 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 "github.com/kedacore/keda/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kedacore/keda/pkg/generated/informers/externalversions/internalinterfaces" + keda "github.com/kedacore/keda/pkg/generated/informers/externalversions/keda" + 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 + + Keda() keda.Interface +} + +func (f *sharedInformerFactory) Keda() keda.Interface { + return keda.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go new file mode 100644 index 00000000000..197b9986d7e --- /dev/null +++ b/pkg/generated/informers/externalversions/generic.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The KEDA 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 "github.com/kedacore/keda/pkg/apis/keda/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=keda.sh, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("scaledjobs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Keda().V1alpha1().ScaledJobs().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("scaledobjects"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Keda().V1alpha1().ScaledObjects().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("triggerauthentications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Keda().V1alpha1().TriggerAuthentications().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 00000000000..ec46744a221 --- /dev/null +++ b/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,39 @@ +/* +Copyright 2020 The KEDA 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 "github.com/kedacore/keda/pkg/generated/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/pkg/generated/informers/externalversions/keda/interface.go b/pkg/generated/informers/externalversions/keda/interface.go new file mode 100644 index 00000000000..bd12d16bb5c --- /dev/null +++ b/pkg/generated/informers/externalversions/keda/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 2020 The KEDA 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 keda + +import ( + internalinterfaces "github.com/kedacore/keda/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kedacore/keda/pkg/generated/informers/externalversions/keda/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/pkg/generated/informers/externalversions/keda/v1alpha1/interface.go b/pkg/generated/informers/externalversions/keda/v1alpha1/interface.go new file mode 100644 index 00000000000..fb90dbd9940 --- /dev/null +++ b/pkg/generated/informers/externalversions/keda/v1alpha1/interface.go @@ -0,0 +1,58 @@ +/* +Copyright 2020 The KEDA 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 "github.com/kedacore/keda/pkg/generated/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ScaledJobs returns a ScaledJobInformer. + ScaledJobs() ScaledJobInformer + // ScaledObjects returns a ScaledObjectInformer. + ScaledObjects() ScaledObjectInformer + // TriggerAuthentications returns a TriggerAuthenticationInformer. + TriggerAuthentications() TriggerAuthenticationInformer +} + +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} +} + +// ScaledJobs returns a ScaledJobInformer. +func (v *version) ScaledJobs() ScaledJobInformer { + return &scaledJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ScaledObjects returns a ScaledObjectInformer. +func (v *version) ScaledObjects() ScaledObjectInformer { + return &scaledObjectInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// TriggerAuthentications returns a TriggerAuthenticationInformer. +func (v *version) TriggerAuthentications() TriggerAuthenticationInformer { + return &triggerAuthenticationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/generated/informers/externalversions/keda/v1alpha1/scaledjob.go b/pkg/generated/informers/externalversions/keda/v1alpha1/scaledjob.go new file mode 100644 index 00000000000..b5e20895a67 --- /dev/null +++ b/pkg/generated/informers/externalversions/keda/v1alpha1/scaledjob.go @@ -0,0 +1,88 @@ +/* +Copyright 2020 The KEDA 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 ( + time "time" + + kedav1alpha1 "github.com/kedacore/keda/pkg/apis/keda/v1alpha1" + versioned "github.com/kedacore/keda/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kedacore/keda/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kedacore/keda/pkg/generated/listers/keda/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" +) + +// ScaledJobInformer provides access to a shared informer and lister for +// ScaledJobs. +type ScaledJobInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ScaledJobLister +} + +type scaledJobInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewScaledJobInformer constructs a new informer for ScaledJob 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 NewScaledJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredScaledJobInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredScaledJobInformer constructs a new informer for ScaledJob 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 NewFilteredScaledJobInformer(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.KedaV1alpha1().ScaledJobs(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KedaV1alpha1().ScaledJobs(namespace).Watch(options) + }, + }, + &kedav1alpha1.ScaledJob{}, + resyncPeriod, + indexers, + ) +} + +func (f *scaledJobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredScaledJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *scaledJobInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&kedav1alpha1.ScaledJob{}, f.defaultInformer) +} + +func (f *scaledJobInformer) Lister() v1alpha1.ScaledJobLister { + return v1alpha1.NewScaledJobLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/keda/v1alpha1/scaledobject.go b/pkg/generated/informers/externalversions/keda/v1alpha1/scaledobject.go new file mode 100644 index 00000000000..3734b9555b9 --- /dev/null +++ b/pkg/generated/informers/externalversions/keda/v1alpha1/scaledobject.go @@ -0,0 +1,88 @@ +/* +Copyright 2020 The KEDA 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 ( + time "time" + + kedav1alpha1 "github.com/kedacore/keda/pkg/apis/keda/v1alpha1" + versioned "github.com/kedacore/keda/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kedacore/keda/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kedacore/keda/pkg/generated/listers/keda/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" +) + +// ScaledObjectInformer provides access to a shared informer and lister for +// ScaledObjects. +type ScaledObjectInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ScaledObjectLister +} + +type scaledObjectInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewScaledObjectInformer constructs a new informer for ScaledObject 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 NewScaledObjectInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredScaledObjectInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredScaledObjectInformer constructs a new informer for ScaledObject 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 NewFilteredScaledObjectInformer(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.KedaV1alpha1().ScaledObjects(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KedaV1alpha1().ScaledObjects(namespace).Watch(options) + }, + }, + &kedav1alpha1.ScaledObject{}, + resyncPeriod, + indexers, + ) +} + +func (f *scaledObjectInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredScaledObjectInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *scaledObjectInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&kedav1alpha1.ScaledObject{}, f.defaultInformer) +} + +func (f *scaledObjectInformer) Lister() v1alpha1.ScaledObjectLister { + return v1alpha1.NewScaledObjectLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/keda/v1alpha1/triggerauthentication.go b/pkg/generated/informers/externalversions/keda/v1alpha1/triggerauthentication.go new file mode 100644 index 00000000000..3ea67d0e9c4 --- /dev/null +++ b/pkg/generated/informers/externalversions/keda/v1alpha1/triggerauthentication.go @@ -0,0 +1,88 @@ +/* +Copyright 2020 The KEDA 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 ( + time "time" + + kedav1alpha1 "github.com/kedacore/keda/pkg/apis/keda/v1alpha1" + versioned "github.com/kedacore/keda/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kedacore/keda/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kedacore/keda/pkg/generated/listers/keda/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" +) + +// TriggerAuthenticationInformer provides access to a shared informer and lister for +// TriggerAuthentications. +type TriggerAuthenticationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.TriggerAuthenticationLister +} + +type triggerAuthenticationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewTriggerAuthenticationInformer constructs a new informer for TriggerAuthentication 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 NewTriggerAuthenticationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredTriggerAuthenticationInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredTriggerAuthenticationInformer constructs a new informer for TriggerAuthentication 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 NewFilteredTriggerAuthenticationInformer(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.KedaV1alpha1().TriggerAuthentications(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KedaV1alpha1().TriggerAuthentications(namespace).Watch(options) + }, + }, + &kedav1alpha1.TriggerAuthentication{}, + resyncPeriod, + indexers, + ) +} + +func (f *triggerAuthenticationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredTriggerAuthenticationInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *triggerAuthenticationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&kedav1alpha1.TriggerAuthentication{}, f.defaultInformer) +} + +func (f *triggerAuthenticationInformer) Lister() v1alpha1.TriggerAuthenticationLister { + return v1alpha1.NewTriggerAuthenticationLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/listers/keda/v1alpha1/expansion_generated.go b/pkg/generated/listers/keda/v1alpha1/expansion_generated.go new file mode 100644 index 00000000000..cc12eba668b --- /dev/null +++ b/pkg/generated/listers/keda/v1alpha1/expansion_generated.go @@ -0,0 +1,42 @@ +/* +Copyright 2020 The KEDA 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 + +// ScaledJobListerExpansion allows custom methods to be added to +// ScaledJobLister. +type ScaledJobListerExpansion interface{} + +// ScaledJobNamespaceListerExpansion allows custom methods to be added to +// ScaledJobNamespaceLister. +type ScaledJobNamespaceListerExpansion interface{} + +// ScaledObjectListerExpansion allows custom methods to be added to +// ScaledObjectLister. +type ScaledObjectListerExpansion interface{} + +// ScaledObjectNamespaceListerExpansion allows custom methods to be added to +// ScaledObjectNamespaceLister. +type ScaledObjectNamespaceListerExpansion interface{} + +// TriggerAuthenticationListerExpansion allows custom methods to be added to +// TriggerAuthenticationLister. +type TriggerAuthenticationListerExpansion interface{} + +// TriggerAuthenticationNamespaceListerExpansion allows custom methods to be added to +// TriggerAuthenticationNamespaceLister. +type TriggerAuthenticationNamespaceListerExpansion interface{} diff --git a/pkg/generated/listers/keda/v1alpha1/scaledjob.go b/pkg/generated/listers/keda/v1alpha1/scaledjob.go new file mode 100644 index 00000000000..25708333b49 --- /dev/null +++ b/pkg/generated/listers/keda/v1alpha1/scaledjob.go @@ -0,0 +1,93 @@ +/* +Copyright 2020 The KEDA 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 "github.com/kedacore/keda/pkg/apis/keda/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ScaledJobLister helps list ScaledJobs. +type ScaledJobLister interface { + // List lists all ScaledJobs in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.ScaledJob, err error) + // ScaledJobs returns an object that can list and get ScaledJobs. + ScaledJobs(namespace string) ScaledJobNamespaceLister + ScaledJobListerExpansion +} + +// scaledJobLister implements the ScaledJobLister interface. +type scaledJobLister struct { + indexer cache.Indexer +} + +// NewScaledJobLister returns a new ScaledJobLister. +func NewScaledJobLister(indexer cache.Indexer) ScaledJobLister { + return &scaledJobLister{indexer: indexer} +} + +// List lists all ScaledJobs in the indexer. +func (s *scaledJobLister) List(selector labels.Selector) (ret []*v1alpha1.ScaledJob, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ScaledJob)) + }) + return ret, err +} + +// ScaledJobs returns an object that can list and get ScaledJobs. +func (s *scaledJobLister) ScaledJobs(namespace string) ScaledJobNamespaceLister { + return scaledJobNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ScaledJobNamespaceLister helps list and get ScaledJobs. +type ScaledJobNamespaceLister interface { + // List lists all ScaledJobs in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.ScaledJob, err error) + // Get retrieves the ScaledJob from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.ScaledJob, error) + ScaledJobNamespaceListerExpansion +} + +// scaledJobNamespaceLister implements the ScaledJobNamespaceLister +// interface. +type scaledJobNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ScaledJobs in the indexer for a given namespace. +func (s scaledJobNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ScaledJob, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ScaledJob)) + }) + return ret, err +} + +// Get retrieves the ScaledJob from the indexer for a given namespace and name. +func (s scaledJobNamespaceLister) Get(name string) (*v1alpha1.ScaledJob, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("scaledjob"), name) + } + return obj.(*v1alpha1.ScaledJob), nil +} diff --git a/pkg/generated/listers/keda/v1alpha1/scaledobject.go b/pkg/generated/listers/keda/v1alpha1/scaledobject.go new file mode 100644 index 00000000000..290a5248229 --- /dev/null +++ b/pkg/generated/listers/keda/v1alpha1/scaledobject.go @@ -0,0 +1,93 @@ +/* +Copyright 2020 The KEDA 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 "github.com/kedacore/keda/pkg/apis/keda/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ScaledObjectLister helps list ScaledObjects. +type ScaledObjectLister interface { + // List lists all ScaledObjects in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.ScaledObject, err error) + // ScaledObjects returns an object that can list and get ScaledObjects. + ScaledObjects(namespace string) ScaledObjectNamespaceLister + ScaledObjectListerExpansion +} + +// scaledObjectLister implements the ScaledObjectLister interface. +type scaledObjectLister struct { + indexer cache.Indexer +} + +// NewScaledObjectLister returns a new ScaledObjectLister. +func NewScaledObjectLister(indexer cache.Indexer) ScaledObjectLister { + return &scaledObjectLister{indexer: indexer} +} + +// List lists all ScaledObjects in the indexer. +func (s *scaledObjectLister) List(selector labels.Selector) (ret []*v1alpha1.ScaledObject, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ScaledObject)) + }) + return ret, err +} + +// ScaledObjects returns an object that can list and get ScaledObjects. +func (s *scaledObjectLister) ScaledObjects(namespace string) ScaledObjectNamespaceLister { + return scaledObjectNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ScaledObjectNamespaceLister helps list and get ScaledObjects. +type ScaledObjectNamespaceLister interface { + // List lists all ScaledObjects in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.ScaledObject, err error) + // Get retrieves the ScaledObject from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.ScaledObject, error) + ScaledObjectNamespaceListerExpansion +} + +// scaledObjectNamespaceLister implements the ScaledObjectNamespaceLister +// interface. +type scaledObjectNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ScaledObjects in the indexer for a given namespace. +func (s scaledObjectNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ScaledObject, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ScaledObject)) + }) + return ret, err +} + +// Get retrieves the ScaledObject from the indexer for a given namespace and name. +func (s scaledObjectNamespaceLister) Get(name string) (*v1alpha1.ScaledObject, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("scaledobject"), name) + } + return obj.(*v1alpha1.ScaledObject), nil +} diff --git a/pkg/generated/listers/keda/v1alpha1/triggerauthentication.go b/pkg/generated/listers/keda/v1alpha1/triggerauthentication.go new file mode 100644 index 00000000000..ebeb909bd1d --- /dev/null +++ b/pkg/generated/listers/keda/v1alpha1/triggerauthentication.go @@ -0,0 +1,93 @@ +/* +Copyright 2020 The KEDA 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 "github.com/kedacore/keda/pkg/apis/keda/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// TriggerAuthenticationLister helps list TriggerAuthentications. +type TriggerAuthenticationLister interface { + // List lists all TriggerAuthentications in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.TriggerAuthentication, err error) + // TriggerAuthentications returns an object that can list and get TriggerAuthentications. + TriggerAuthentications(namespace string) TriggerAuthenticationNamespaceLister + TriggerAuthenticationListerExpansion +} + +// triggerAuthenticationLister implements the TriggerAuthenticationLister interface. +type triggerAuthenticationLister struct { + indexer cache.Indexer +} + +// NewTriggerAuthenticationLister returns a new TriggerAuthenticationLister. +func NewTriggerAuthenticationLister(indexer cache.Indexer) TriggerAuthenticationLister { + return &triggerAuthenticationLister{indexer: indexer} +} + +// List lists all TriggerAuthentications in the indexer. +func (s *triggerAuthenticationLister) List(selector labels.Selector) (ret []*v1alpha1.TriggerAuthentication, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.TriggerAuthentication)) + }) + return ret, err +} + +// TriggerAuthentications returns an object that can list and get TriggerAuthentications. +func (s *triggerAuthenticationLister) TriggerAuthentications(namespace string) TriggerAuthenticationNamespaceLister { + return triggerAuthenticationNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// TriggerAuthenticationNamespaceLister helps list and get TriggerAuthentications. +type TriggerAuthenticationNamespaceLister interface { + // List lists all TriggerAuthentications in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.TriggerAuthentication, err error) + // Get retrieves the TriggerAuthentication from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.TriggerAuthentication, error) + TriggerAuthenticationNamespaceListerExpansion +} + +// triggerAuthenticationNamespaceLister implements the TriggerAuthenticationNamespaceLister +// interface. +type triggerAuthenticationNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all TriggerAuthentications in the indexer for a given namespace. +func (s triggerAuthenticationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.TriggerAuthentication, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.TriggerAuthentication)) + }) + return ret, err +} + +// Get retrieves the TriggerAuthentication from the indexer for a given namespace and name. +func (s triggerAuthenticationNamespaceLister) Get(name string) (*v1alpha1.TriggerAuthentication, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("triggerauthentication"), name) + } + return obj.(*v1alpha1.TriggerAuthentication), nil +}