From e4f7c5ace77880770da34eb515e6f45ec15b1612 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Wed, 29 Jan 2025 18:06:37 +0200 Subject: [PATCH] fix: pr requested changes --- CHANGELOG.md | 2 +- ionoscloud/data_source_dbaas_mongo_cluster.go | 4 ++-- ionoscloud/data_source_dbaas_mongo_user.go | 4 ++-- services/dbaas/cluster.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 256d5628d..6432f8823 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ ## 6.7.1 (future release) -### Changes +### Refactor - Use SDK Bundle instead of the Mongo SDK ## 6.7.0 diff --git a/ionoscloud/data_source_dbaas_mongo_cluster.go b/ionoscloud/data_source_dbaas_mongo_cluster.go index 77a4752e6..706f2bd92 100644 --- a/ionoscloud/data_source_dbaas_mongo_cluster.go +++ b/ionoscloud/data_source_dbaas_mongo_cluster.go @@ -281,7 +281,7 @@ func dataSourceDbaasMongoReadCluster(ctx context.Context, d *schema.ResourceData var results []mongo.ClusterResponse - if clusters.Items != nil && len(clusters.Items) > 0 { + if len(clusters.Items) > 0 { for _, clusterItem := range clusters.Items { if clusterItem.Properties != nil && clusterItem.Properties.DisplayName != nil && strings.EqualFold(*clusterItem.Properties.DisplayName, name.(string)) { results = append(results, clusterItem) @@ -289,7 +289,7 @@ func dataSourceDbaasMongoReadCluster(ctx context.Context, d *schema.ResourceData } } - if results == nil || len(results) == 0 { + if len(results) == 0 { return diag.FromErr(fmt.Errorf("no DBaaS mongo cluster found with the specified name = %s", name)) } else if len(results) > 1 { return diag.FromErr(fmt.Errorf("more than one DBaaS mongo cluster found with the specified criteria name = %s", name)) diff --git a/ionoscloud/data_source_dbaas_mongo_user.go b/ionoscloud/data_source_dbaas_mongo_user.go index 7213e6f67..ad76f960e 100644 --- a/ionoscloud/data_source_dbaas_mongo_user.go +++ b/ionoscloud/data_source_dbaas_mongo_user.go @@ -94,7 +94,7 @@ func dataSourceDbaasMongoReadUser(ctx context.Context, d *schema.ResourceData, m var results []mongo.User - if users.Items != nil && len(users.Items) > 0 { + if len(users.Items) > 0 { for _, userItem := range users.Items { if userItem.Properties != nil && strings.EqualFold(userItem.Properties.Username, username) { results = append(results, userItem) @@ -102,7 +102,7 @@ func dataSourceDbaasMongoReadUser(ctx context.Context, d *schema.ResourceData, m } } - if results == nil || len(results) == 0 { + if len(results) == 0 { return diag.FromErr(fmt.Errorf("no DBaaS mongo user found with the specified username = %s and cluster_id = %s", username, clusterId)) } else if len(results) > 1 { return diag.FromErr(fmt.Errorf("more than one DBaaS mongo user found with the specified criteria username = %s and cluster_id = %s", username, clusterId)) diff --git a/services/dbaas/cluster.go b/services/dbaas/cluster.go index a8d545eb1..72b641709 100644 --- a/services/dbaas/cluster.go +++ b/services/dbaas/cluster.go @@ -876,7 +876,7 @@ func SetMongoDBClusterData(d *schema.ResourceData, cluster mongo.ClusterResponse return utils.GenerateSetError(resourceName, "instances", err) } } - if cluster.Properties.Connections != nil && len(cluster.Properties.Connections) > 0 { + if len(cluster.Properties.Connections) > 0 { var connections []interface{} for _, connection := range cluster.Properties.Connections { connectionEntry := SetMongoConnectionProperties(connection)