Skip to content

Commit

Permalink
chore: convert ServiceGet call in serviceuser controller to generat…
Browse files Browse the repository at this point in the history
…ed client
  • Loading branch information
rriski committed Sep 5, 2024
1 parent f464c57 commit 81b510a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions controllers/serviceuser_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 81b510a

Please sign in to comment.