@@ -19,14 +19,16 @@ package provider
1919
2020import (
2121 "context"
22+ powerscale "dell/powerscale-go-client"
2223 "fmt"
23- "github.com/hashicorp/terraform-plugin-framework/datasource"
24- "github.com/hashicorp/terraform-plugin-framework/types"
2524 "terraform-provider-powerscale/client"
2625 "terraform-provider-powerscale/powerscale/constants"
2726 "terraform-provider-powerscale/powerscale/helper"
2827 "terraform-provider-powerscale/powerscale/models"
2928
29+ "github.com/hashicorp/terraform-plugin-framework/datasource"
30+ "github.com/hashicorp/terraform-plugin-framework/types"
31+
3032 "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
3133 "github.com/hashicorp/terraform-plugin-log/tflog"
3234)
@@ -156,7 +158,23 @@ func (d *ClusterEmailDataSource) Read(ctx context.Context, req datasource.ReadRe
156158 return
157159 }
158160
159- clusterEmail , err := helper .GetClusterEmail (ctx , d .client )
161+ clusterVersion , err := helper .GetClusterVersion (ctx , d .client )
162+ if err != nil {
163+ errStr := constants .ReadClusterErrorMsg + "with error: "
164+ message := helper .GetErrorString (err , errStr )
165+ resp .Diagnostics .AddError (
166+ "Error reading cluster version" ,
167+ message ,
168+ )
169+ return
170+ }
171+
172+ var clusterEmail * powerscale.V1ClusterEmail
173+ if clusterVersion == "9.10.0.0" {
174+ clusterEmail , err = helper .GetV21ClusterEmail (ctx , d .client )
175+ } else {
176+ clusterEmail , err = helper .GetClusterEmail (ctx , d .client )
177+ }
160178 if err != nil {
161179 errStr := constants .ReadClusterEmailSettingsErrorMsg + "with error: "
162180 message := helper .GetErrorString (err , errStr )
0 commit comments