Skip to content

Commit

Permalink
refactor: simplify setter logic for new fields
Browse files Browse the repository at this point in the history
  • Loading branch information
EspenAlbert committed Oct 11, 2024
1 parent 3102af7 commit c38307c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions internal/service/advancedcluster/resource_advanced_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -761,15 +761,13 @@ func setRootFields(d *schema.ResourceData, cluster *admin.ClusterDescription2024
if err := d.Set("global_cluster_self_managed_sharding", cluster.GetGlobalClusterSelfManagedSharding()); err != nil {
return diag.FromErr(fmt.Errorf(ErrorClusterAdvancedSetting, "global_cluster_self_managed_sharding", clusterName, err))
}
if cluster.ConfigServerType != nil {
if err := d.Set("config_server_type", *cluster.ConfigServerType); err != nil {
return diag.FromErr(fmt.Errorf(ErrorClusterAdvancedSetting, "config_server_type", clusterName, err))
}

if err := d.Set("config_server_type", cluster.GetConfigServerType()); err != nil {
return diag.FromErr(fmt.Errorf(ErrorClusterAdvancedSetting, "config_server_type", clusterName, err))
}
if cluster.ConfigServerManagementMode != nil {
if err := d.Set("config_server_management_mode", *cluster.ConfigServerManagementMode); err != nil {
return diag.FromErr(fmt.Errorf(ErrorClusterAdvancedSetting, "config_server_management_mode", clusterName, err))
}

if err := d.Set("config_server_management_mode", cluster.GetConfigServerManagementMode()); err != nil {
return diag.FromErr(fmt.Errorf(ErrorClusterAdvancedSetting, "config_server_management_mode", clusterName, err))
}
return nil
}
Expand Down

0 comments on commit c38307c

Please sign in to comment.