Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NETOBSERV: 1374 Make enums pascal case #511

Merged
merged 2 commits into from Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions api/v1alpha1/flowcollector_types.go
Expand Up @@ -76,6 +76,7 @@ type FlowCollectorSpec struct {

// exporters defines additional optional exporters for custom consumption or storage. This is an experimental feature. Currently, only KAFKA exporter is available.
// +optional
// +k8s:conversion-gen=false
Exporters []*FlowCollectorExporter `json:"exporters"`
}

Expand Down
153 changes: 147 additions & 6 deletions api/v1alpha1/flowcollector_webhook.go
Expand Up @@ -138,7 +138,7 @@ func Convert_v1beta2_FlowCollectorLoki_To_v1alpha1_FlowCollectorLoki(in *v1beta2
out.QuerierURL = manual.QuerierURL
out.StatusURL = manual.StatusURL
out.TenantID = manual.TenantID
out.AuthToken = manual.AuthToken
out.AuthToken = utilconversion.PascalToUpper(string(manual.AuthToken), '_')
if err := Convert_v1beta2_ClientTLS_To_v1alpha1_ClientTLS(&manual.TLS, &out.TLS, nil); err != nil {
return fmt.Errorf("copying v1beta2.Loki.TLS into v1alpha1.Loki.TLS: %w", err)
}
Expand All @@ -155,7 +155,7 @@ func Convert_v1alpha1_FlowCollectorLoki_To_v1beta2_FlowCollectorLoki(in *FlowCol
QuerierURL: in.QuerierURL,
StatusURL: in.StatusURL,
TenantID: in.TenantID,
AuthToken: in.AuthToken,
AuthToken: v1beta2.LokiAuthToken(utilconversion.UpperToPascal(in.AuthToken)),
}
// fallback on ingester url if querier is not set
if len(out.Manual.QuerierURL) == 0 {
Expand All @@ -181,11 +181,152 @@ func Convert_v1beta2_FlowCollectorEBPF_To_v1alpha1_FlowCollectorEBPF(in *v1beta2
return autoConvert_v1beta2_FlowCollectorEBPF_To_v1alpha1_FlowCollectorEBPF(in, out, s)
}

// // This function need to be manually created because conversion-gen not able to create it intentionally because
// // we have new defined fields in v1beta2 not in v1alpha1
// // nolint:golint,stylecheck,revive
// This function need to be manually created because conversion-gen not able to create it intentionally because
// we have camel case enum in v1beta2 which were uppercase in v1alpha1
// nolint:golint,stylecheck,revive
func Convert_v1alpha1_FlowCollectorSpec_To_v1beta2_FlowCollectorSpec(in *FlowCollectorSpec, out *v1beta2.FlowCollectorSpec, s apiconversion.Scope) error {
if err := autoConvert_v1alpha1_FlowCollectorSpec_To_v1beta2_FlowCollectorSpec(in, out, s); err != nil {
return err
}
out.DeploymentModel = v1beta2.FlowCollectorDeploymentModel(utilconversion.UpperToPascal(in.DeploymentModel))
out.Exporters = []*v1beta2.FlowCollectorExporter{}
for _, inExporter := range in.Exporters {
outExporter := &v1beta2.FlowCollectorExporter{}
if err := Convert_v1alpha1_FlowCollectorExporter_To_v1beta2_FlowCollectorExporter(inExporter, outExporter, s); err != nil {
return err
}
out.Exporters = append(out.Exporters, outExporter)
}
return nil
}

// This function need to be manually created because conversion-gen not able to create it intentionally because
// we have camel case enum in v1beta2 which were uppercase in v1alpha1
// nolint:golint,stylecheck,revive
func Convert_v1beta2_FlowCollectorSpec_To_v1alpha1_FlowCollectorSpec(in *v1beta2.FlowCollectorSpec, out *FlowCollectorSpec, s apiconversion.Scope) error {
if err := autoConvert_v1beta2_FlowCollectorSpec_To_v1alpha1_FlowCollectorSpec(in, out, s); err != nil {
return err
}
out.DeploymentModel = utilconversion.PascalToUpper(string(in.DeploymentModel), '_')
out.Exporters = []*FlowCollectorExporter{}
for _, inExporter := range in.Exporters {
outExporter := &FlowCollectorExporter{}
if err := Convert_v1beta2_FlowCollectorExporter_To_v1alpha1_FlowCollectorExporter(inExporter, outExporter, s); err != nil {
return err
}
out.Exporters = append(out.Exporters, outExporter)
}
return nil
}

// This function need to be manually created because conversion-gen not able to create it intentionally because
// we have camel case enum in v1beta2 which were uppercase in v1alpha1
// nolint:golint,stylecheck,revive
func Convert_v1alpha1_FlowCollectorAgent_To_v1beta2_FlowCollectorAgent(in *FlowCollectorAgent, out *v1beta2.FlowCollectorAgent, s apiconversion.Scope) error {
if err := autoConvert_v1alpha1_FlowCollectorAgent_To_v1beta2_FlowCollectorAgent(in, out, s); err != nil {
return err
}
out.Type = v1beta2.FlowCollectorAgentType(utilconversion.UpperToPascal(in.Type))
return nil
}

// This function need to be manually created because conversion-gen not able to create it intentionally because
// we have camel case enum in v1beta2 which were uppercase in v1alpha1
// nolint:golint,stylecheck,revive
func Convert_v1beta2_FlowCollectorAgent_To_v1alpha1_FlowCollectorAgent(in *v1beta2.FlowCollectorAgent, out *FlowCollectorAgent, s apiconversion.Scope) error {
if err := autoConvert_v1beta2_FlowCollectorAgent_To_v1alpha1_FlowCollectorAgent(in, out, s); err != nil {
return err
}
out.Type = utilconversion.PascalToUpper(string(in.Type), '_')
return nil
}

// This function need to be manually created because conversion-gen not able to create it intentionally because
// we have camel case enum in v1beta2 which were uppercase in v1alpha1
// nolint:golint,stylecheck,revive
func Convert_v1alpha1_ServerTLS_To_v1beta2_ServerTLS(in *ServerTLS, out *v1beta2.ServerTLS, s apiconversion.Scope) error {
if err := autoConvert_v1alpha1_ServerTLS_To_v1beta2_ServerTLS(in, out, s); err != nil {
return err
}
out.Type = v1beta2.ServerTLSConfigType(utilconversion.UpperToPascal(string(in.Type)))
return nil
}

// This function need to be manually created because conversion-gen not able to create it intentionally because
// we have camel case enum in v1beta2 which were uppercase in v1alpha1
// nolint:golint,stylecheck,revive
func Convert_v1beta2_ServerTLS_To_v1alpha1_ServerTLS(in *v1beta2.ServerTLS, out *ServerTLS, s apiconversion.Scope) error {
return autoConvert_v1beta2_ServerTLS_To_v1alpha1_ServerTLS(in, out, s)
if err := autoConvert_v1beta2_ServerTLS_To_v1alpha1_ServerTLS(in, out, s); err != nil {
return err
}
out.Type = ServerTLSConfigType(utilconversion.PascalToUpper(string(in.Type), '_'))
return nil
}

// This function need to be manually created because conversion-gen not able to create it intentionally because
// we have camel case enum in v1beta2 which were uppercase in v1alpha1
// nolint:golint,stylecheck,revive
func Convert_v1alpha1_FlowCollectorHPA_To_v1beta2_FlowCollectorHPA(in *FlowCollectorHPA, out *v1beta2.FlowCollectorHPA, s apiconversion.Scope) error {
if err := autoConvert_v1alpha1_FlowCollectorHPA_To_v1beta2_FlowCollectorHPA(in, out, s); err != nil {
return err
}
out.Status = v1beta2.HPAStatus(utilconversion.UpperToPascal(in.Status))
return nil
}

// This function need to be manually created because conversion-gen not able to create it intentionally because
// we have camel case enum in v1beta2 which were uppercase in v1alpha1
// nolint:golint,stylecheck,revive
func Convert_v1beta2_FlowCollectorHPA_To_v1alpha1_FlowCollectorHPA(in *v1beta2.FlowCollectorHPA, out *FlowCollectorHPA, s apiconversion.Scope) error {
if err := autoConvert_v1beta2_FlowCollectorHPA_To_v1alpha1_FlowCollectorHPA(in, out, s); err != nil {
return err
}
out.Status = utilconversion.PascalToUpper(string(in.Status), '_')
return nil
}

// This function need to be manually created because conversion-gen not able to create it intentionally because
// we have camel case enum in v1beta2 which were uppercase in v1alpha1
// nolint:golint,stylecheck,revive
func Convert_v1alpha1_SASLConfig_To_v1beta2_SASLConfig(in *SASLConfig, out *v1beta2.SASLConfig, s apiconversion.Scope) error {
if err := autoConvert_v1alpha1_SASLConfig_To_v1beta2_SASLConfig(in, out, s); err != nil {
return err
}
out.Type = v1beta2.SASLType(utilconversion.UpperToPascal(string(in.Type)))
return nil
}

// This function need to be manually created because conversion-gen not able to create it intentionally because
// we have camel case enum in v1beta2 which were uppercase in v1alpha1
// nolint:golint,stylecheck,revive
func Convert_v1beta2_SASLConfig_To_v1alpha1_SASLConfig(in *v1beta2.SASLConfig, out *SASLConfig, s apiconversion.Scope) error {
if err := autoConvert_v1beta2_SASLConfig_To_v1alpha1_SASLConfig(in, out, s); err != nil {
return err
}
out.Type = SASLType(utilconversion.PascalToUpper(string(in.Type), '_'))
return nil
}

// This function need to be manually created because conversion-gen not able to create it intentionally because
// we have camel case enum in v1beta2 which were uppercase in v1alpha1
// nolint:golint,stylecheck,revive
func Convert_v1alpha1_FlowCollectorExporter_To_v1beta2_FlowCollectorExporter(in *FlowCollectorExporter, out *v1beta2.FlowCollectorExporter, s apiconversion.Scope) error {
if err := autoConvert_v1alpha1_FlowCollectorExporter_To_v1beta2_FlowCollectorExporter(in, out, s); err != nil {
return err
}
out.Type = v1beta2.ExporterType(utilconversion.UpperToPascal(string(in.Type)))
return nil
}

// This function need to be manually created because conversion-gen not able to create it intentionally because
// we have camel case enum in v1beta2 which were uppercase in v1alpha1
// nolint:golint,stylecheck,revive
func Convert_v1beta2_FlowCollectorExporter_To_v1alpha1_FlowCollectorExporter(in *v1beta2.FlowCollectorExporter, out *FlowCollectorExporter, s apiconversion.Scope) error {
if err := autoConvert_v1beta2_FlowCollectorExporter_To_v1alpha1_FlowCollectorExporter(in, out, s); err != nil {
return err
}
out.Type = ExporterType(utilconversion.PascalToUpper(string(in.Type), '_'))
return nil
}

// This function need to be manually created because conversion-gen not able to create it intentionally because
Expand Down