Skip to content

Commit

Permalink
fix(deps): go client string pointers update
Browse files Browse the repository at this point in the history
  • Loading branch information
byashimov committed Jul 2, 2024
1 parent 5ca8853 commit 529adae
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
10 changes: 8 additions & 2 deletions controllers/kafkaschemaregistryacl_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ func (h KafkaSchemaRegistryACLHandler) createOrUpdate(ctx context.Context, avn *

for _, v := range list {
if in.Permission == v.Permission && in.Resource == v.Resource && in.Username == v.Username {
acl.Status.ACLId = v.Id
// fixme: The ID is optional in the response.
// It must be a mistake.
// https://api.aiven.io/doc/#tag/Service:_Kafka/operation/ServiceSchemaRegistryAclAdd
if v.Id == nil {
return fmt.Errorf("received empty ID in response")
}
acl.Status.ACLId = *v.Id
break
}
}
Expand Down Expand Up @@ -111,7 +117,7 @@ func (h KafkaSchemaRegistryACLHandler) exists(ctx context.Context, avnGen avngen
}

for _, v := range list {
if v.Id == acl.Status.ACLId {
if v.Id != nil && *v.Id == acl.Status.ACLId {
return true, nil
}
}
Expand Down
12 changes: 6 additions & 6 deletions controllers/serviceintegration_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ func (h ServiceIntegrationHandler) createOrUpdate(ctx context.Context, avn *aive
ctx,
si.Spec.Project,
&serviceintegration.ServiceIntegrationCreateIn{
DestEndpointId: si.Spec.DestinationEndpointID,
DestService: si.Spec.DestinationServiceName,
DestProject: si.Spec.DestinationProjectName,
DestEndpointId: &si.Spec.DestinationEndpointID,
DestService: &si.Spec.DestinationServiceName,
DestProject: &si.Spec.DestinationProjectName,
IntegrationType: serviceintegration.IntegrationType(si.Spec.IntegrationType),
SourceEndpointId: si.Spec.SourceEndpointID,
SourceService: si.Spec.SourceServiceName,
SourceProject: si.Spec.SourceProjectName,
SourceEndpointId: &si.Spec.SourceEndpointID,
SourceService: &si.Spec.SourceServiceName,
SourceProject: &si.Spec.SourceProjectName,
UserConfig: &userConfigMap,
},
)
Expand Down
4 changes: 2 additions & 2 deletions tests/kafkschemaregistryaacl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func TestKafkaSchemaRegistryACL(t *testing.T) {

var aclAvn *kafkaschemaregistry.AclOut
for _, v := range aclListAvn {
if v.Id == acl.Status.ACLId {
if v.Id != nil && *v.Id == acl.Status.ACLId {
aclAvn = &v
break
}
Expand All @@ -146,7 +146,7 @@ func TestKafkaSchemaRegistryACL(t *testing.T) {
}

for _, v := range list {
if v.Id == acl.Status.ACLId {
if v.Id != nil && *v.Id == acl.Status.ACLId {
return nil
}
}
Expand Down

0 comments on commit 529adae

Please sign in to comment.