From bfccce34e5a5297040761416cafc7afc17df5791 Mon Sep 17 00:00:00 2001 From: dd di cesare Date: Tue, 7 Jun 2022 16:33:45 +0200 Subject: [PATCH] [api] Adding LimitadorRef to RateLimit * Created NamespacedName type just to add serialization details --- api/v1alpha1/ratelimit_types.go | 7 +++++++ api/v1alpha1/zz_generated.deepcopy.go | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/api/v1alpha1/ratelimit_types.go b/api/v1alpha1/ratelimit_types.go index d50b669d..64a43939 100644 --- a/api/v1alpha1/ratelimit_types.go +++ b/api/v1alpha1/ratelimit_types.go @@ -33,6 +33,8 @@ type RateLimitSpec struct { Namespace string `json:"namespace"` Seconds int `json:"seconds"` Variables []string `json:"variables"` + // +optional + LimitadorRef NamespacedName `json:"limitador-ref,omitempty"` } // RateLimitStatus defines the observed state of RateLimit @@ -62,6 +64,11 @@ type RateLimitList struct { Items []RateLimit `json:"items"` } +type NamespacedName struct { + Namespace string `json:"namespace,omitempty"` + Name string `json:"name,omitempty"` +} + func init() { SchemeBuilder.Register(&RateLimit{}, &RateLimitList{}) } diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 230956ab..40ad02a4 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -125,6 +125,21 @@ func (in *LimitadorStatus) DeepCopy() *LimitadorStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NamespacedName) DeepCopyInto(out *NamespacedName) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespacedName. +func (in *NamespacedName) DeepCopy() *NamespacedName { + if in == nil { + return nil + } + out := new(NamespacedName) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Ports) DeepCopyInto(out *Ports) { *out = *in @@ -222,6 +237,7 @@ func (in *RateLimitSpec) DeepCopyInto(out *RateLimitSpec) { *out = make([]string, len(*in)) copy(*out, *in) } + out.LimitadorRef = in.LimitadorRef } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RateLimitSpec.