From 7db45a3c3c7f07037046411adaabf84449ad0ee5 Mon Sep 17 00:00:00 2001 From: Swetha Repakula Date: Fri, 12 Jun 2020 11:55:37 -0700 Subject: [PATCH] codegen for NEG CRD --- .../v1beta1/zz_generated.openapi.go | 4 +- .../v1beta1/zz_generated.deepcopy.go | 164 ++++++++++++++++ .../v1beta1/zz_generated.openapi.go | 89 +++++++++ .../client/clientset/versioned/clientset.go | 97 ++++++++++ .../client/clientset/versioned/doc.go | 20 ++ .../versioned/fake/clientset_generated.go | 82 ++++++++ .../client/clientset/versioned/fake/doc.go | 20 ++ .../clientset/versioned/fake/register.go | 56 ++++++ .../client/clientset/versioned/scheme/doc.go | 20 ++ .../clientset/versioned/scheme/register.go | 56 ++++++ .../v1beta1/doc.go | 20 ++ .../v1beta1/fake/doc.go | 20 ++ .../fake/fake_servicenetworkendpointgroup.go | 130 +++++++++++++ ...fake_servicenetworkendpointgroup_client.go | 40 ++++ .../v1beta1/generated_expansion.go | 21 ++ .../v1beta1/servicenetworkendpointgroup.go | 178 +++++++++++++++++ .../servicenetworkendpointgroup_client.go | 89 +++++++++ .../informers/externalversions/factory.go | 180 ++++++++++++++++++ .../informers/externalversions/generic.go | 62 ++++++ .../internalinterfaces/factory_interfaces.go | 40 ++++ .../servicenetworkendpointgroup/interface.go | 46 +++++ .../v1beta1/interface.go | 45 +++++ .../v1beta1/servicenetworkendpointgroup.go | 90 +++++++++ .../v1beta1/expansion_generated.go | 27 +++ .../v1beta1/servicenetworkendpointgroup.go | 99 ++++++++++ 25 files changed, 1693 insertions(+), 2 deletions(-) create mode 100644 pkg/apis/servicenetworkendpointgroup/v1beta1/zz_generated.deepcopy.go create mode 100644 pkg/apis/servicenetworkendpointgroup/v1beta1/zz_generated.openapi.go create mode 100644 pkg/servicenetworkendpointgroup/client/clientset/versioned/clientset.go create mode 100644 pkg/servicenetworkendpointgroup/client/clientset/versioned/doc.go create mode 100644 pkg/servicenetworkendpointgroup/client/clientset/versioned/fake/clientset_generated.go create mode 100644 pkg/servicenetworkendpointgroup/client/clientset/versioned/fake/doc.go create mode 100644 pkg/servicenetworkendpointgroup/client/clientset/versioned/fake/register.go create mode 100644 pkg/servicenetworkendpointgroup/client/clientset/versioned/scheme/doc.go create mode 100644 pkg/servicenetworkendpointgroup/client/clientset/versioned/scheme/register.go create mode 100644 pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/doc.go create mode 100644 pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/fake/doc.go create mode 100644 pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/fake/fake_servicenetworkendpointgroup.go create mode 100644 pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/fake/fake_servicenetworkendpointgroup_client.go create mode 100644 pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/generated_expansion.go create mode 100644 pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup.go create mode 100644 pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup_client.go create mode 100644 pkg/servicenetworkendpointgroup/client/informers/externalversions/factory.go create mode 100644 pkg/servicenetworkendpointgroup/client/informers/externalversions/generic.go create mode 100644 pkg/servicenetworkendpointgroup/client/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 pkg/servicenetworkendpointgroup/client/informers/externalversions/servicenetworkendpointgroup/interface.go create mode 100644 pkg/servicenetworkendpointgroup/client/informers/externalversions/servicenetworkendpointgroup/v1beta1/interface.go create mode 100644 pkg/servicenetworkendpointgroup/client/informers/externalversions/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup.go create mode 100644 pkg/servicenetworkendpointgroup/client/listers/servicenetworkendpointgroup/v1beta1/expansion_generated.go create mode 100644 pkg/servicenetworkendpointgroup/client/listers/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup.go diff --git a/pkg/apis/frontendconfig/v1beta1/zz_generated.openapi.go b/pkg/apis/frontendconfig/v1beta1/zz_generated.openapi.go index 27ebcc44f5..062f5bff18 100644 --- a/pkg/apis/frontendconfig/v1beta1/zz_generated.openapi.go +++ b/pkg/apis/frontendconfig/v1beta1/zz_generated.openapi.go @@ -42,14 +42,14 @@ func schema_pkg_apis_frontendconfig_v1beta1_FrontendConfig(ref common.ReferenceC Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", Type: []string{"string"}, Format: "", }, }, "apiVersion": { SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", Type: []string{"string"}, Format: "", }, diff --git a/pkg/apis/servicenetworkendpointgroup/v1beta1/zz_generated.deepcopy.go b/pkg/apis/servicenetworkendpointgroup/v1beta1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..5bf1e40aa6 --- /dev/null +++ b/pkg/apis/servicenetworkendpointgroup/v1beta1/zz_generated.deepcopy.go @@ -0,0 +1,164 @@ +// +build !ignore_autogenerated + +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1beta1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition) DeepCopyInto(out *Condition) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition. +func (in *Condition) DeepCopy() *Condition { + if in == nil { + return nil + } + out := new(Condition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NegObjectReference) DeepCopyInto(out *NegObjectReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NegObjectReference. +func (in *NegObjectReference) DeepCopy() *NegObjectReference { + if in == nil { + return nil + } + out := new(NegObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceNetworkEndpointGroup) DeepCopyInto(out *ServiceNetworkEndpointGroup) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceNetworkEndpointGroup. +func (in *ServiceNetworkEndpointGroup) DeepCopy() *ServiceNetworkEndpointGroup { + if in == nil { + return nil + } + out := new(ServiceNetworkEndpointGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ServiceNetworkEndpointGroup) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceNetworkEndpointGroupList) DeepCopyInto(out *ServiceNetworkEndpointGroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ServiceNetworkEndpointGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceNetworkEndpointGroupList. +func (in *ServiceNetworkEndpointGroupList) DeepCopy() *ServiceNetworkEndpointGroupList { + if in == nil { + return nil + } + out := new(ServiceNetworkEndpointGroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ServiceNetworkEndpointGroupList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceNetworkEndpointGroupSpec) DeepCopyInto(out *ServiceNetworkEndpointGroupSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceNetworkEndpointGroupSpec. +func (in *ServiceNetworkEndpointGroupSpec) DeepCopy() *ServiceNetworkEndpointGroupSpec { + if in == nil { + return nil + } + out := new(ServiceNetworkEndpointGroupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceNetworkEndpointGroupStatus) DeepCopyInto(out *ServiceNetworkEndpointGroupStatus) { + *out = *in + if in.NetworkEndpointGroups != nil { + in, out := &in.NetworkEndpointGroups, &out.NetworkEndpointGroups + *out = make([]NegObjectReference, len(*in)) + copy(*out, *in) + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.LastSyncTime.DeepCopyInto(&out.LastSyncTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceNetworkEndpointGroupStatus. +func (in *ServiceNetworkEndpointGroupStatus) DeepCopy() *ServiceNetworkEndpointGroupStatus { + if in == nil { + return nil + } + out := new(ServiceNetworkEndpointGroupStatus) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/servicenetworkendpointgroup/v1beta1/zz_generated.openapi.go b/pkg/apis/servicenetworkendpointgroup/v1beta1/zz_generated.openapi.go new file mode 100644 index 0000000000..dd0049743a --- /dev/null +++ b/pkg/apis/servicenetworkendpointgroup/v1beta1/zz_generated.openapi.go @@ -0,0 +1,89 @@ +// +build !ignore_autogenerated + +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by openapi-gen. DO NOT EDIT. + +// This file was autogenerated by openapi-gen. Do not edit it manually! + +package v1beta1 + +import ( + spec "github.com/go-openapi/spec" + common "k8s.io/kube-openapi/pkg/common" +) + +func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { + return map[string]common.OpenAPIDefinition{ + "k8s.io/ingress-gce/pkg/apis/servicenetworkendpointgroup/v1beta1.ServiceNetworkEndpointGroup": schema_pkg_apis_servicenetworkendpointgroup_v1beta1_ServiceNetworkEndpointGroup(ref), + "k8s.io/ingress-gce/pkg/apis/servicenetworkendpointgroup/v1beta1.ServiceNetworkEndpointGroupSpec": schema_pkg_apis_servicenetworkendpointgroup_v1beta1_ServiceNetworkEndpointGroupSpec(ref), + } +} + +func schema_pkg_apis_servicenetworkendpointgroup_v1beta1_ServiceNetworkEndpointGroup(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/ingress-gce/pkg/apis/servicenetworkendpointgroup/v1beta1.ServiceNetworkEndpointGroupSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/ingress-gce/pkg/apis/servicenetworkendpointgroup/v1beta1.ServiceNetworkEndpointGroupStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "k8s.io/ingress-gce/pkg/apis/servicenetworkendpointgroup/v1beta1.ServiceNetworkEndpointGroupSpec", "k8s.io/ingress-gce/pkg/apis/servicenetworkendpointgroup/v1beta1.ServiceNetworkEndpointGroupStatus"}, + } +} + +func schema_pkg_apis_servicenetworkendpointgroup_v1beta1_ServiceNetworkEndpointGroupSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServiceNetworkEndpointGroupSpec is the spec for a ServiceNetworkEndpointGroup resource", + Type: []string{"object"}, + }, + }, + } +} diff --git a/pkg/servicenetworkendpointgroup/client/clientset/versioned/clientset.go b/pkg/servicenetworkendpointgroup/client/clientset/versioned/clientset.go new file mode 100644 index 0000000000..bee0a094ab --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/clientset/versioned/clientset.go @@ -0,0 +1,97 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package versioned + +import ( + "fmt" + + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" + networkingv1beta1 "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + networkingV1beta1 *networkingv1beta1.NetworkingV1beta1Client +} + +// NetworkingV1beta1 retrieves the NetworkingV1beta1Client +func (c *Clientset) NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface { + return c.networkingV1beta1 +} + +// 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.networkingV1beta1, err = networkingv1beta1.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.networkingV1beta1 = networkingv1beta1.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.networkingV1beta1 = networkingv1beta1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/pkg/servicenetworkendpointgroup/client/clientset/versioned/doc.go b/pkg/servicenetworkendpointgroup/client/clientset/versioned/doc.go new file mode 100644 index 0000000000..6ee812fc57 --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/clientset/versioned/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package versioned diff --git a/pkg/servicenetworkendpointgroup/client/clientset/versioned/fake/clientset_generated.go b/pkg/servicenetworkendpointgroup/client/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..39c979b2e8 --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,82 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "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" + clientset "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/clientset/versioned" + networkingv1beta1 "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1" + fakenetworkingv1beta1 "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/fake" +) + +// 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{} + +// NetworkingV1beta1 retrieves the NetworkingV1beta1Client +func (c *Clientset) NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface { + return &fakenetworkingv1beta1.FakeNetworkingV1beta1{Fake: &c.Fake} +} diff --git a/pkg/servicenetworkendpointgroup/client/clientset/versioned/fake/doc.go b/pkg/servicenetworkendpointgroup/client/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..d6baf01acb --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/clientset/versioned/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/servicenetworkendpointgroup/client/clientset/versioned/fake/register.go b/pkg/servicenetworkendpointgroup/client/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..387acd460e --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/clientset/versioned/fake/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + 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" + networkingv1beta1 "k8s.io/ingress-gce/pkg/apis/servicenetworkendpointgroup/v1beta1" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) + +var localSchemeBuilder = runtime.SchemeBuilder{ + networkingv1beta1.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/servicenetworkendpointgroup/client/clientset/versioned/scheme/doc.go b/pkg/servicenetworkendpointgroup/client/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..7d06c9402d --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/clientset/versioned/scheme/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/pkg/servicenetworkendpointgroup/client/clientset/versioned/scheme/register.go b/pkg/servicenetworkendpointgroup/client/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..cbd4aac0e5 --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/clientset/versioned/scheme/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + 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" + networkingv1beta1 "k8s.io/ingress-gce/pkg/apis/servicenetworkendpointgroup/v1beta1" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + networkingv1beta1.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/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/doc.go b/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/doc.go new file mode 100644 index 0000000000..68f9a55b51 --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1beta1 diff --git a/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/fake/doc.go b/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/fake/doc.go new file mode 100644 index 0000000000..0243e68ff4 --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/fake/fake_servicenetworkendpointgroup.go b/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/fake/fake_servicenetworkendpointgroup.go new file mode 100644 index 0000000000..7dea1ff371 --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/fake/fake_servicenetworkendpointgroup.go @@ -0,0 +1,130 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + 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" + v1beta1 "k8s.io/ingress-gce/pkg/apis/servicenetworkendpointgroup/v1beta1" +) + +// FakeServiceNetworkEndpointGroups implements ServiceNetworkEndpointGroupInterface +type FakeServiceNetworkEndpointGroups struct { + Fake *FakeNetworkingV1beta1 + ns string +} + +var servicenetworkendpointgroupsResource = schema.GroupVersionResource{Group: "networking.gke.io", Version: "v1beta1", Resource: "servicenetworkendpointgroups"} + +var servicenetworkendpointgroupsKind = schema.GroupVersionKind{Group: "networking.gke.io", Version: "v1beta1", Kind: "ServiceNetworkEndpointGroup"} + +// Get takes name of the serviceNetworkEndpointGroup, and returns the corresponding serviceNetworkEndpointGroup object, and an error if there is any. +func (c *FakeServiceNetworkEndpointGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ServiceNetworkEndpointGroup, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(servicenetworkendpointgroupsResource, c.ns, name), &v1beta1.ServiceNetworkEndpointGroup{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.ServiceNetworkEndpointGroup), err +} + +// List takes label and field selectors, and returns the list of ServiceNetworkEndpointGroups that match those selectors. +func (c *FakeServiceNetworkEndpointGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ServiceNetworkEndpointGroupList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(servicenetworkendpointgroupsResource, servicenetworkendpointgroupsKind, c.ns, opts), &v1beta1.ServiceNetworkEndpointGroupList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.ServiceNetworkEndpointGroupList{ListMeta: obj.(*v1beta1.ServiceNetworkEndpointGroupList).ListMeta} + for _, item := range obj.(*v1beta1.ServiceNetworkEndpointGroupList).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 serviceNetworkEndpointGroups. +func (c *FakeServiceNetworkEndpointGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(servicenetworkendpointgroupsResource, c.ns, opts)) + +} + +// Create takes the representation of a serviceNetworkEndpointGroup and creates it. Returns the server's representation of the serviceNetworkEndpointGroup, and an error, if there is any. +func (c *FakeServiceNetworkEndpointGroups) Create(ctx context.Context, serviceNetworkEndpointGroup *v1beta1.ServiceNetworkEndpointGroup, opts v1.CreateOptions) (result *v1beta1.ServiceNetworkEndpointGroup, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(servicenetworkendpointgroupsResource, c.ns, serviceNetworkEndpointGroup), &v1beta1.ServiceNetworkEndpointGroup{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.ServiceNetworkEndpointGroup), err +} + +// Update takes the representation of a serviceNetworkEndpointGroup and updates it. Returns the server's representation of the serviceNetworkEndpointGroup, and an error, if there is any. +func (c *FakeServiceNetworkEndpointGroups) Update(ctx context.Context, serviceNetworkEndpointGroup *v1beta1.ServiceNetworkEndpointGroup, opts v1.UpdateOptions) (result *v1beta1.ServiceNetworkEndpointGroup, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(servicenetworkendpointgroupsResource, c.ns, serviceNetworkEndpointGroup), &v1beta1.ServiceNetworkEndpointGroup{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.ServiceNetworkEndpointGroup), err +} + +// Delete takes name of the serviceNetworkEndpointGroup and deletes it. Returns an error if one occurs. +func (c *FakeServiceNetworkEndpointGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(servicenetworkendpointgroupsResource, c.ns, name), &v1beta1.ServiceNetworkEndpointGroup{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeServiceNetworkEndpointGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(servicenetworkendpointgroupsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1beta1.ServiceNetworkEndpointGroupList{}) + return err +} + +// Patch applies the patch and returns the patched serviceNetworkEndpointGroup. +func (c *FakeServiceNetworkEndpointGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ServiceNetworkEndpointGroup, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(servicenetworkendpointgroupsResource, c.ns, name, pt, data, subresources...), &v1beta1.ServiceNetworkEndpointGroup{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.ServiceNetworkEndpointGroup), err +} diff --git a/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/fake/fake_servicenetworkendpointgroup_client.go b/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/fake/fake_servicenetworkendpointgroup_client.go new file mode 100644 index 0000000000..a06cc9566f --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/fake/fake_servicenetworkendpointgroup_client.go @@ -0,0 +1,40 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" + v1beta1 "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1" +) + +type FakeNetworkingV1beta1 struct { + *testing.Fake +} + +func (c *FakeNetworkingV1beta1) ServiceNetworkEndpointGroups(namespace string) v1beta1.ServiceNetworkEndpointGroupInterface { + return &FakeServiceNetworkEndpointGroups{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeNetworkingV1beta1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/generated_expansion.go b/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/generated_expansion.go new file mode 100644 index 0000000000..c7352270e6 --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/generated_expansion.go @@ -0,0 +1,21 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +type ServiceNetworkEndpointGroupExpansion interface{} diff --git a/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup.go b/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup.go new file mode 100644 index 0000000000..f0938a7ba8 --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup.go @@ -0,0 +1,178 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + "time" + + 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" + v1beta1 "k8s.io/ingress-gce/pkg/apis/servicenetworkendpointgroup/v1beta1" + scheme "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/clientset/versioned/scheme" +) + +// ServiceNetworkEndpointGroupsGetter has a method to return a ServiceNetworkEndpointGroupInterface. +// A group's client should implement this interface. +type ServiceNetworkEndpointGroupsGetter interface { + ServiceNetworkEndpointGroups(namespace string) ServiceNetworkEndpointGroupInterface +} + +// ServiceNetworkEndpointGroupInterface has methods to work with ServiceNetworkEndpointGroup resources. +type ServiceNetworkEndpointGroupInterface interface { + Create(ctx context.Context, serviceNetworkEndpointGroup *v1beta1.ServiceNetworkEndpointGroup, opts v1.CreateOptions) (*v1beta1.ServiceNetworkEndpointGroup, error) + Update(ctx context.Context, serviceNetworkEndpointGroup *v1beta1.ServiceNetworkEndpointGroup, opts v1.UpdateOptions) (*v1beta1.ServiceNetworkEndpointGroup, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.ServiceNetworkEndpointGroup, error) + List(ctx context.Context, opts v1.ListOptions) (*v1beta1.ServiceNetworkEndpointGroupList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ServiceNetworkEndpointGroup, err error) + ServiceNetworkEndpointGroupExpansion +} + +// serviceNetworkEndpointGroups implements ServiceNetworkEndpointGroupInterface +type serviceNetworkEndpointGroups struct { + client rest.Interface + ns string +} + +// newServiceNetworkEndpointGroups returns a ServiceNetworkEndpointGroups +func newServiceNetworkEndpointGroups(c *NetworkingV1beta1Client, namespace string) *serviceNetworkEndpointGroups { + return &serviceNetworkEndpointGroups{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the serviceNetworkEndpointGroup, and returns the corresponding serviceNetworkEndpointGroup object, and an error if there is any. +func (c *serviceNetworkEndpointGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ServiceNetworkEndpointGroup, err error) { + result = &v1beta1.ServiceNetworkEndpointGroup{} + err = c.client.Get(). + Namespace(c.ns). + Resource("servicenetworkendpointgroups"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ServiceNetworkEndpointGroups that match those selectors. +func (c *serviceNetworkEndpointGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ServiceNetworkEndpointGroupList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta1.ServiceNetworkEndpointGroupList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("servicenetworkendpointgroups"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested serviceNetworkEndpointGroups. +func (c *serviceNetworkEndpointGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("servicenetworkendpointgroups"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a serviceNetworkEndpointGroup and creates it. Returns the server's representation of the serviceNetworkEndpointGroup, and an error, if there is any. +func (c *serviceNetworkEndpointGroups) Create(ctx context.Context, serviceNetworkEndpointGroup *v1beta1.ServiceNetworkEndpointGroup, opts v1.CreateOptions) (result *v1beta1.ServiceNetworkEndpointGroup, err error) { + result = &v1beta1.ServiceNetworkEndpointGroup{} + err = c.client.Post(). + Namespace(c.ns). + Resource("servicenetworkendpointgroups"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(serviceNetworkEndpointGroup). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a serviceNetworkEndpointGroup and updates it. Returns the server's representation of the serviceNetworkEndpointGroup, and an error, if there is any. +func (c *serviceNetworkEndpointGroups) Update(ctx context.Context, serviceNetworkEndpointGroup *v1beta1.ServiceNetworkEndpointGroup, opts v1.UpdateOptions) (result *v1beta1.ServiceNetworkEndpointGroup, err error) { + result = &v1beta1.ServiceNetworkEndpointGroup{} + err = c.client.Put(). + Namespace(c.ns). + Resource("servicenetworkendpointgroups"). + Name(serviceNetworkEndpointGroup.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(serviceNetworkEndpointGroup). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the serviceNetworkEndpointGroup and deletes it. Returns an error if one occurs. +func (c *serviceNetworkEndpointGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("servicenetworkendpointgroups"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *serviceNetworkEndpointGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("servicenetworkendpointgroups"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched serviceNetworkEndpointGroup. +func (c *serviceNetworkEndpointGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ServiceNetworkEndpointGroup, err error) { + result = &v1beta1.ServiceNetworkEndpointGroup{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("servicenetworkendpointgroups"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup_client.go b/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup_client.go new file mode 100644 index 0000000000..a1d31caa71 --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/clientset/versioned/typed/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup_client.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + rest "k8s.io/client-go/rest" + v1beta1 "k8s.io/ingress-gce/pkg/apis/servicenetworkendpointgroup/v1beta1" + "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/clientset/versioned/scheme" +) + +type NetworkingV1beta1Interface interface { + RESTClient() rest.Interface + ServiceNetworkEndpointGroupsGetter +} + +// NetworkingV1beta1Client is used to interact with features provided by the networking.gke.io group. +type NetworkingV1beta1Client struct { + restClient rest.Interface +} + +func (c *NetworkingV1beta1Client) ServiceNetworkEndpointGroups(namespace string) ServiceNetworkEndpointGroupInterface { + return newServiceNetworkEndpointGroups(c, namespace) +} + +// NewForConfig creates a new NetworkingV1beta1Client for the given config. +func NewForConfig(c *rest.Config) (*NetworkingV1beta1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &NetworkingV1beta1Client{client}, nil +} + +// NewForConfigOrDie creates a new NetworkingV1beta1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *NetworkingV1beta1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new NetworkingV1beta1Client for the given RESTClient. +func New(c rest.Interface) *NetworkingV1beta1Client { + return &NetworkingV1beta1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1beta1.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 *NetworkingV1beta1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/servicenetworkendpointgroup/client/informers/externalversions/factory.go b/pkg/servicenetworkendpointgroup/client/informers/externalversions/factory.go new file mode 100644 index 0000000000..f0650a15c4 --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/informers/externalversions/factory.go @@ -0,0 +1,180 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + 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" + versioned "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/clientset/versioned" + internalinterfaces "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/informers/externalversions/internalinterfaces" + servicenetworkendpointgroup "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/informers/externalversions/servicenetworkendpointgroup" +) + +// 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 + + Networking() servicenetworkendpointgroup.Interface +} + +func (f *sharedInformerFactory) Networking() servicenetworkendpointgroup.Interface { + return servicenetworkendpointgroup.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/servicenetworkendpointgroup/client/informers/externalversions/generic.go b/pkg/servicenetworkendpointgroup/client/informers/externalversions/generic.go new file mode 100644 index 0000000000..25e61453de --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/informers/externalversions/generic.go @@ -0,0 +1,62 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + "fmt" + + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + v1beta1 "k8s.io/ingress-gce/pkg/apis/servicenetworkendpointgroup/v1beta1" +) + +// 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=networking.gke.io, Version=v1beta1 + case v1beta1.SchemeGroupVersion.WithResource("servicenetworkendpointgroups"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().ServiceNetworkEndpointGroups().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/pkg/servicenetworkendpointgroup/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/servicenetworkendpointgroup/client/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..e3ccf54c14 --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,40 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + versioned "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/clientset/versioned" +) + +// 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/servicenetworkendpointgroup/client/informers/externalversions/servicenetworkendpointgroup/interface.go b/pkg/servicenetworkendpointgroup/client/informers/externalversions/servicenetworkendpointgroup/interface.go new file mode 100644 index 0000000000..36b4ee71ed --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/informers/externalversions/servicenetworkendpointgroup/interface.go @@ -0,0 +1,46 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package servicenetworkendpointgroup + +import ( + internalinterfaces "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/informers/externalversions/internalinterfaces" + v1beta1 "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/informers/externalversions/servicenetworkendpointgroup/v1beta1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.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} +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/servicenetworkendpointgroup/client/informers/externalversions/servicenetworkendpointgroup/v1beta1/interface.go b/pkg/servicenetworkendpointgroup/client/informers/externalversions/servicenetworkendpointgroup/v1beta1/interface.go new file mode 100644 index 0000000000..056ad09e75 --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/informers/externalversions/servicenetworkendpointgroup/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ServiceNetworkEndpointGroups returns a ServiceNetworkEndpointGroupInformer. + ServiceNetworkEndpointGroups() ServiceNetworkEndpointGroupInformer +} + +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} +} + +// ServiceNetworkEndpointGroups returns a ServiceNetworkEndpointGroupInformer. +func (v *version) ServiceNetworkEndpointGroups() ServiceNetworkEndpointGroupInformer { + return &serviceNetworkEndpointGroupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/servicenetworkendpointgroup/client/informers/externalversions/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup.go b/pkg/servicenetworkendpointgroup/client/informers/externalversions/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup.go new file mode 100644 index 0000000000..f9b8c97576 --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/informers/externalversions/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup.go @@ -0,0 +1,90 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + 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" + servicenetworkendpointgroupv1beta1 "k8s.io/ingress-gce/pkg/apis/servicenetworkendpointgroup/v1beta1" + versioned "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/clientset/versioned" + internalinterfaces "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/informers/externalversions/internalinterfaces" + v1beta1 "k8s.io/ingress-gce/pkg/servicenetworkendpointgroup/client/listers/servicenetworkendpointgroup/v1beta1" +) + +// ServiceNetworkEndpointGroupInformer provides access to a shared informer and lister for +// ServiceNetworkEndpointGroups. +type ServiceNetworkEndpointGroupInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.ServiceNetworkEndpointGroupLister +} + +type serviceNetworkEndpointGroupInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewServiceNetworkEndpointGroupInformer constructs a new informer for ServiceNetworkEndpointGroup 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 NewServiceNetworkEndpointGroupInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredServiceNetworkEndpointGroupInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredServiceNetworkEndpointGroupInformer constructs a new informer for ServiceNetworkEndpointGroup 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 NewFilteredServiceNetworkEndpointGroupInformer(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.NetworkingV1beta1().ServiceNetworkEndpointGroups(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1beta1().ServiceNetworkEndpointGroups(namespace).Watch(context.TODO(), options) + }, + }, + &servicenetworkendpointgroupv1beta1.ServiceNetworkEndpointGroup{}, + resyncPeriod, + indexers, + ) +} + +func (f *serviceNetworkEndpointGroupInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredServiceNetworkEndpointGroupInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *serviceNetworkEndpointGroupInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&servicenetworkendpointgroupv1beta1.ServiceNetworkEndpointGroup{}, f.defaultInformer) +} + +func (f *serviceNetworkEndpointGroupInformer) Lister() v1beta1.ServiceNetworkEndpointGroupLister { + return v1beta1.NewServiceNetworkEndpointGroupLister(f.Informer().GetIndexer()) +} diff --git a/pkg/servicenetworkendpointgroup/client/listers/servicenetworkendpointgroup/v1beta1/expansion_generated.go b/pkg/servicenetworkendpointgroup/client/listers/servicenetworkendpointgroup/v1beta1/expansion_generated.go new file mode 100644 index 0000000000..fdca949d02 --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/listers/servicenetworkendpointgroup/v1beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// ServiceNetworkEndpointGroupListerExpansion allows custom methods to be added to +// ServiceNetworkEndpointGroupLister. +type ServiceNetworkEndpointGroupListerExpansion interface{} + +// ServiceNetworkEndpointGroupNamespaceListerExpansion allows custom methods to be added to +// ServiceNetworkEndpointGroupNamespaceLister. +type ServiceNetworkEndpointGroupNamespaceListerExpansion interface{} diff --git a/pkg/servicenetworkendpointgroup/client/listers/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup.go b/pkg/servicenetworkendpointgroup/client/listers/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup.go new file mode 100644 index 0000000000..2a5893f580 --- /dev/null +++ b/pkg/servicenetworkendpointgroup/client/listers/servicenetworkendpointgroup/v1beta1/servicenetworkendpointgroup.go @@ -0,0 +1,99 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1beta1 "k8s.io/ingress-gce/pkg/apis/servicenetworkendpointgroup/v1beta1" +) + +// ServiceNetworkEndpointGroupLister helps list ServiceNetworkEndpointGroups. +// All objects returned here must be treated as read-only. +type ServiceNetworkEndpointGroupLister interface { + // List lists all ServiceNetworkEndpointGroups in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ServiceNetworkEndpointGroup, err error) + // ServiceNetworkEndpointGroups returns an object that can list and get ServiceNetworkEndpointGroups. + ServiceNetworkEndpointGroups(namespace string) ServiceNetworkEndpointGroupNamespaceLister + ServiceNetworkEndpointGroupListerExpansion +} + +// serviceNetworkEndpointGroupLister implements the ServiceNetworkEndpointGroupLister interface. +type serviceNetworkEndpointGroupLister struct { + indexer cache.Indexer +} + +// NewServiceNetworkEndpointGroupLister returns a new ServiceNetworkEndpointGroupLister. +func NewServiceNetworkEndpointGroupLister(indexer cache.Indexer) ServiceNetworkEndpointGroupLister { + return &serviceNetworkEndpointGroupLister{indexer: indexer} +} + +// List lists all ServiceNetworkEndpointGroups in the indexer. +func (s *serviceNetworkEndpointGroupLister) List(selector labels.Selector) (ret []*v1beta1.ServiceNetworkEndpointGroup, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ServiceNetworkEndpointGroup)) + }) + return ret, err +} + +// ServiceNetworkEndpointGroups returns an object that can list and get ServiceNetworkEndpointGroups. +func (s *serviceNetworkEndpointGroupLister) ServiceNetworkEndpointGroups(namespace string) ServiceNetworkEndpointGroupNamespaceLister { + return serviceNetworkEndpointGroupNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ServiceNetworkEndpointGroupNamespaceLister helps list and get ServiceNetworkEndpointGroups. +// All objects returned here must be treated as read-only. +type ServiceNetworkEndpointGroupNamespaceLister interface { + // List lists all ServiceNetworkEndpointGroups in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ServiceNetworkEndpointGroup, err error) + // Get retrieves the ServiceNetworkEndpointGroup from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.ServiceNetworkEndpointGroup, error) + ServiceNetworkEndpointGroupNamespaceListerExpansion +} + +// serviceNetworkEndpointGroupNamespaceLister implements the ServiceNetworkEndpointGroupNamespaceLister +// interface. +type serviceNetworkEndpointGroupNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ServiceNetworkEndpointGroups in the indexer for a given namespace. +func (s serviceNetworkEndpointGroupNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.ServiceNetworkEndpointGroup, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ServiceNetworkEndpointGroup)) + }) + return ret, err +} + +// Get retrieves the ServiceNetworkEndpointGroup from the indexer for a given namespace and name. +func (s serviceNetworkEndpointGroupNamespaceLister) Get(name string) (*v1beta1.ServiceNetworkEndpointGroup, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("servicenetworkendpointgroup"), name) + } + return obj.(*v1beta1.ServiceNetworkEndpointGroup), nil +}