Skip to content

Commit

Permalink
fix: pr requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmocanu-ionos committed Jan 29, 2025
1 parent bb2a725 commit e4f7c5a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## 6.7.1 (future release)
### Changes
### Refactor
- Use SDK Bundle instead of the Mongo SDK

## 6.7.0
Expand Down
4 changes: 2 additions & 2 deletions ionoscloud/data_source_dbaas_mongo_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,15 @@ 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)
}
}
}

if results == nil || len(results) == 0 {
if len(results) == 0 {

Check failure on line 292 in ionoscloud/data_source_dbaas_mongo_cluster.go

View workflow job for this annotation

GitHub Actions / lint

ifElseChain: rewrite if-else to switch statement (gocritic)
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))
Expand Down
4 changes: 2 additions & 2 deletions ionoscloud/data_source_dbaas_mongo_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ 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)
}
}
}

if results == nil || len(results) == 0 {
if len(results) == 0 {

Check failure on line 105 in ionoscloud/data_source_dbaas_mongo_user.go

View workflow job for this annotation

GitHub Actions / lint

ifElseChain: rewrite if-else to switch statement (gocritic)
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))
Expand Down
2 changes: 1 addition & 1 deletion services/dbaas/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e4f7c5a

Please sign in to comment.