diff --git a/pkg/apis/istio/v1beta1/doc.go b/pkg/apis/istio/v1beta1/doc.go new file mode 100644 index 00000000..1130d61b --- /dev/null +++ b/pkg/apis/istio/v1beta1/doc.go @@ -0,0 +1,21 @@ +// Copyright Istio 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 kubetype-gen. DO NOT EDIT. + +// Package has auto-generated kube type wrappers for raw types. +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package +// +groupName=istio.alibabacloud.com +package v1beta1 diff --git a/pkg/apis/istio/v1beta1/register.gen.go b/pkg/apis/istio/v1beta1/register.gen.go new file mode 100644 index 00000000..f971ee25 --- /dev/null +++ b/pkg/apis/istio/v1beta1/register.gen.go @@ -0,0 +1,49 @@ +// Copyright Istio 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 kubetype-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + // Package-wide variables from generator "register". + SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +const ( + // Package-wide consts from generator "register". + GroupName = "istio.alibabacloud.com" +) + +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &TrafficLabel{}, + &TrafficLabelList{}, + ) + v1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/istio/v1beta1/types.gen.go b/pkg/apis/istio/v1beta1/types.gen.go new file mode 100644 index 00000000..9ffde7ea --- /dev/null +++ b/pkg/apis/istio/v1beta1/types.gen.go @@ -0,0 +1,68 @@ +// Copyright Istio 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 kubetype-gen. DO NOT EDIT. + +package v1beta1 + +import ( + alibabacloudv1beta1 "istio.io/api/alibabacloud/v1beta1" + v1alpha1 "istio.io/api/meta/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// `TrafficLabel` describes the configuration to apply the traffic label for specific workloads or by namespace. +// +// +// +// +type TrafficLabel struct { + v1.TypeMeta `json:",inline"` + // +optional + v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Spec defines the implementation of this definition. + // +optional + Spec alibabacloudv1beta1.TrafficLabel `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + + Status v1alpha1.IstioStatus `json:"status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TrafficLabelList is a collection of TrafficLabels. +type TrafficLabelList struct { + v1.TypeMeta `json:",inline"` + // +optional + v1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []*TrafficLabel `json:"items" protobuf:"bytes,2,rep,name=items"` +} diff --git a/pkg/apis/istio/v1beta1/zz_generated.deepcopy.gen.go b/pkg/apis/istio/v1beta1/zz_generated.deepcopy.gen.go new file mode 100644 index 00000000..22944e76 --- /dev/null +++ b/pkg/apis/istio/v1beta1/zz_generated.deepcopy.gen.go @@ -0,0 +1,89 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// Copyright Istio 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 *TrafficLabel) DeepCopyInto(out *TrafficLabel) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficLabel. +func (in *TrafficLabel) DeepCopy() *TrafficLabel { + if in == nil { + return nil + } + out := new(TrafficLabel) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TrafficLabel) 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 *TrafficLabelList) DeepCopyInto(out *TrafficLabelList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]*TrafficLabel, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(TrafficLabel) + (*in).DeepCopyInto(*out) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficLabelList. +func (in *TrafficLabelList) DeepCopy() *TrafficLabelList { + if in == nil { + return nil + } + out := new(TrafficLabelList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TrafficLabelList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/pkg/applyconfiguration/istio/v1beta1/trafficlabel.go b/pkg/applyconfiguration/istio/v1beta1/trafficlabel.go new file mode 100644 index 00000000..7d590a44 --- /dev/null +++ b/pkg/applyconfiguration/istio/v1beta1/trafficlabel.go @@ -0,0 +1,219 @@ +// Copyright Istio 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 applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "istio.io/api/alibabacloud/v1beta1" + v1alpha1 "istio.io/api/meta/v1alpha1" + v1 "istio.io/client-go/pkg/applyconfiguration/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" +) + +// TrafficLabelApplyConfiguration represents an declarative configuration of the TrafficLabel type for use +// with apply. +type TrafficLabelApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *v1beta1.TrafficLabel `json:"spec,omitempty"` + Status *v1alpha1.IstioStatus `json:"status,omitempty"` +} + +// TrafficLabel constructs an declarative configuration of the TrafficLabel type for use with +// apply. +func TrafficLabel(name, namespace string) *TrafficLabelApplyConfiguration { + b := &TrafficLabelApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("TrafficLabel") + b.WithAPIVersion("istio.alibabacloud.com/v1beta1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *TrafficLabelApplyConfiguration) WithKind(value string) *TrafficLabelApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *TrafficLabelApplyConfiguration) WithAPIVersion(value string) *TrafficLabelApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *TrafficLabelApplyConfiguration) WithName(value string) *TrafficLabelApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *TrafficLabelApplyConfiguration) WithGenerateName(value string) *TrafficLabelApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *TrafficLabelApplyConfiguration) WithNamespace(value string) *TrafficLabelApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *TrafficLabelApplyConfiguration) WithUID(value types.UID) *TrafficLabelApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *TrafficLabelApplyConfiguration) WithResourceVersion(value string) *TrafficLabelApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *TrafficLabelApplyConfiguration) WithGeneration(value int64) *TrafficLabelApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *TrafficLabelApplyConfiguration) WithCreationTimestamp(value metav1.Time) *TrafficLabelApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *TrafficLabelApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *TrafficLabelApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *TrafficLabelApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *TrafficLabelApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *TrafficLabelApplyConfiguration) WithLabels(entries map[string]string) *TrafficLabelApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *TrafficLabelApplyConfiguration) WithAnnotations(entries map[string]string) *TrafficLabelApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *TrafficLabelApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *TrafficLabelApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *TrafficLabelApplyConfiguration) WithFinalizers(values ...string) *TrafficLabelApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *TrafficLabelApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *TrafficLabelApplyConfiguration) WithSpec(value v1beta1.TrafficLabel) *TrafficLabelApplyConfiguration { + b.Spec = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *TrafficLabelApplyConfiguration) WithStatus(value v1alpha1.IstioStatus) *TrafficLabelApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/applyconfiguration/utils.go b/pkg/applyconfiguration/utils.go index c759dbab..b7efb1c6 100644 --- a/pkg/applyconfiguration/utils.go +++ b/pkg/applyconfiguration/utils.go @@ -18,14 +18,16 @@ package applyconfiguration import ( v1alpha1 "istio.io/client-go/pkg/apis/extensions/v1alpha1" + v1beta1 "istio.io/client-go/pkg/apis/istio/v1beta1" v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3" - v1beta1 "istio.io/client-go/pkg/apis/networking/v1beta1" + networkingv1beta1 "istio.io/client-go/pkg/apis/networking/v1beta1" securityv1beta1 "istio.io/client-go/pkg/apis/security/v1beta1" telemetryv1alpha1 "istio.io/client-go/pkg/apis/telemetry/v1alpha1" extensionsv1alpha1 "istio.io/client-go/pkg/applyconfiguration/extensions/v1alpha1" + istiov1beta1 "istio.io/client-go/pkg/applyconfiguration/istio/v1beta1" metav1 "istio.io/client-go/pkg/applyconfiguration/meta/v1" networkingv1alpha3 "istio.io/client-go/pkg/applyconfiguration/networking/v1alpha3" - networkingv1beta1 "istio.io/client-go/pkg/applyconfiguration/networking/v1beta1" + applyconfigurationnetworkingv1beta1 "istio.io/client-go/pkg/applyconfiguration/networking/v1beta1" applyconfigurationsecurityv1beta1 "istio.io/client-go/pkg/applyconfiguration/security/v1beta1" applyconfigurationtelemetryv1alpha1 "istio.io/client-go/pkg/applyconfiguration/telemetry/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -40,6 +42,10 @@ func ForKind(kind schema.GroupVersionKind) interface{} { case v1alpha1.SchemeGroupVersion.WithKind("WasmPlugin"): return &extensionsv1alpha1.WasmPluginApplyConfiguration{} + // Group=istio.alibabacloud.com, Version=v1beta1 + case v1beta1.SchemeGroupVersion.WithKind("TrafficLabel"): + return &istiov1beta1.TrafficLabelApplyConfiguration{} + // Group=meta.k8s.io, Version=v1 case v1.SchemeGroupVersion.WithKind("ManagedFieldsEntry"): return &metav1.ManagedFieldsEntryApplyConfiguration{} @@ -69,22 +75,22 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &networkingv1alpha3.WorkloadGroupApplyConfiguration{} // Group=networking.istio.io, Version=v1beta1 - case v1beta1.SchemeGroupVersion.WithKind("DestinationRule"): - return &networkingv1beta1.DestinationRuleApplyConfiguration{} - case v1beta1.SchemeGroupVersion.WithKind("Gateway"): - return &networkingv1beta1.GatewayApplyConfiguration{} - case v1beta1.SchemeGroupVersion.WithKind("ProxyConfig"): - return &networkingv1beta1.ProxyConfigApplyConfiguration{} - case v1beta1.SchemeGroupVersion.WithKind("ServiceEntry"): - return &networkingv1beta1.ServiceEntryApplyConfiguration{} - case v1beta1.SchemeGroupVersion.WithKind("Sidecar"): - return &networkingv1beta1.SidecarApplyConfiguration{} - case v1beta1.SchemeGroupVersion.WithKind("VirtualService"): - return &networkingv1beta1.VirtualServiceApplyConfiguration{} - case v1beta1.SchemeGroupVersion.WithKind("WorkloadEntry"): - return &networkingv1beta1.WorkloadEntryApplyConfiguration{} - case v1beta1.SchemeGroupVersion.WithKind("WorkloadGroup"): - return &networkingv1beta1.WorkloadGroupApplyConfiguration{} + case networkingv1beta1.SchemeGroupVersion.WithKind("DestinationRule"): + return &applyconfigurationnetworkingv1beta1.DestinationRuleApplyConfiguration{} + case networkingv1beta1.SchemeGroupVersion.WithKind("Gateway"): + return &applyconfigurationnetworkingv1beta1.GatewayApplyConfiguration{} + case networkingv1beta1.SchemeGroupVersion.WithKind("ProxyConfig"): + return &applyconfigurationnetworkingv1beta1.ProxyConfigApplyConfiguration{} + case networkingv1beta1.SchemeGroupVersion.WithKind("ServiceEntry"): + return &applyconfigurationnetworkingv1beta1.ServiceEntryApplyConfiguration{} + case networkingv1beta1.SchemeGroupVersion.WithKind("Sidecar"): + return &applyconfigurationnetworkingv1beta1.SidecarApplyConfiguration{} + case networkingv1beta1.SchemeGroupVersion.WithKind("VirtualService"): + return &applyconfigurationnetworkingv1beta1.VirtualServiceApplyConfiguration{} + case networkingv1beta1.SchemeGroupVersion.WithKind("WorkloadEntry"): + return &applyconfigurationnetworkingv1beta1.WorkloadEntryApplyConfiguration{} + case networkingv1beta1.SchemeGroupVersion.WithKind("WorkloadGroup"): + return &applyconfigurationnetworkingv1beta1.WorkloadGroupApplyConfiguration{} // Group=security.istio.io, Version=v1beta1 case securityv1beta1.SchemeGroupVersion.WithKind("AuthorizationPolicy"): diff --git a/pkg/clientset/versioned/clientset.gen.go b/pkg/clientset/versioned/clientset.gen.go index 374a49ab..27ee0b57 100644 --- a/pkg/clientset/versioned/clientset.gen.go +++ b/pkg/clientset/versioned/clientset.gen.go @@ -21,6 +21,7 @@ import ( "net/http" extensionsv1alpha1 "istio.io/client-go/pkg/clientset/versioned/typed/extensions/v1alpha1" + istiov1beta1 "istio.io/client-go/pkg/clientset/versioned/typed/istio/v1beta1" networkingv1alpha3 "istio.io/client-go/pkg/clientset/versioned/typed/networking/v1alpha3" networkingv1beta1 "istio.io/client-go/pkg/clientset/versioned/typed/networking/v1beta1" securityv1beta1 "istio.io/client-go/pkg/clientset/versioned/typed/security/v1beta1" @@ -33,6 +34,7 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface ExtensionsV1alpha1() extensionsv1alpha1.ExtensionsV1alpha1Interface + IstioV1beta1() istiov1beta1.IstioV1beta1Interface NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface SecurityV1beta1() securityv1beta1.SecurityV1beta1Interface @@ -43,6 +45,7 @@ type Interface interface { type Clientset struct { *discovery.DiscoveryClient extensionsV1alpha1 *extensionsv1alpha1.ExtensionsV1alpha1Client + istioV1beta1 *istiov1beta1.IstioV1beta1Client networkingV1alpha3 *networkingv1alpha3.NetworkingV1alpha3Client networkingV1beta1 *networkingv1beta1.NetworkingV1beta1Client securityV1beta1 *securityv1beta1.SecurityV1beta1Client @@ -54,6 +57,11 @@ func (c *Clientset) ExtensionsV1alpha1() extensionsv1alpha1.ExtensionsV1alpha1In return c.extensionsV1alpha1 } +// IstioV1beta1 retrieves the IstioV1beta1Client +func (c *Clientset) IstioV1beta1() istiov1beta1.IstioV1beta1Interface { + return c.istioV1beta1 +} + // NetworkingV1alpha3 retrieves the NetworkingV1alpha3Client func (c *Clientset) NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface { return c.networkingV1alpha3 @@ -122,6 +130,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.istioV1beta1, err = istiov1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.networkingV1alpha3, err = networkingv1alpha3.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -160,6 +172,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.extensionsV1alpha1 = extensionsv1alpha1.New(c) + cs.istioV1beta1 = istiov1beta1.New(c) cs.networkingV1alpha3 = networkingv1alpha3.New(c) cs.networkingV1beta1 = networkingv1beta1.New(c) cs.securityV1beta1 = securityv1beta1.New(c) diff --git a/pkg/clientset/versioned/fake/clientset_generated.gen.go b/pkg/clientset/versioned/fake/clientset_generated.gen.go index f2773652..d6884c08 100644 --- a/pkg/clientset/versioned/fake/clientset_generated.gen.go +++ b/pkg/clientset/versioned/fake/clientset_generated.gen.go @@ -20,6 +20,8 @@ import ( clientset "istio.io/client-go/pkg/clientset/versioned" extensionsv1alpha1 "istio.io/client-go/pkg/clientset/versioned/typed/extensions/v1alpha1" fakeextensionsv1alpha1 "istio.io/client-go/pkg/clientset/versioned/typed/extensions/v1alpha1/fake" + istiov1beta1 "istio.io/client-go/pkg/clientset/versioned/typed/istio/v1beta1" + fakeistiov1beta1 "istio.io/client-go/pkg/clientset/versioned/typed/istio/v1beta1/fake" networkingv1alpha3 "istio.io/client-go/pkg/clientset/versioned/typed/networking/v1alpha3" fakenetworkingv1alpha3 "istio.io/client-go/pkg/clientset/versioned/typed/networking/v1alpha3/fake" networkingv1beta1 "istio.io/client-go/pkg/clientset/versioned/typed/networking/v1beta1" @@ -90,6 +92,11 @@ func (c *Clientset) ExtensionsV1alpha1() extensionsv1alpha1.ExtensionsV1alpha1In return &fakeextensionsv1alpha1.FakeExtensionsV1alpha1{Fake: &c.Fake} } +// IstioV1beta1 retrieves the IstioV1beta1Client +func (c *Clientset) IstioV1beta1() istiov1beta1.IstioV1beta1Interface { + return &fakeistiov1beta1.FakeIstioV1beta1{Fake: &c.Fake} +} + // NetworkingV1alpha3 retrieves the NetworkingV1alpha3Client func (c *Clientset) NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface { return &fakenetworkingv1alpha3.FakeNetworkingV1alpha3{Fake: &c.Fake} diff --git a/pkg/clientset/versioned/fake/register.gen.go b/pkg/clientset/versioned/fake/register.gen.go index 7359a356..511193c6 100644 --- a/pkg/clientset/versioned/fake/register.gen.go +++ b/pkg/clientset/versioned/fake/register.gen.go @@ -18,6 +18,7 @@ package fake import ( extensionsv1alpha1 "istio.io/client-go/pkg/apis/extensions/v1alpha1" + istiov1beta1 "istio.io/client-go/pkg/apis/istio/v1beta1" networkingv1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3" networkingv1beta1 "istio.io/client-go/pkg/apis/networking/v1beta1" securityv1beta1 "istio.io/client-go/pkg/apis/security/v1beta1" @@ -34,6 +35,7 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ extensionsv1alpha1.AddToScheme, + istiov1beta1.AddToScheme, networkingv1alpha3.AddToScheme, networkingv1beta1.AddToScheme, securityv1beta1.AddToScheme, diff --git a/pkg/clientset/versioned/scheme/register.gen.go b/pkg/clientset/versioned/scheme/register.gen.go index 69cfbc0d..70430b3c 100644 --- a/pkg/clientset/versioned/scheme/register.gen.go +++ b/pkg/clientset/versioned/scheme/register.gen.go @@ -18,6 +18,7 @@ package scheme import ( extensionsv1alpha1 "istio.io/client-go/pkg/apis/extensions/v1alpha1" + istiov1beta1 "istio.io/client-go/pkg/apis/istio/v1beta1" networkingv1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3" networkingv1beta1 "istio.io/client-go/pkg/apis/networking/v1beta1" securityv1beta1 "istio.io/client-go/pkg/apis/security/v1beta1" @@ -34,6 +35,7 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ extensionsv1alpha1.AddToScheme, + istiov1beta1.AddToScheme, networkingv1alpha3.AddToScheme, networkingv1beta1.AddToScheme, securityv1beta1.AddToScheme, diff --git a/pkg/clientset/versioned/typed/istio/v1beta1/doc.go b/pkg/clientset/versioned/typed/istio/v1beta1/doc.go new file mode 100644 index 00000000..cb0d3579 --- /dev/null +++ b/pkg/clientset/versioned/typed/istio/v1beta1/doc.go @@ -0,0 +1,18 @@ +// Copyright Istio 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/clientset/versioned/typed/istio/v1beta1/fake/doc.go b/pkg/clientset/versioned/typed/istio/v1beta1/fake/doc.go new file mode 100644 index 00000000..e6cc3d6f --- /dev/null +++ b/pkg/clientset/versioned/typed/istio/v1beta1/fake/doc.go @@ -0,0 +1,18 @@ +// Copyright Istio 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/clientset/versioned/typed/istio/v1beta1/fake/fake_istio_client.gen.go b/pkg/clientset/versioned/typed/istio/v1beta1/fake/fake_istio_client.gen.go new file mode 100644 index 00000000..1c78ed49 --- /dev/null +++ b/pkg/clientset/versioned/typed/istio/v1beta1/fake/fake_istio_client.gen.go @@ -0,0 +1,38 @@ +// Copyright Istio 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 ( + v1beta1 "istio.io/client-go/pkg/clientset/versioned/typed/istio/v1beta1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeIstioV1beta1 struct { + *testing.Fake +} + +func (c *FakeIstioV1beta1) TrafficLabels(namespace string) v1beta1.TrafficLabelInterface { + return &FakeTrafficLabels{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeIstioV1beta1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clientset/versioned/typed/istio/v1beta1/fake/fake_trafficlabel.gen.go b/pkg/clientset/versioned/typed/istio/v1beta1/fake/fake_trafficlabel.gen.go new file mode 100644 index 00000000..c82fc101 --- /dev/null +++ b/pkg/clientset/versioned/typed/istio/v1beta1/fake/fake_trafficlabel.gen.go @@ -0,0 +1,188 @@ +// Copyright Istio 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" + json "encoding/json" + "fmt" + + v1beta1 "istio.io/client-go/pkg/apis/istio/v1beta1" + istiov1beta1 "istio.io/client-go/pkg/applyconfiguration/istio/v1beta1" + 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" +) + +// FakeTrafficLabels implements TrafficLabelInterface +type FakeTrafficLabels struct { + Fake *FakeIstioV1beta1 + ns string +} + +var trafficlabelsResource = schema.GroupVersionResource{Group: "istio.alibabacloud.com", Version: "v1beta1", Resource: "trafficlabels"} + +var trafficlabelsKind = schema.GroupVersionKind{Group: "istio.alibabacloud.com", Version: "v1beta1", Kind: "TrafficLabel"} + +// Get takes name of the trafficLabel, and returns the corresponding trafficLabel object, and an error if there is any. +func (c *FakeTrafficLabels) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.TrafficLabel, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(trafficlabelsResource, c.ns, name), &v1beta1.TrafficLabel{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.TrafficLabel), err +} + +// List takes label and field selectors, and returns the list of TrafficLabels that match those selectors. +func (c *FakeTrafficLabels) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.TrafficLabelList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(trafficlabelsResource, trafficlabelsKind, c.ns, opts), &v1beta1.TrafficLabelList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.TrafficLabelList{ListMeta: obj.(*v1beta1.TrafficLabelList).ListMeta} + for _, item := range obj.(*v1beta1.TrafficLabelList).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 trafficLabels. +func (c *FakeTrafficLabels) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(trafficlabelsResource, c.ns, opts)) + +} + +// Create takes the representation of a trafficLabel and creates it. Returns the server's representation of the trafficLabel, and an error, if there is any. +func (c *FakeTrafficLabels) Create(ctx context.Context, trafficLabel *v1beta1.TrafficLabel, opts v1.CreateOptions) (result *v1beta1.TrafficLabel, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(trafficlabelsResource, c.ns, trafficLabel), &v1beta1.TrafficLabel{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.TrafficLabel), err +} + +// Update takes the representation of a trafficLabel and updates it. Returns the server's representation of the trafficLabel, and an error, if there is any. +func (c *FakeTrafficLabels) Update(ctx context.Context, trafficLabel *v1beta1.TrafficLabel, opts v1.UpdateOptions) (result *v1beta1.TrafficLabel, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(trafficlabelsResource, c.ns, trafficLabel), &v1beta1.TrafficLabel{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.TrafficLabel), 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 *FakeTrafficLabels) UpdateStatus(ctx context.Context, trafficLabel *v1beta1.TrafficLabel, opts v1.UpdateOptions) (*v1beta1.TrafficLabel, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(trafficlabelsResource, "status", c.ns, trafficLabel), &v1beta1.TrafficLabel{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.TrafficLabel), err +} + +// Delete takes name of the trafficLabel and deletes it. Returns an error if one occurs. +func (c *FakeTrafficLabels) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(trafficlabelsResource, c.ns, name, opts), &v1beta1.TrafficLabel{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeTrafficLabels) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(trafficlabelsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1beta1.TrafficLabelList{}) + return err +} + +// Patch applies the patch and returns the patched trafficLabel. +func (c *FakeTrafficLabels) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.TrafficLabel, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(trafficlabelsResource, c.ns, name, pt, data, subresources...), &v1beta1.TrafficLabel{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.TrafficLabel), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied trafficLabel. +func (c *FakeTrafficLabels) Apply(ctx context.Context, trafficLabel *istiov1beta1.TrafficLabelApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.TrafficLabel, err error) { + if trafficLabel == nil { + return nil, fmt.Errorf("trafficLabel provided to Apply must not be nil") + } + data, err := json.Marshal(trafficLabel) + if err != nil { + return nil, err + } + name := trafficLabel.Name + if name == nil { + return nil, fmt.Errorf("trafficLabel.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(trafficlabelsResource, c.ns, *name, types.ApplyPatchType, data), &v1beta1.TrafficLabel{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.TrafficLabel), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeTrafficLabels) ApplyStatus(ctx context.Context, trafficLabel *istiov1beta1.TrafficLabelApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.TrafficLabel, err error) { + if trafficLabel == nil { + return nil, fmt.Errorf("trafficLabel provided to Apply must not be nil") + } + data, err := json.Marshal(trafficLabel) + if err != nil { + return nil, err + } + name := trafficLabel.Name + if name == nil { + return nil, fmt.Errorf("trafficLabel.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(trafficlabelsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1beta1.TrafficLabel{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.TrafficLabel), err +} diff --git a/pkg/clientset/versioned/typed/istio/v1beta1/generated_expansion.gen.go b/pkg/clientset/versioned/typed/istio/v1beta1/generated_expansion.gen.go new file mode 100644 index 00000000..613ec73b --- /dev/null +++ b/pkg/clientset/versioned/typed/istio/v1beta1/generated_expansion.gen.go @@ -0,0 +1,19 @@ +// Copyright Istio 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 TrafficLabelExpansion interface{} diff --git a/pkg/clientset/versioned/typed/istio/v1beta1/istio_client.gen.go b/pkg/clientset/versioned/typed/istio/v1beta1/istio_client.gen.go new file mode 100644 index 00000000..9d5823c3 --- /dev/null +++ b/pkg/clientset/versioned/typed/istio/v1beta1/istio_client.gen.go @@ -0,0 +1,105 @@ +// Copyright Istio 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 ( + "net/http" + + v1beta1 "istio.io/client-go/pkg/apis/istio/v1beta1" + "istio.io/client-go/pkg/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type IstioV1beta1Interface interface { + RESTClient() rest.Interface + TrafficLabelsGetter +} + +// IstioV1beta1Client is used to interact with features provided by the istio.alibabacloud.com group. +type IstioV1beta1Client struct { + restClient rest.Interface +} + +func (c *IstioV1beta1Client) TrafficLabels(namespace string) TrafficLabelInterface { + return newTrafficLabels(c, namespace) +} + +// NewForConfig creates a new IstioV1beta1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*IstioV1beta1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new IstioV1beta1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*IstioV1beta1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &IstioV1beta1Client{client}, nil +} + +// NewForConfigOrDie creates a new IstioV1beta1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *IstioV1beta1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new IstioV1beta1Client for the given RESTClient. +func New(c rest.Interface) *IstioV1beta1Client { + return &IstioV1beta1Client{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 *IstioV1beta1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clientset/versioned/typed/istio/v1beta1/trafficlabel.gen.go b/pkg/clientset/versioned/typed/istio/v1beta1/trafficlabel.gen.go new file mode 100644 index 00000000..fdf0e4ee --- /dev/null +++ b/pkg/clientset/versioned/typed/istio/v1beta1/trafficlabel.gen.go @@ -0,0 +1,254 @@ +// Copyright Istio 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" + json "encoding/json" + "fmt" + "time" + + v1beta1 "istio.io/client-go/pkg/apis/istio/v1beta1" + istiov1beta1 "istio.io/client-go/pkg/applyconfiguration/istio/v1beta1" + scheme "istio.io/client-go/pkg/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// TrafficLabelsGetter has a method to return a TrafficLabelInterface. +// A group's client should implement this interface. +type TrafficLabelsGetter interface { + TrafficLabels(namespace string) TrafficLabelInterface +} + +// TrafficLabelInterface has methods to work with TrafficLabel resources. +type TrafficLabelInterface interface { + Create(ctx context.Context, trafficLabel *v1beta1.TrafficLabel, opts v1.CreateOptions) (*v1beta1.TrafficLabel, error) + Update(ctx context.Context, trafficLabel *v1beta1.TrafficLabel, opts v1.UpdateOptions) (*v1beta1.TrafficLabel, error) + UpdateStatus(ctx context.Context, trafficLabel *v1beta1.TrafficLabel, opts v1.UpdateOptions) (*v1beta1.TrafficLabel, 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.TrafficLabel, error) + List(ctx context.Context, opts v1.ListOptions) (*v1beta1.TrafficLabelList, 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.TrafficLabel, err error) + Apply(ctx context.Context, trafficLabel *istiov1beta1.TrafficLabelApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.TrafficLabel, err error) + ApplyStatus(ctx context.Context, trafficLabel *istiov1beta1.TrafficLabelApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.TrafficLabel, err error) + TrafficLabelExpansion +} + +// trafficLabels implements TrafficLabelInterface +type trafficLabels struct { + client rest.Interface + ns string +} + +// newTrafficLabels returns a TrafficLabels +func newTrafficLabels(c *IstioV1beta1Client, namespace string) *trafficLabels { + return &trafficLabels{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the trafficLabel, and returns the corresponding trafficLabel object, and an error if there is any. +func (c *trafficLabels) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.TrafficLabel, err error) { + result = &v1beta1.TrafficLabel{} + err = c.client.Get(). + Namespace(c.ns). + Resource("trafficlabels"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of TrafficLabels that match those selectors. +func (c *trafficLabels) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.TrafficLabelList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta1.TrafficLabelList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("trafficlabels"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested trafficLabels. +func (c *trafficLabels) 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("trafficlabels"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a trafficLabel and creates it. Returns the server's representation of the trafficLabel, and an error, if there is any. +func (c *trafficLabels) Create(ctx context.Context, trafficLabel *v1beta1.TrafficLabel, opts v1.CreateOptions) (result *v1beta1.TrafficLabel, err error) { + result = &v1beta1.TrafficLabel{} + err = c.client.Post(). + Namespace(c.ns). + Resource("trafficlabels"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(trafficLabel). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a trafficLabel and updates it. Returns the server's representation of the trafficLabel, and an error, if there is any. +func (c *trafficLabels) Update(ctx context.Context, trafficLabel *v1beta1.TrafficLabel, opts v1.UpdateOptions) (result *v1beta1.TrafficLabel, err error) { + result = &v1beta1.TrafficLabel{} + err = c.client.Put(). + Namespace(c.ns). + Resource("trafficlabels"). + Name(trafficLabel.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(trafficLabel). + 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 *trafficLabels) UpdateStatus(ctx context.Context, trafficLabel *v1beta1.TrafficLabel, opts v1.UpdateOptions) (result *v1beta1.TrafficLabel, err error) { + result = &v1beta1.TrafficLabel{} + err = c.client.Put(). + Namespace(c.ns). + Resource("trafficlabels"). + Name(trafficLabel.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(trafficLabel). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the trafficLabel and deletes it. Returns an error if one occurs. +func (c *trafficLabels) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("trafficlabels"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *trafficLabels) 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("trafficlabels"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched trafficLabel. +func (c *trafficLabels) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.TrafficLabel, err error) { + result = &v1beta1.TrafficLabel{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("trafficlabels"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied trafficLabel. +func (c *trafficLabels) Apply(ctx context.Context, trafficLabel *istiov1beta1.TrafficLabelApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.TrafficLabel, err error) { + if trafficLabel == nil { + return nil, fmt.Errorf("trafficLabel provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(trafficLabel) + if err != nil { + return nil, err + } + name := trafficLabel.Name + if name == nil { + return nil, fmt.Errorf("trafficLabel.Name must be provided to Apply") + } + result = &v1beta1.TrafficLabel{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("trafficlabels"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *trafficLabels) ApplyStatus(ctx context.Context, trafficLabel *istiov1beta1.TrafficLabelApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.TrafficLabel, err error) { + if trafficLabel == nil { + return nil, fmt.Errorf("trafficLabel provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(trafficLabel) + if err != nil { + return nil, err + } + + name := trafficLabel.Name + if name == nil { + return nil, fmt.Errorf("trafficLabel.Name must be provided to Apply") + } + + result = &v1beta1.TrafficLabel{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("trafficlabels"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/informers/externalversions/factory.gen.go b/pkg/informers/externalversions/factory.gen.go index 1dc9e519..494a916f 100644 --- a/pkg/informers/externalversions/factory.gen.go +++ b/pkg/informers/externalversions/factory.gen.go @@ -24,6 +24,7 @@ import ( versioned "istio.io/client-go/pkg/clientset/versioned" extensions "istio.io/client-go/pkg/informers/externalversions/extensions" internalinterfaces "istio.io/client-go/pkg/informers/externalversions/internalinterfaces" + istio "istio.io/client-go/pkg/informers/externalversions/istio" networking "istio.io/client-go/pkg/informers/externalversions/networking" security "istio.io/client-go/pkg/informers/externalversions/security" telemetry "istio.io/client-go/pkg/informers/externalversions/telemetry" @@ -245,6 +246,7 @@ type SharedInformerFactory interface { InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer Extensions() extensions.Interface + Istio() istio.Interface Networking() networking.Interface Security() security.Interface Telemetry() telemetry.Interface @@ -254,6 +256,10 @@ func (f *sharedInformerFactory) Extensions() extensions.Interface { return extensions.New(f, f.namespace, f.tweakListOptions) } +func (f *sharedInformerFactory) Istio() istio.Interface { + return istio.New(f, f.namespace, f.tweakListOptions) +} + func (f *sharedInformerFactory) Networking() networking.Interface { return networking.New(f, f.namespace, f.tweakListOptions) } diff --git a/pkg/informers/externalversions/generic.gen.go b/pkg/informers/externalversions/generic.gen.go index bd4b53c7..ebb74d61 100644 --- a/pkg/informers/externalversions/generic.gen.go +++ b/pkg/informers/externalversions/generic.gen.go @@ -20,8 +20,9 @@ import ( "fmt" v1alpha1 "istio.io/client-go/pkg/apis/extensions/v1alpha1" + v1beta1 "istio.io/client-go/pkg/apis/istio/v1beta1" v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3" - v1beta1 "istio.io/client-go/pkg/apis/networking/v1beta1" + networkingv1beta1 "istio.io/client-go/pkg/apis/networking/v1beta1" securityv1beta1 "istio.io/client-go/pkg/apis/security/v1beta1" telemetryv1alpha1 "istio.io/client-go/pkg/apis/telemetry/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -58,6 +59,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1alpha1.SchemeGroupVersion.WithResource("wasmplugins"): return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1alpha1().WasmPlugins().Informer()}, nil + // Group=istio.alibabacloud.com, Version=v1beta1 + case v1beta1.SchemeGroupVersion.WithResource("trafficlabels"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Istio().V1beta1().TrafficLabels().Informer()}, nil + // Group=networking.istio.io, Version=v1alpha3 case v1alpha3.SchemeGroupVersion.WithResource("destinationrules"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().DestinationRules().Informer()}, nil @@ -77,21 +82,21 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().WorkloadGroups().Informer()}, nil // Group=networking.istio.io, Version=v1beta1 - case v1beta1.SchemeGroupVersion.WithResource("destinationrules"): + case networkingv1beta1.SchemeGroupVersion.WithResource("destinationrules"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().DestinationRules().Informer()}, nil - case v1beta1.SchemeGroupVersion.WithResource("gateways"): + case networkingv1beta1.SchemeGroupVersion.WithResource("gateways"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().Gateways().Informer()}, nil - case v1beta1.SchemeGroupVersion.WithResource("proxyconfigs"): + case networkingv1beta1.SchemeGroupVersion.WithResource("proxyconfigs"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().ProxyConfigs().Informer()}, nil - case v1beta1.SchemeGroupVersion.WithResource("serviceentries"): + case networkingv1beta1.SchemeGroupVersion.WithResource("serviceentries"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().ServiceEntries().Informer()}, nil - case v1beta1.SchemeGroupVersion.WithResource("sidecars"): + case networkingv1beta1.SchemeGroupVersion.WithResource("sidecars"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().Sidecars().Informer()}, nil - case v1beta1.SchemeGroupVersion.WithResource("virtualservices"): + case networkingv1beta1.SchemeGroupVersion.WithResource("virtualservices"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().VirtualServices().Informer()}, nil - case v1beta1.SchemeGroupVersion.WithResource("workloadentries"): + case networkingv1beta1.SchemeGroupVersion.WithResource("workloadentries"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().WorkloadEntries().Informer()}, nil - case v1beta1.SchemeGroupVersion.WithResource("workloadgroups"): + case networkingv1beta1.SchemeGroupVersion.WithResource("workloadgroups"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().WorkloadGroups().Informer()}, nil // Group=security.istio.io, Version=v1beta1 diff --git a/pkg/informers/externalversions/istio/interface.gen.go b/pkg/informers/externalversions/istio/interface.gen.go new file mode 100644 index 00000000..9578ff09 --- /dev/null +++ b/pkg/informers/externalversions/istio/interface.gen.go @@ -0,0 +1,44 @@ +// Copyright Istio 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 istio + +import ( + internalinterfaces "istio.io/client-go/pkg/informers/externalversions/internalinterfaces" + v1beta1 "istio.io/client-go/pkg/informers/externalversions/istio/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/informers/externalversions/istio/v1beta1/interface.gen.go b/pkg/informers/externalversions/istio/v1beta1/interface.gen.go new file mode 100644 index 00000000..cfbdb41b --- /dev/null +++ b/pkg/informers/externalversions/istio/v1beta1/interface.gen.go @@ -0,0 +1,43 @@ +// Copyright Istio 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 "istio.io/client-go/pkg/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // TrafficLabels returns a TrafficLabelInformer. + TrafficLabels() TrafficLabelInformer +} + +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} +} + +// TrafficLabels returns a TrafficLabelInformer. +func (v *version) TrafficLabels() TrafficLabelInformer { + return &trafficLabelInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/informers/externalversions/istio/v1beta1/trafficlabel.gen.go b/pkg/informers/externalversions/istio/v1beta1/trafficlabel.gen.go new file mode 100644 index 00000000..815f57e7 --- /dev/null +++ b/pkg/informers/externalversions/istio/v1beta1/trafficlabel.gen.go @@ -0,0 +1,88 @@ +// Copyright Istio 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" + + istiov1beta1 "istio.io/client-go/pkg/apis/istio/v1beta1" + versioned "istio.io/client-go/pkg/clientset/versioned" + internalinterfaces "istio.io/client-go/pkg/informers/externalversions/internalinterfaces" + v1beta1 "istio.io/client-go/pkg/listers/istio/v1beta1" + 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" +) + +// TrafficLabelInformer provides access to a shared informer and lister for +// TrafficLabels. +type TrafficLabelInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.TrafficLabelLister +} + +type trafficLabelInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewTrafficLabelInformer constructs a new informer for TrafficLabel 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 NewTrafficLabelInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredTrafficLabelInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredTrafficLabelInformer constructs a new informer for TrafficLabel 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 NewFilteredTrafficLabelInformer(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.IstioV1beta1().TrafficLabels(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.IstioV1beta1().TrafficLabels(namespace).Watch(context.TODO(), options) + }, + }, + &istiov1beta1.TrafficLabel{}, + resyncPeriod, + indexers, + ) +} + +func (f *trafficLabelInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredTrafficLabelInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *trafficLabelInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&istiov1beta1.TrafficLabel{}, f.defaultInformer) +} + +func (f *trafficLabelInformer) Lister() v1beta1.TrafficLabelLister { + return v1beta1.NewTrafficLabelLister(f.Informer().GetIndexer()) +} diff --git a/pkg/listers/istio/v1beta1/expansion_generated.gen.go b/pkg/listers/istio/v1beta1/expansion_generated.gen.go new file mode 100644 index 00000000..7f96d13a --- /dev/null +++ b/pkg/listers/istio/v1beta1/expansion_generated.gen.go @@ -0,0 +1,25 @@ +// Copyright Istio 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 + +// TrafficLabelListerExpansion allows custom methods to be added to +// TrafficLabelLister. +type TrafficLabelListerExpansion interface{} + +// TrafficLabelNamespaceListerExpansion allows custom methods to be added to +// TrafficLabelNamespaceLister. +type TrafficLabelNamespaceListerExpansion interface{} diff --git a/pkg/listers/istio/v1beta1/trafficlabel.gen.go b/pkg/listers/istio/v1beta1/trafficlabel.gen.go new file mode 100644 index 00000000..bdd3ffcf --- /dev/null +++ b/pkg/listers/istio/v1beta1/trafficlabel.gen.go @@ -0,0 +1,97 @@ +// Copyright Istio 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 ( + v1beta1 "istio.io/client-go/pkg/apis/istio/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// TrafficLabelLister helps list TrafficLabels. +// All objects returned here must be treated as read-only. +type TrafficLabelLister interface { + // List lists all TrafficLabels in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.TrafficLabel, err error) + // TrafficLabels returns an object that can list and get TrafficLabels. + TrafficLabels(namespace string) TrafficLabelNamespaceLister + TrafficLabelListerExpansion +} + +// trafficLabelLister implements the TrafficLabelLister interface. +type trafficLabelLister struct { + indexer cache.Indexer +} + +// NewTrafficLabelLister returns a new TrafficLabelLister. +func NewTrafficLabelLister(indexer cache.Indexer) TrafficLabelLister { + return &trafficLabelLister{indexer: indexer} +} + +// List lists all TrafficLabels in the indexer. +func (s *trafficLabelLister) List(selector labels.Selector) (ret []*v1beta1.TrafficLabel, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.TrafficLabel)) + }) + return ret, err +} + +// TrafficLabels returns an object that can list and get TrafficLabels. +func (s *trafficLabelLister) TrafficLabels(namespace string) TrafficLabelNamespaceLister { + return trafficLabelNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// TrafficLabelNamespaceLister helps list and get TrafficLabels. +// All objects returned here must be treated as read-only. +type TrafficLabelNamespaceLister interface { + // List lists all TrafficLabels in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.TrafficLabel, err error) + // Get retrieves the TrafficLabel from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.TrafficLabel, error) + TrafficLabelNamespaceListerExpansion +} + +// trafficLabelNamespaceLister implements the TrafficLabelNamespaceLister +// interface. +type trafficLabelNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all TrafficLabels in the indexer for a given namespace. +func (s trafficLabelNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.TrafficLabel, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.TrafficLabel)) + }) + return ret, err +} + +// Get retrieves the TrafficLabel from the indexer for a given namespace and name. +func (s trafficLabelNamespaceLister) Get(name string) (*v1beta1.TrafficLabel, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("trafficlabel"), name) + } + return obj.(*v1beta1.TrafficLabel), nil +}