diff --git a/ionoscloud/data_source_dbaas_mongo_cluster.go b/ionoscloud/data_source_dbaas_mongo_cluster.go index 706f2bd92..b0c958dfb 100644 --- a/ionoscloud/data_source_dbaas_mongo_cluster.go +++ b/ionoscloud/data_source_dbaas_mongo_cluster.go @@ -289,11 +289,12 @@ func dataSourceDbaasMongoReadCluster(ctx context.Context, d *schema.ResourceData } } - if len(results) == 0 { + switch { + case len(results) == 0: return diag.FromErr(fmt.Errorf("no DBaaS mongo cluster found with the specified name = %s", name)) - } else if len(results) > 1 { + case len(results) > 1: return diag.FromErr(fmt.Errorf("more than one DBaaS mongo cluster found with the specified criteria name = %s", name)) - } else { + default: cluster = results[0] } diff --git a/ionoscloud/data_source_dbaas_mongo_user.go b/ionoscloud/data_source_dbaas_mongo_user.go index ad76f960e..0cbc4a93f 100644 --- a/ionoscloud/data_source_dbaas_mongo_user.go +++ b/ionoscloud/data_source_dbaas_mongo_user.go @@ -102,11 +102,12 @@ func dataSourceDbaasMongoReadUser(ctx context.Context, d *schema.ResourceData, m } } - if len(results) == 0 { + switch { + case 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 { + case 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)) - } else { + default: user = results[0] }