From 0e9838ef8aa9ad38fa5635b58ee4aac391178865 Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 14 Jul 2023 13:01:20 +0200 Subject: [PATCH] fix: more type fixes for inputs Signed-off-by: David van der Spek --- .../v1alpha1/loki_limit_types.go | 2 -- api/observability/v1alpha1/prom_types.go | 15 ++++++++ .../v1alpha1/zz_generated.deepcopy.go | 35 ------------------- 3 files changed, 15 insertions(+), 37 deletions(-) diff --git a/api/observability/v1alpha1/loki_limit_types.go b/api/observability/v1alpha1/loki_limit_types.go index c35f116..28b06c3 100644 --- a/api/observability/v1alpha1/loki_limit_types.go +++ b/api/observability/v1alpha1/loki_limit_types.go @@ -287,8 +287,6 @@ func (t *BlockedQueryTypes) UnmarshalYAML(unmarshal func(interface{}) error) err return nil } -type BlockedQueryInput BlockedQuery - type RulerAlertManagerConfig struct { // URL of the Alertmanager to send notifications to. AlertmanagerURL string `yaml:"alertmanager_url,omitempty" json:"alertmanager_url,omitempty"` diff --git a/api/observability/v1alpha1/prom_types.go b/api/observability/v1alpha1/prom_types.go index 1f671e3..1b6280a 100644 --- a/api/observability/v1alpha1/prom_types.go +++ b/api/observability/v1alpha1/prom_types.go @@ -181,6 +181,21 @@ type ProxyConfig struct { // +kubebuilder:validation:Pattern:="^[a-zA-Z_][a-zA-Z0-9_]*$" type LabelName string +// UnmarshalGQL implements the graphql.Unmarshaler interface +func (l *LabelName) UnmarshalGQL(v interface{}) error { + label, ok := v.(string) + if !ok { + return fmt.Errorf("LabelName must be a string") + } + *l = LabelName(label) + return nil +} + +// MarshalGQL implements the graphql.Marshaler interface +func (l LabelName) MarshalGQL(w io.Writer) { + w.Write([]byte(l)) +} + type RelabelConfig struct { // A list of labels from which values are taken and concatenated // with the configured separator in order. diff --git a/api/observability/v1alpha1/zz_generated.deepcopy.go b/api/observability/v1alpha1/zz_generated.deepcopy.go index 22f397d..4787471 100644 --- a/api/observability/v1alpha1/zz_generated.deepcopy.go +++ b/api/observability/v1alpha1/zz_generated.deepcopy.go @@ -63,41 +63,6 @@ func (in *BlockedQuery) DeepCopy() *BlockedQuery { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BlockedQueryInput) DeepCopyInto(out *BlockedQueryInput) { - *out = *in - if in.Pattern != nil { - in, out := &in.Pattern, &out.Pattern - *out = new(string) - **out = **in - } - if in.Regex != nil { - in, out := &in.Regex, &out.Regex - *out = new(bool) - **out = **in - } - if in.Hash != nil { - in, out := &in.Hash, &out.Hash - *out = new(uint32) - **out = **in - } - if in.Types != nil { - in, out := &in.Types, &out.Types - *out = make(BlockedQueryTypes, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockedQueryInput. -func (in *BlockedQueryInput) DeepCopy() *BlockedQueryInput { - if in == nil { - return nil - } - out := new(BlockedQueryInput) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in BlockedQueryTypes) DeepCopyInto(out *BlockedQueryTypes) { {