From d3b78597b0f027fc982c0f25b9506f76a737c113 Mon Sep 17 00:00:00 2001 From: Timo Riski Date: Wed, 4 Sep 2024 16:01:30 +0300 Subject: [PATCH] chore: convert `ServiceGet` call in serviceuser controller to generated client --- controllers/serviceuser_controller.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/controllers/serviceuser_controller.go b/controllers/serviceuser_controller.go index d378cad9..08429b7a 100644 --- a/controllers/serviceuser_controller.go +++ b/controllers/serviceuser_controller.go @@ -9,6 +9,7 @@ import ( "github.com/aiven/aiven-go-client/v2" avngen "github.com/aiven/go-client-codegen" + "github.com/aiven/go-client-codegen/handler/service" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -102,21 +103,21 @@ func (h ServiceUserHandler) get(ctx context.Context, avn *aiven.Client, avnGen a return nil, err } - s, err := avn.Services.Get(ctx, user.Spec.Project, user.Spec.ServiceName) + s, err := avnGen.ServiceGet(ctx, user.Spec.Project, user.Spec.ServiceName) if err != nil { return nil, err } - var component *aiven.ServiceComponents + var component *service.ComponentOut for _, c := range s.Components { - if c.Component == s.Type { - component = c + if c.Component == s.ServiceType { + component = &c break } } if component == nil { - return nil, fmt.Errorf("service component %q not found", s.Type) + return nil, fmt.Errorf("service component %q not found", s.ServiceType) } caCert, err := avn.CA.Get(ctx, user.Spec.Project)