@@ -187,22 +187,22 @@ func dataSourceTencentMysqlZoneConfigRead(d *schema.ResourceData, meta interface
187187 if err != nil {
188188 return fmt .Errorf ("api[DescribeBackups]fail, return %s" , err .Error ())
189189 }
190- var regionItem * cdb.RegionSellConf
191- for _ , regionItem = range sellConfigures {
190+ var regionItem * cdb.CdbRegionSellConf
191+
192+ for _ , regionItem = range sellConfigures .Regions {
192193 if * regionItem .Region == region {
193194 break
194195 }
195196 }
196197 if regionItem == nil {
197198 return nil
198199 }
200+
199201 var zoneConfigs []interface {}
200- for _ , sellItem := range regionItem .ZonesConf {
201- if * sellItem .Status != ZONE_SELL_STATUS_ONLINE && * sellItem .Status != ZONE_SELL_STATUS_NEW {
202- continue
203- }
204- var zoneConfig = make (map [string ]interface {})
205- zoneConfig ["name" ] = * sellItem .Zone
202+ var zoneConfig = make (map [string ]interface {})
203+
204+ for _ , sellItem := range regionItem .RegionConfig {
205+ zoneConfig ["name" ] = regionItem .RegionName
206206 if sellItem .HourInstanceSaleMaxNum != nil {
207207 zoneConfig ["hour_instance_sale_max_num" ] = * sellItem .HourInstanceSaleMaxNum
208208 }
@@ -256,9 +256,8 @@ func dataSourceTencentMysqlZoneConfigRead(d *schema.ResourceData, meta interface
256256 zoneConfig ["disaster_recovery_zones" ] = disasterRecoveryZones
257257
258258 var (
259- slaveDeployModes []int
260- firstSlaveZones , secondSlaveZones , engineVersions , remoteRoZones []string
261- sells []interface {}
259+ slaveDeployModes []int
260+ firstSlaveZones , secondSlaveZones , remoteRoZones []string
262261 )
263262 if sellItem .ZoneConf != nil {
264263 for _ , mode := range sellItem .ZoneConf .DeployMode {
@@ -278,22 +277,28 @@ func dataSourceTencentMysqlZoneConfigRead(d *schema.ResourceData, meta interface
278277 zoneConfig ["first_slave_zones" ] = firstSlaveZones
279278 zoneConfig ["second_slave_zones" ] = secondSlaveZones
280279 zoneConfig ["remote_ro_zones" ] = remoteRoZones
280+ }
281281
282- for _ , mysqlConfigs := range sellItem .SellType {
283- for _ , strPtr := range mysqlConfigs .EngineVersion {
284- engineVersions = append (engineVersions , * strPtr )
285- }
286- for _ , mysqlConfig := range mysqlConfigs .Configs {
287- var showConfigMap = make (map [string ]interface {})
288- showConfigMap ["cdb_type" ] = * mysqlConfig .CdbType
289- showConfigMap ["mem_size" ] = int (* mysqlConfig .Memory )
290- showConfigMap ["max_volume_size" ] = int (* mysqlConfig .VolumeMax )
291- showConfigMap ["min_volume_size" ] = int (* mysqlConfig .VolumeMin )
292- showConfigMap ["volume_step" ] = int (* mysqlConfig .VolumeStep )
293- showConfigMap ["qps" ] = int (* mysqlConfig .Qps )
294- sells = append (sells , showConfigMap )
295- }
282+ var (
283+ engineVersions []string
284+ sells []interface {}
285+ )
286+
287+ for _ , sellItem := range sellConfigures .Configs {
288+ if * sellItem .Status != ZONE_SELL_STATUS_ONLINE {
289+ continue
296290 }
291+ engineVersions = append (engineVersions , * sellItem .EngineType )
292+
293+ var showConfigMap = make (map [string ]interface {})
294+ showConfigMap ["cdb_type" ] = * sellItem .DeviceType
295+ showConfigMap ["mem_size" ] = int (* sellItem .Memory )
296+ showConfigMap ["max_volume_size" ] = int (* sellItem .VolumeMax )
297+ showConfigMap ["min_volume_size" ] = int (* sellItem .VolumeMin )
298+ showConfigMap ["volume_step" ] = int (* sellItem .VolumeStep )
299+ showConfigMap ["qps" ] = int (* sellItem .Iops )
300+ sells = append (sells , showConfigMap )
301+
297302 zoneConfig ["engine_versions" ] = engineVersions
298303 zoneConfig ["sells" ] = sells
299304
0 commit comments