diff --git a/pkg/api/validation/utils_test.go b/pkg/api/validation/utils_test.go index 59f538a97c..6e2c2d6716 100644 --- a/pkg/api/validation/utils_test.go +++ b/pkg/api/validation/utils_test.go @@ -22,7 +22,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/xeipuuv/gojsonschema" - v1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1" + v2beta3 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2beta3" ) func Test_validateSchema(t *testing.T) { @@ -35,7 +35,7 @@ func Test_validateSchema(t *testing.T) { { name: "", schemaLoader: gojsonschema.NewStringLoader(`{"anyOf":[{"required":["plugins","uri"]},{"required":["upstream","uri"]},{"required":["upstream_id","uri"]},{"required":["service_id","uri"]},{"required":["plugins","uris"]},{"required":["upstream","uris"]},{"required":["upstream_id","uris"]},{"required":["service_id","uris"]},{"required":["script","uri"]},{"required":["script","uris"]}],"additionalProperties":false,"not":{"anyOf":[{"required":["script","plugins"]},{"required":["script","plugin_config_id"]}]},"properties":{"priority":{"default":0,"type":"integer"},"uris":{"minItems":1,"type":"array","items":{"type":"string","description":"HTTP uri"},"uniqueItems":true},"methods":{"type":"array","items":{"type":"string","enum":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS","CONNECT","TRACE"],"description":"HTTP method"},"uniqueItems":true},"name":{"type":"string","minLength":1,"maxLength":100},"remote_addrs":{"minItems":1,"type":"array","items":{"type":"string","anyOf":[{"type":"string","format":"ipv4","title":"IPv4"},{"type":"string","pattern":"^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([12]?[0-9]|3[0-2])$","title":"IPv4\/CIDR"},{"type":"string","format":"ipv6","title":"IPv6"},{"type":"string","pattern":"^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$","title":"IPv6\/CIDR"}],"description":"client IP"},"uniqueItems":true},"filter_func":{"type":"string","minLength":10,"pattern":"^function"},"enable_websocket":{"type":"boolean","description":"enable websocket for request"},"script_id":{"anyOf":[{"pattern":"^[a-zA-Z0-9-_.]+$","type":"string","minLength":1,"maxLength":64},{"minimum":1,"type":"integer"}]},"service_protocol":{"enum":["grpc","http"]},"service_id":{"anyOf":[{"pattern":"^[a-zA-Z0-9-_.]+$","type":"string","minLength":1,"maxLength":64},{"minimum":1,"type":"integer"}]},"hosts":{"minItems":1,"type":"array","items":{"pattern":"^\\*?[0-9a-zA-Z-._]+$","type":"string"},"uniqueItems":true},"vars":{"type":"array"},"upstream":{"oneOf":[{"required":["type","nodes"]},{"required":["type","service_name","discovery_type"]}],"properties":{"id":{"anyOf":[{"pattern":"^[a-zA-Z0-9-_.]+$","type":"string","minLength":1,"maxLength":64},{"minimum":1,"type":"integer"}]},"name":{"type":"string","minLength":1,"maxLength":100},"create_time":{"type":"integer"},"retries":{"minimum":0,"type":"integer"},"scheme":{"enum":["grpc","grpcs","http","https"],"default":"http"},"key":{"type":"string","description":"the key of chash for dynamic load balancing"},"hash_on":{"default":"vars","enum":["vars","header","cookie","consumer","vars_combinations"],"type":"string"},"tls":{"properties":{"client_key":{"type":"string","minLength":128,"maxLength":65536},"client_cert":{"type":"string","minLength":128,"maxLength":65536}},"type":"object","required":["client_cert","client_key"]},"labels":{"maxProperties":16,"type":"object","patternProperties":{".*":{"pattern":"^\\S+$","description":"value of label","type":"string","minLength":1,"maxLength":64}},"description":"key\/value pairs to specify attributes"},"discovery_type":{"type":"string","description":"discovery type"},"update_time":{"type":"integer"},"service_name":{"type":"string","minLength":1,"maxLength":256},"pass_host":{"default":"pass","type":"string","enum":["pass","node","rewrite"],"description":"mod of host passing"},"upstream_host":{"pattern":"^\\*?[0-9a-zA-Z-._]+$","type":"string"},"desc":{"maxLength":256,"type":"string"},"checks":{"anyOf":[{"required":["active"]},{"required":["active","passive"]}],"properties":{"active":{"properties":{"healthy":{"properties":{"http_statuses":{"items":{"minimum":200,"maximum":599,"type":"integer"},"default":[200,302],"type":"array","minItems":1,"uniqueItems":true},"successes":{"default":2,"minimum":1,"maximum":254,"type":"integer"},"interval":{"minimum":1,"default":1,"type":"integer"}},"type":"object"},"concurrency":{"default":10,"type":"integer"},"http_path":{"default":"\/","type":"string"},"https_verify_certificate":{"default":true,"type":"boolean"},"req_headers":{"minItems":1,"items":{"uniqueItems":true,"type":"string"},"type":"array"},"unhealthy":{"properties":{"http_statuses":{"items":{"minimum":200,"maximum":599,"type":"integer"},"default":[429,404,500,501,502,503,504,505],"type":"array","minItems":1,"uniqueItems":true},"http_failures":{"default":5,"minimum":1,"maximum":254,"type":"integer"},"tcp_failures":{"default":2,"minimum":1,"maximum":254,"type":"integer"},"timeouts":{"default":3,"minimum":1,"maximum":254,"type":"integer"},"interval":{"minimum":1,"default":1,"type":"integer"}},"type":"object"},"timeout":{"default":1,"type":"number"},"type":{"enum":["http","https","tcp"],"default":"http","type":"string"},"host":{"pattern":"^\\*?[0-9a-zA-Z-._]+$","type":"string"},"port":{"minimum":1,"maximum":65535,"type":"integer"}},"type":"object"},"passive":{"properties":{"type":{"enum":["http","https","tcp"],"default":"http","type":"string"},"healthy":{"properties":{"successes":{"default":5,"minimum":1,"maximum":254,"type":"integer"},"http_statuses":{"items":{"minimum":200,"maximum":599,"type":"integer"},"default":[200,201,202,203,204,205,206,207,208,226,300,301,302,303,304,305,306,307,308],"type":"array","minItems":1,"uniqueItems":true}},"type":"object"},"unhealthy":{"properties":{"timeouts":{"default":7,"minimum":1,"maximum":254,"type":"integer"},"http_statuses":{"items":{"minimum":200,"maximum":599,"type":"integer"},"default":[429,500,503],"type":"array","minItems":1,"uniqueItems":true},"http_failures":{"default":5,"minimum":1,"maximum":254,"type":"integer"},"tcp_failures":{"default":2,"minimum":1,"maximum":254,"type":"integer"}},"type":"object"}},"type":"object"}},"additionalProperties":false,"type":"object"},"type":{"type":"string","enum":["chash","roundrobin","ewma","least_conn"],"description":"algorithms of load balancing"},"nodes":{"anyOf":[{"patternProperties":{".*":{"type":"integer","minimum":0,"description":"weight of node"}},"type":"object"},{"items":{"properties":{"weight":{"type":"integer","minimum":0,"description":"weight of node"},"priority":{"type":"integer","default":0,"description":"priority of node"},"metadata":{"type":"object","description":"metadata of node"},"host":{"pattern":"^\\*?[0-9a-zA-Z-._]+$","type":"string"},"port":{"type":"integer","minimum":1,"description":"port of node"}},"type":"object","required":["host","port","weight"]},"type":"array"}]},"timeout":{"properties":{"send":{"exclusiveMinimum":0,"type":"number"},"read":{"exclusiveMinimum":0,"type":"number"},"connect":{"exclusiveMinimum":0,"type":"number"}},"type":"object","required":["connect","send","read"]}},"additionalProperties":false,"type":"object"},"id":{"anyOf":[{"pattern":"^[a-zA-Z0-9-_.]+$","type":"string","minLength":1,"maxLength":64},{"minimum":1,"type":"integer"}]},"upstream_id":{"anyOf":[{"pattern":"^[a-zA-Z0-9-_.]+$","type":"string","minLength":1,"maxLength":64},{"minimum":1,"type":"integer"}]},"labels":{"maxProperties":16,"type":"object","patternProperties":{".*":{"pattern":"^\\S+$","description":"value of label","type":"string","minLength":1,"maxLength":64}},"description":"key\/value pairs to specify attributes"},"uri":{"type":"string","minLength":1,"maxLength":4096},"update_time":{"type":"integer"},"plugin_config_id":{"anyOf":[{"pattern":"^[a-zA-Z0-9-_.]+$","type":"string","minLength":1,"maxLength":64},{"minimum":1,"type":"integer"}]},"desc":{"maxLength":256,"type":"string"},"status":{"default":1,"type":"integer","enum":[1,0],"description":"route status, 1 to enable, 0 to disable"},"remote_addr":{"type":"string","anyOf":[{"type":"string","format":"ipv4","title":"IPv4"},{"type":"string","pattern":"^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([12]?[0-9]|3[0-2])$","title":"IPv4\/CIDR"},{"type":"string","format":"ipv6","title":"IPv6"},{"type":"string","pattern":"^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$","title":"IPv6\/CIDR"}],"description":"client IP"},"plugins":{"type":"object"},"host":{"pattern":"^\\*?[0-9a-zA-Z-._]+$","type":"string"},"script":{"type":"string","minLength":10,"maxLength":102400},"create_time":{"type":"integer"}},"allOf":[{"oneOf":[{"required":["uri"]},{"required":["uris"]}]},{"oneOf":[{"not":{"anyOf":[{"required":["host"]},{"required":["hosts"]}]}},{"required":["host"]},{"required":["hosts"]}]},{"oneOf":[{"not":{"anyOf":[{"required":["remote_addr"]},{"required":["remote_addrs"]}]}},{"required":["remote_addr"]},{"required":["remote_addrs"]}]}],"type":"object"}`), - obj: v1.ApisixRoute{}, + obj: v2beta3.ApisixRoute{}, wantErr: true, }, } diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/apisixroute.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/apisixroute.go deleted file mode 100644 index 89de07a6b1..0000000000 --- a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/apisixroute.go +++ /dev/null @@ -1,177 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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 v1 - -import ( - "context" - "time" - - v1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1" - scheme "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// ApisixRoutesGetter has a method to return a ApisixRouteInterface. -// A group's client should implement this interface. -type ApisixRoutesGetter interface { - ApisixRoutes(namespace string) ApisixRouteInterface -} - -// ApisixRouteInterface has methods to work with ApisixRoute resources. -type ApisixRouteInterface interface { - Create(ctx context.Context, apisixRoute *v1.ApisixRoute, opts metav1.CreateOptions) (*v1.ApisixRoute, error) - Update(ctx context.Context, apisixRoute *v1.ApisixRoute, opts metav1.UpdateOptions) (*v1.ApisixRoute, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ApisixRoute, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.ApisixRouteList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ApisixRoute, err error) - ApisixRouteExpansion -} - -// apisixRoutes implements ApisixRouteInterface -type apisixRoutes struct { - client rest.Interface - ns string -} - -// newApisixRoutes returns a ApisixRoutes -func newApisixRoutes(c *ApisixV1Client, namespace string) *apisixRoutes { - return &apisixRoutes{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the apisixRoute, and returns the corresponding apisixRoute object, and an error if there is any. -func (c *apisixRoutes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ApisixRoute, err error) { - result = &v1.ApisixRoute{} - err = c.client.Get(). - Namespace(c.ns). - Resource("apisixroutes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ApisixRoutes that match those selectors. -func (c *apisixRoutes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ApisixRouteList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.ApisixRouteList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("apisixroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested apisixRoutes. -func (c *apisixRoutes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("apisixroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a apisixRoute and creates it. Returns the server's representation of the apisixRoute, and an error, if there is any. -func (c *apisixRoutes) Create(ctx context.Context, apisixRoute *v1.ApisixRoute, opts metav1.CreateOptions) (result *v1.ApisixRoute, err error) { - result = &v1.ApisixRoute{} - err = c.client.Post(). - Namespace(c.ns). - Resource("apisixroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(apisixRoute). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a apisixRoute and updates it. Returns the server's representation of the apisixRoute, and an error, if there is any. -func (c *apisixRoutes) Update(ctx context.Context, apisixRoute *v1.ApisixRoute, opts metav1.UpdateOptions) (result *v1.ApisixRoute, err error) { - result = &v1.ApisixRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("apisixroutes"). - Name(apisixRoute.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(apisixRoute). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the apisixRoute and deletes it. Returns an error if one occurs. -func (c *apisixRoutes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("apisixroutes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *apisixRoutes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("apisixroutes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched apisixRoute. -func (c *apisixRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ApisixRoute, err error) { - result = &v1.ApisixRoute{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("apisixroutes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/apisixtls.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/apisixtls.go deleted file mode 100644 index 6648315ab8..0000000000 --- a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/apisixtls.go +++ /dev/null @@ -1,194 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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 v1 - -import ( - "context" - "time" - - v1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1" - scheme "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// ApisixTlsesGetter has a method to return a ApisixTlsInterface. -// A group's client should implement this interface. -type ApisixTlsesGetter interface { - ApisixTlses(namespace string) ApisixTlsInterface -} - -// ApisixTlsInterface has methods to work with ApisixTls resources. -type ApisixTlsInterface interface { - Create(ctx context.Context, apisixTls *v1.ApisixTls, opts metav1.CreateOptions) (*v1.ApisixTls, error) - Update(ctx context.Context, apisixTls *v1.ApisixTls, opts metav1.UpdateOptions) (*v1.ApisixTls, error) - UpdateStatus(ctx context.Context, apisixTls *v1.ApisixTls, opts metav1.UpdateOptions) (*v1.ApisixTls, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ApisixTls, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.ApisixTlsList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ApisixTls, err error) - ApisixTlsExpansion -} - -// apisixTlses implements ApisixTlsInterface -type apisixTlses struct { - client rest.Interface - ns string -} - -// newApisixTlses returns a ApisixTlses -func newApisixTlses(c *ApisixV1Client, namespace string) *apisixTlses { - return &apisixTlses{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the apisixTls, and returns the corresponding apisixTls object, and an error if there is any. -func (c *apisixTlses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ApisixTls, err error) { - result = &v1.ApisixTls{} - err = c.client.Get(). - Namespace(c.ns). - Resource("apisixtlses"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ApisixTlses that match those selectors. -func (c *apisixTlses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ApisixTlsList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.ApisixTlsList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("apisixtlses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested apisixTlses. -func (c *apisixTlses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("apisixtlses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a apisixTls and creates it. Returns the server's representation of the apisixTls, and an error, if there is any. -func (c *apisixTlses) Create(ctx context.Context, apisixTls *v1.ApisixTls, opts metav1.CreateOptions) (result *v1.ApisixTls, err error) { - result = &v1.ApisixTls{} - err = c.client.Post(). - Namespace(c.ns). - Resource("apisixtlses"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(apisixTls). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a apisixTls and updates it. Returns the server's representation of the apisixTls, and an error, if there is any. -func (c *apisixTlses) Update(ctx context.Context, apisixTls *v1.ApisixTls, opts metav1.UpdateOptions) (result *v1.ApisixTls, err error) { - result = &v1.ApisixTls{} - err = c.client.Put(). - Namespace(c.ns). - Resource("apisixtlses"). - Name(apisixTls.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(apisixTls). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *apisixTlses) UpdateStatus(ctx context.Context, apisixTls *v1.ApisixTls, opts metav1.UpdateOptions) (result *v1.ApisixTls, err error) { - result = &v1.ApisixTls{} - err = c.client.Put(). - Namespace(c.ns). - Resource("apisixtlses"). - Name(apisixTls.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(apisixTls). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the apisixTls and deletes it. Returns an error if one occurs. -func (c *apisixTlses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("apisixtlses"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *apisixTlses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("apisixtlses"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched apisixTls. -func (c *apisixTlses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ApisixTls, err error) { - result = &v1.ApisixTls{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("apisixtlses"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/apisixupstream.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/apisixupstream.go deleted file mode 100644 index cbb8b6b90c..0000000000 --- a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/apisixupstream.go +++ /dev/null @@ -1,194 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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 v1 - -import ( - "context" - "time" - - v1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1" - scheme "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// ApisixUpstreamsGetter has a method to return a ApisixUpstreamInterface. -// A group's client should implement this interface. -type ApisixUpstreamsGetter interface { - ApisixUpstreams(namespace string) ApisixUpstreamInterface -} - -// ApisixUpstreamInterface has methods to work with ApisixUpstream resources. -type ApisixUpstreamInterface interface { - Create(ctx context.Context, apisixUpstream *v1.ApisixUpstream, opts metav1.CreateOptions) (*v1.ApisixUpstream, error) - Update(ctx context.Context, apisixUpstream *v1.ApisixUpstream, opts metav1.UpdateOptions) (*v1.ApisixUpstream, error) - UpdateStatus(ctx context.Context, apisixUpstream *v1.ApisixUpstream, opts metav1.UpdateOptions) (*v1.ApisixUpstream, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ApisixUpstream, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.ApisixUpstreamList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ApisixUpstream, err error) - ApisixUpstreamExpansion -} - -// apisixUpstreams implements ApisixUpstreamInterface -type apisixUpstreams struct { - client rest.Interface - ns string -} - -// newApisixUpstreams returns a ApisixUpstreams -func newApisixUpstreams(c *ApisixV1Client, namespace string) *apisixUpstreams { - return &apisixUpstreams{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the apisixUpstream, and returns the corresponding apisixUpstream object, and an error if there is any. -func (c *apisixUpstreams) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ApisixUpstream, err error) { - result = &v1.ApisixUpstream{} - err = c.client.Get(). - Namespace(c.ns). - Resource("apisixupstreams"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ApisixUpstreams that match those selectors. -func (c *apisixUpstreams) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ApisixUpstreamList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.ApisixUpstreamList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("apisixupstreams"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested apisixUpstreams. -func (c *apisixUpstreams) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("apisixupstreams"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a apisixUpstream and creates it. Returns the server's representation of the apisixUpstream, and an error, if there is any. -func (c *apisixUpstreams) Create(ctx context.Context, apisixUpstream *v1.ApisixUpstream, opts metav1.CreateOptions) (result *v1.ApisixUpstream, err error) { - result = &v1.ApisixUpstream{} - err = c.client.Post(). - Namespace(c.ns). - Resource("apisixupstreams"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(apisixUpstream). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a apisixUpstream and updates it. Returns the server's representation of the apisixUpstream, and an error, if there is any. -func (c *apisixUpstreams) Update(ctx context.Context, apisixUpstream *v1.ApisixUpstream, opts metav1.UpdateOptions) (result *v1.ApisixUpstream, err error) { - result = &v1.ApisixUpstream{} - err = c.client.Put(). - Namespace(c.ns). - Resource("apisixupstreams"). - Name(apisixUpstream.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(apisixUpstream). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *apisixUpstreams) UpdateStatus(ctx context.Context, apisixUpstream *v1.ApisixUpstream, opts metav1.UpdateOptions) (result *v1.ApisixUpstream, err error) { - result = &v1.ApisixUpstream{} - err = c.client.Put(). - Namespace(c.ns). - Resource("apisixupstreams"). - Name(apisixUpstream.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(apisixUpstream). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the apisixUpstream and deletes it. Returns an error if one occurs. -func (c *apisixUpstreams) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("apisixupstreams"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *apisixUpstreams) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("apisixupstreams"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched apisixUpstream. -func (c *apisixUpstreams) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ApisixUpstream, err error) { - result = &v1.ApisixUpstream{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("apisixupstreams"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/config_client.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/config_client.go deleted file mode 100644 index 51755d22a5..0000000000 --- a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/config_client.go +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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 v1 - -import ( - v1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1" - "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type ApisixV1Interface interface { - RESTClient() rest.Interface - ApisixRoutesGetter - ApisixTlsesGetter - ApisixUpstreamsGetter -} - -// ApisixV1Client is used to interact with features provided by the apisix.apache.org group. -type ApisixV1Client struct { - restClient rest.Interface -} - -func (c *ApisixV1Client) ApisixRoutes(namespace string) ApisixRouteInterface { - return newApisixRoutes(c, namespace) -} - -func (c *ApisixV1Client) ApisixTlses(namespace string) ApisixTlsInterface { - return newApisixTlses(c, namespace) -} - -func (c *ApisixV1Client) ApisixUpstreams(namespace string) ApisixUpstreamInterface { - return newApisixUpstreams(c, namespace) -} - -// NewForConfig creates a new ApisixV1Client for the given config. -func NewForConfig(c *rest.Config) (*ApisixV1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &ApisixV1Client{client}, nil -} - -// NewForConfigOrDie creates a new ApisixV1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *ApisixV1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new ApisixV1Client for the given RESTClient. -func New(c rest.Interface) *ApisixV1Client { - return &ApisixV1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1.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 *ApisixV1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/doc.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/doc.go deleted file mode 100644 index 3d70ceb2a4..0000000000 --- a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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 v1 diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/fake/doc.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/fake/doc.go deleted file mode 100644 index cfa1988880..0000000000 --- a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/fake/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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/kube/apisix/client/clientset/versioned/typed/config/v1/fake/fake_apisixroute.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/fake/fake_apisixroute.go deleted file mode 100644 index 548080ff49..0000000000 --- a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/fake/fake_apisixroute.go +++ /dev/null @@ -1,129 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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" - - configv1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1" - 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" -) - -// FakeApisixRoutes implements ApisixRouteInterface -type FakeApisixRoutes struct { - Fake *FakeApisixV1 - ns string -} - -var apisixroutesResource = schema.GroupVersionResource{Group: "apisix.apache.org", Version: "v1", Resource: "apisixroutes"} - -var apisixroutesKind = schema.GroupVersionKind{Group: "apisix.apache.org", Version: "v1", Kind: "ApisixRoute"} - -// Get takes name of the apisixRoute, and returns the corresponding apisixRoute object, and an error if there is any. -func (c *FakeApisixRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *configv1.ApisixRoute, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(apisixroutesResource, c.ns, name), &configv1.ApisixRoute{}) - - if obj == nil { - return nil, err - } - return obj.(*configv1.ApisixRoute), err -} - -// List takes label and field selectors, and returns the list of ApisixRoutes that match those selectors. -func (c *FakeApisixRoutes) List(ctx context.Context, opts v1.ListOptions) (result *configv1.ApisixRouteList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(apisixroutesResource, apisixroutesKind, c.ns, opts), &configv1.ApisixRouteList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &configv1.ApisixRouteList{ListMeta: obj.(*configv1.ApisixRouteList).ListMeta} - for _, item := range obj.(*configv1.ApisixRouteList).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 apisixRoutes. -func (c *FakeApisixRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(apisixroutesResource, c.ns, opts)) - -} - -// Create takes the representation of a apisixRoute and creates it. Returns the server's representation of the apisixRoute, and an error, if there is any. -func (c *FakeApisixRoutes) Create(ctx context.Context, apisixRoute *configv1.ApisixRoute, opts v1.CreateOptions) (result *configv1.ApisixRoute, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(apisixroutesResource, c.ns, apisixRoute), &configv1.ApisixRoute{}) - - if obj == nil { - return nil, err - } - return obj.(*configv1.ApisixRoute), err -} - -// Update takes the representation of a apisixRoute and updates it. Returns the server's representation of the apisixRoute, and an error, if there is any. -func (c *FakeApisixRoutes) Update(ctx context.Context, apisixRoute *configv1.ApisixRoute, opts v1.UpdateOptions) (result *configv1.ApisixRoute, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(apisixroutesResource, c.ns, apisixRoute), &configv1.ApisixRoute{}) - - if obj == nil { - return nil, err - } - return obj.(*configv1.ApisixRoute), err -} - -// Delete takes name of the apisixRoute and deletes it. Returns an error if one occurs. -func (c *FakeApisixRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(apisixroutesResource, c.ns, name), &configv1.ApisixRoute{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeApisixRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(apisixroutesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &configv1.ApisixRouteList{}) - return err -} - -// Patch applies the patch and returns the patched apisixRoute. -func (c *FakeApisixRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *configv1.ApisixRoute, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(apisixroutesResource, c.ns, name, pt, data, subresources...), &configv1.ApisixRoute{}) - - if obj == nil { - return nil, err - } - return obj.(*configv1.ApisixRoute), err -} diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/fake/fake_apisixtls.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/fake/fake_apisixtls.go deleted file mode 100644 index ba463f1f23..0000000000 --- a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/fake/fake_apisixtls.go +++ /dev/null @@ -1,141 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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" - - configv1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1" - 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" -) - -// FakeApisixTlses implements ApisixTlsInterface -type FakeApisixTlses struct { - Fake *FakeApisixV1 - ns string -} - -var apisixtlsesResource = schema.GroupVersionResource{Group: "apisix.apache.org", Version: "v1", Resource: "apisixtlses"} - -var apisixtlsesKind = schema.GroupVersionKind{Group: "apisix.apache.org", Version: "v1", Kind: "ApisixTls"} - -// Get takes name of the apisixTls, and returns the corresponding apisixTls object, and an error if there is any. -func (c *FakeApisixTlses) Get(ctx context.Context, name string, options v1.GetOptions) (result *configv1.ApisixTls, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(apisixtlsesResource, c.ns, name), &configv1.ApisixTls{}) - - if obj == nil { - return nil, err - } - return obj.(*configv1.ApisixTls), err -} - -// List takes label and field selectors, and returns the list of ApisixTlses that match those selectors. -func (c *FakeApisixTlses) List(ctx context.Context, opts v1.ListOptions) (result *configv1.ApisixTlsList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(apisixtlsesResource, apisixtlsesKind, c.ns, opts), &configv1.ApisixTlsList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &configv1.ApisixTlsList{ListMeta: obj.(*configv1.ApisixTlsList).ListMeta} - for _, item := range obj.(*configv1.ApisixTlsList).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 apisixTlses. -func (c *FakeApisixTlses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(apisixtlsesResource, c.ns, opts)) - -} - -// Create takes the representation of a apisixTls and creates it. Returns the server's representation of the apisixTls, and an error, if there is any. -func (c *FakeApisixTlses) Create(ctx context.Context, apisixTls *configv1.ApisixTls, opts v1.CreateOptions) (result *configv1.ApisixTls, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(apisixtlsesResource, c.ns, apisixTls), &configv1.ApisixTls{}) - - if obj == nil { - return nil, err - } - return obj.(*configv1.ApisixTls), err -} - -// Update takes the representation of a apisixTls and updates it. Returns the server's representation of the apisixTls, and an error, if there is any. -func (c *FakeApisixTlses) Update(ctx context.Context, apisixTls *configv1.ApisixTls, opts v1.UpdateOptions) (result *configv1.ApisixTls, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(apisixtlsesResource, c.ns, apisixTls), &configv1.ApisixTls{}) - - if obj == nil { - return nil, err - } - return obj.(*configv1.ApisixTls), 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 *FakeApisixTlses) UpdateStatus(ctx context.Context, apisixTls *configv1.ApisixTls, opts v1.UpdateOptions) (*configv1.ApisixTls, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(apisixtlsesResource, "status", c.ns, apisixTls), &configv1.ApisixTls{}) - - if obj == nil { - return nil, err - } - return obj.(*configv1.ApisixTls), err -} - -// Delete takes name of the apisixTls and deletes it. Returns an error if one occurs. -func (c *FakeApisixTlses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(apisixtlsesResource, c.ns, name), &configv1.ApisixTls{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeApisixTlses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(apisixtlsesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &configv1.ApisixTlsList{}) - return err -} - -// Patch applies the patch and returns the patched apisixTls. -func (c *FakeApisixTlses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *configv1.ApisixTls, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(apisixtlsesResource, c.ns, name, pt, data, subresources...), &configv1.ApisixTls{}) - - if obj == nil { - return nil, err - } - return obj.(*configv1.ApisixTls), err -} diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/fake/fake_apisixupstream.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/fake/fake_apisixupstream.go deleted file mode 100644 index 13082d9787..0000000000 --- a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/fake/fake_apisixupstream.go +++ /dev/null @@ -1,141 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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" - - configv1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1" - 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" -) - -// FakeApisixUpstreams implements ApisixUpstreamInterface -type FakeApisixUpstreams struct { - Fake *FakeApisixV1 - ns string -} - -var apisixupstreamsResource = schema.GroupVersionResource{Group: "apisix.apache.org", Version: "v1", Resource: "apisixupstreams"} - -var apisixupstreamsKind = schema.GroupVersionKind{Group: "apisix.apache.org", Version: "v1", Kind: "ApisixUpstream"} - -// Get takes name of the apisixUpstream, and returns the corresponding apisixUpstream object, and an error if there is any. -func (c *FakeApisixUpstreams) Get(ctx context.Context, name string, options v1.GetOptions) (result *configv1.ApisixUpstream, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(apisixupstreamsResource, c.ns, name), &configv1.ApisixUpstream{}) - - if obj == nil { - return nil, err - } - return obj.(*configv1.ApisixUpstream), err -} - -// List takes label and field selectors, and returns the list of ApisixUpstreams that match those selectors. -func (c *FakeApisixUpstreams) List(ctx context.Context, opts v1.ListOptions) (result *configv1.ApisixUpstreamList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(apisixupstreamsResource, apisixupstreamsKind, c.ns, opts), &configv1.ApisixUpstreamList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &configv1.ApisixUpstreamList{ListMeta: obj.(*configv1.ApisixUpstreamList).ListMeta} - for _, item := range obj.(*configv1.ApisixUpstreamList).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 apisixUpstreams. -func (c *FakeApisixUpstreams) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(apisixupstreamsResource, c.ns, opts)) - -} - -// Create takes the representation of a apisixUpstream and creates it. Returns the server's representation of the apisixUpstream, and an error, if there is any. -func (c *FakeApisixUpstreams) Create(ctx context.Context, apisixUpstream *configv1.ApisixUpstream, opts v1.CreateOptions) (result *configv1.ApisixUpstream, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(apisixupstreamsResource, c.ns, apisixUpstream), &configv1.ApisixUpstream{}) - - if obj == nil { - return nil, err - } - return obj.(*configv1.ApisixUpstream), err -} - -// Update takes the representation of a apisixUpstream and updates it. Returns the server's representation of the apisixUpstream, and an error, if there is any. -func (c *FakeApisixUpstreams) Update(ctx context.Context, apisixUpstream *configv1.ApisixUpstream, opts v1.UpdateOptions) (result *configv1.ApisixUpstream, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(apisixupstreamsResource, c.ns, apisixUpstream), &configv1.ApisixUpstream{}) - - if obj == nil { - return nil, err - } - return obj.(*configv1.ApisixUpstream), 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 *FakeApisixUpstreams) UpdateStatus(ctx context.Context, apisixUpstream *configv1.ApisixUpstream, opts v1.UpdateOptions) (*configv1.ApisixUpstream, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(apisixupstreamsResource, "status", c.ns, apisixUpstream), &configv1.ApisixUpstream{}) - - if obj == nil { - return nil, err - } - return obj.(*configv1.ApisixUpstream), err -} - -// Delete takes name of the apisixUpstream and deletes it. Returns an error if one occurs. -func (c *FakeApisixUpstreams) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(apisixupstreamsResource, c.ns, name), &configv1.ApisixUpstream{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeApisixUpstreams) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(apisixupstreamsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &configv1.ApisixUpstreamList{}) - return err -} - -// Patch applies the patch and returns the patched apisixUpstream. -func (c *FakeApisixUpstreams) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *configv1.ApisixUpstream, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(apisixupstreamsResource, c.ns, name, pt, data, subresources...), &configv1.ApisixUpstream{}) - - if obj == nil { - return nil, err - } - return obj.(*configv1.ApisixUpstream), err -} diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/fake/fake_config_client.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/fake/fake_config_client.go deleted file mode 100644 index b1b1b9dfb4..0000000000 --- a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/fake/fake_config_client.go +++ /dev/null @@ -1,47 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/typed/config/v1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeApisixV1 struct { - *testing.Fake -} - -func (c *FakeApisixV1) ApisixRoutes(namespace string) v1.ApisixRouteInterface { - return &FakeApisixRoutes{c, namespace} -} - -func (c *FakeApisixV1) ApisixTlses(namespace string) v1.ApisixTlsInterface { - return &FakeApisixTlses{c, namespace} -} - -func (c *FakeApisixV1) ApisixUpstreams(namespace string) v1.ApisixUpstreamInterface { - return &FakeApisixUpstreams{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeApisixV1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/generated_expansion.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/generated_expansion.go deleted file mode 100644 index 611b97d3ce..0000000000 --- a/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/generated_expansion.go +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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 v1 - -type ApisixRouteExpansion interface{} - -type ApisixTlsExpansion interface{} - -type ApisixUpstreamExpansion interface{} diff --git a/pkg/kube/apisix/client/listers/config/v1/apisixroute.go b/pkg/kube/apisix/client/listers/config/v1/apisixroute.go deleted file mode 100644 index 4102214717..0000000000 --- a/pkg/kube/apisix/client/listers/config/v1/apisixroute.go +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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 v1 - -import ( - v1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// ApisixRouteLister helps list ApisixRoutes. -// All objects returned here must be treated as read-only. -type ApisixRouteLister interface { - // List lists all ApisixRoutes in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.ApisixRoute, err error) - // ApisixRoutes returns an object that can list and get ApisixRoutes. - ApisixRoutes(namespace string) ApisixRouteNamespaceLister - ApisixRouteListerExpansion -} - -// apisixRouteLister implements the ApisixRouteLister interface. -type apisixRouteLister struct { - indexer cache.Indexer -} - -// NewApisixRouteLister returns a new ApisixRouteLister. -func NewApisixRouteLister(indexer cache.Indexer) ApisixRouteLister { - return &apisixRouteLister{indexer: indexer} -} - -// List lists all ApisixRoutes in the indexer. -func (s *apisixRouteLister) List(selector labels.Selector) (ret []*v1.ApisixRoute, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ApisixRoute)) - }) - return ret, err -} - -// ApisixRoutes returns an object that can list and get ApisixRoutes. -func (s *apisixRouteLister) ApisixRoutes(namespace string) ApisixRouteNamespaceLister { - return apisixRouteNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ApisixRouteNamespaceLister helps list and get ApisixRoutes. -// All objects returned here must be treated as read-only. -type ApisixRouteNamespaceLister interface { - // List lists all ApisixRoutes in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.ApisixRoute, err error) - // Get retrieves the ApisixRoute from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.ApisixRoute, error) - ApisixRouteNamespaceListerExpansion -} - -// apisixRouteNamespaceLister implements the ApisixRouteNamespaceLister -// interface. -type apisixRouteNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ApisixRoutes in the indexer for a given namespace. -func (s apisixRouteNamespaceLister) List(selector labels.Selector) (ret []*v1.ApisixRoute, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ApisixRoute)) - }) - return ret, err -} - -// Get retrieves the ApisixRoute from the indexer for a given namespace and name. -func (s apisixRouteNamespaceLister) Get(name string) (*v1.ApisixRoute, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("apisixroute"), name) - } - return obj.(*v1.ApisixRoute), nil -} diff --git a/pkg/kube/apisix/client/listers/config/v1/apisixtls.go b/pkg/kube/apisix/client/listers/config/v1/apisixtls.go deleted file mode 100644 index f345302f1b..0000000000 --- a/pkg/kube/apisix/client/listers/config/v1/apisixtls.go +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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 v1 - -import ( - v1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// ApisixTlsLister helps list ApisixTlses. -// All objects returned here must be treated as read-only. -type ApisixTlsLister interface { - // List lists all ApisixTlses in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.ApisixTls, err error) - // ApisixTlses returns an object that can list and get ApisixTlses. - ApisixTlses(namespace string) ApisixTlsNamespaceLister - ApisixTlsListerExpansion -} - -// apisixTlsLister implements the ApisixTlsLister interface. -type apisixTlsLister struct { - indexer cache.Indexer -} - -// NewApisixTlsLister returns a new ApisixTlsLister. -func NewApisixTlsLister(indexer cache.Indexer) ApisixTlsLister { - return &apisixTlsLister{indexer: indexer} -} - -// List lists all ApisixTlses in the indexer. -func (s *apisixTlsLister) List(selector labels.Selector) (ret []*v1.ApisixTls, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ApisixTls)) - }) - return ret, err -} - -// ApisixTlses returns an object that can list and get ApisixTlses. -func (s *apisixTlsLister) ApisixTlses(namespace string) ApisixTlsNamespaceLister { - return apisixTlsNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ApisixTlsNamespaceLister helps list and get ApisixTlses. -// All objects returned here must be treated as read-only. -type ApisixTlsNamespaceLister interface { - // List lists all ApisixTlses in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.ApisixTls, err error) - // Get retrieves the ApisixTls from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.ApisixTls, error) - ApisixTlsNamespaceListerExpansion -} - -// apisixTlsNamespaceLister implements the ApisixTlsNamespaceLister -// interface. -type apisixTlsNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ApisixTlses in the indexer for a given namespace. -func (s apisixTlsNamespaceLister) List(selector labels.Selector) (ret []*v1.ApisixTls, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ApisixTls)) - }) - return ret, err -} - -// Get retrieves the ApisixTls from the indexer for a given namespace and name. -func (s apisixTlsNamespaceLister) Get(name string) (*v1.ApisixTls, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("apisixtls"), name) - } - return obj.(*v1.ApisixTls), nil -} diff --git a/pkg/kube/apisix/client/listers/config/v1/apisixupstream.go b/pkg/kube/apisix/client/listers/config/v1/apisixupstream.go deleted file mode 100644 index f25d8ddf73..0000000000 --- a/pkg/kube/apisix/client/listers/config/v1/apisixupstream.go +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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 v1 - -import ( - v1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// ApisixUpstreamLister helps list ApisixUpstreams. -// All objects returned here must be treated as read-only. -type ApisixUpstreamLister interface { - // List lists all ApisixUpstreams in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.ApisixUpstream, err error) - // ApisixUpstreams returns an object that can list and get ApisixUpstreams. - ApisixUpstreams(namespace string) ApisixUpstreamNamespaceLister - ApisixUpstreamListerExpansion -} - -// apisixUpstreamLister implements the ApisixUpstreamLister interface. -type apisixUpstreamLister struct { - indexer cache.Indexer -} - -// NewApisixUpstreamLister returns a new ApisixUpstreamLister. -func NewApisixUpstreamLister(indexer cache.Indexer) ApisixUpstreamLister { - return &apisixUpstreamLister{indexer: indexer} -} - -// List lists all ApisixUpstreams in the indexer. -func (s *apisixUpstreamLister) List(selector labels.Selector) (ret []*v1.ApisixUpstream, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ApisixUpstream)) - }) - return ret, err -} - -// ApisixUpstreams returns an object that can list and get ApisixUpstreams. -func (s *apisixUpstreamLister) ApisixUpstreams(namespace string) ApisixUpstreamNamespaceLister { - return apisixUpstreamNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ApisixUpstreamNamespaceLister helps list and get ApisixUpstreams. -// All objects returned here must be treated as read-only. -type ApisixUpstreamNamespaceLister interface { - // List lists all ApisixUpstreams in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.ApisixUpstream, err error) - // Get retrieves the ApisixUpstream from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.ApisixUpstream, error) - ApisixUpstreamNamespaceListerExpansion -} - -// apisixUpstreamNamespaceLister implements the ApisixUpstreamNamespaceLister -// interface. -type apisixUpstreamNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ApisixUpstreams in the indexer for a given namespace. -func (s apisixUpstreamNamespaceLister) List(selector labels.Selector) (ret []*v1.ApisixUpstream, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ApisixUpstream)) - }) - return ret, err -} - -// Get retrieves the ApisixUpstream from the indexer for a given namespace and name. -func (s apisixUpstreamNamespaceLister) Get(name string) (*v1.ApisixUpstream, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("apisixupstream"), name) - } - return obj.(*v1.ApisixUpstream), nil -} diff --git a/pkg/kube/apisix/client/listers/config/v1/expansion_generated.go b/pkg/kube/apisix/client/listers/config/v1/expansion_generated.go deleted file mode 100644 index 8bf45acf12..0000000000 --- a/pkg/kube/apisix/client/listers/config/v1/expansion_generated.go +++ /dev/null @@ -1,42 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You 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 v1 - -// ApisixRouteListerExpansion allows custom methods to be added to -// ApisixRouteLister. -type ApisixRouteListerExpansion interface{} - -// ApisixRouteNamespaceListerExpansion allows custom methods to be added to -// ApisixRouteNamespaceLister. -type ApisixRouteNamespaceListerExpansion interface{} - -// ApisixTlsListerExpansion allows custom methods to be added to -// ApisixTlsLister. -type ApisixTlsListerExpansion interface{} - -// ApisixTlsNamespaceListerExpansion allows custom methods to be added to -// ApisixTlsNamespaceLister. -type ApisixTlsNamespaceListerExpansion interface{} - -// ApisixUpstreamListerExpansion allows custom methods to be added to -// ApisixUpstreamLister. -type ApisixUpstreamListerExpansion interface{} - -// ApisixUpstreamNamespaceListerExpansion allows custom methods to be added to -// ApisixUpstreamNamespaceLister. -type ApisixUpstreamNamespaceListerExpansion interface{}