7
7
"strings"
8
8
"time"
9
9
10
- util "github.com/alibabacloud-go/tea-utils/service"
11
-
12
10
"strconv"
13
11
14
12
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
@@ -522,16 +520,9 @@ func resourceAlicloudPolarDBClusterCreate(d *schema.ResourceData, meta interface
522
520
}
523
521
var response map [string ]interface {}
524
522
action := "CreateDBCluster"
525
- conn , err := client .NewPolarDBClient ()
526
- if err != nil {
527
- return WrapError (err )
528
- }
529
- runtime := util.RuntimeOptions {}
530
- runtime .SetAutoretry (true )
531
-
532
523
wait := incrementalWait (3 * time .Second , 3 * time .Second )
533
524
err = resource .Retry (client .GetRetryTimeout (d .Timeout (schema .TimeoutCreate )), func () * resource.RetryError {
534
- response , err = conn . DoRequest ( StringPointer ( action ), nil , StringPointer ( "POST" ), StringPointer ( "2017-08-01" ), StringPointer ( "AK" ) , nil , request , & runtime )
525
+ response , err = client . RpcPost ( "polardb" , "2017-08-01" , action , nil , request , true )
535
526
if err != nil {
536
527
if NeedRetry (err ) {
537
528
wait ()
@@ -600,11 +591,7 @@ func resourceAlicloudPolarDBClusterUpdate(d *schema.ResourceData, meta interface
600
591
return WrapError (err )
601
592
}
602
593
603
- conn , err := client .NewPolarDBClient ()
604
- if err != nil {
605
- return WrapError (err )
606
- }
607
-
594
+ var err error
608
595
payType := d .Get ("pay_type" ).(string )
609
596
if ! d .IsNewResource () && d .HasChange ("pay_type" ) {
610
597
action := "TransformDBClusterPayType"
@@ -626,7 +613,7 @@ func resourceAlicloudPolarDBClusterUpdate(d *schema.ResourceData, meta interface
626
613
627
614
wait := incrementalWait (3 * time .Second , 3 * time .Second )
628
615
err = resource .Retry (d .Timeout (schema .TimeoutUpdate ), func () * resource.RetryError {
629
- response , err := conn . DoRequest ( StringPointer ( action ), nil , StringPointer ( "POST" ), StringPointer ( "2017-08-01" ), StringPointer ( "AK" ) , nil , request , & util. RuntimeOptions {} )
616
+ response , err := client . RpcPost ( "polardb" , "2017-08-01" , action , nil , request , false )
630
617
if err != nil {
631
618
if NeedRetry (err ) {
632
619
wait ()
@@ -736,7 +723,7 @@ func resourceAlicloudPolarDBClusterUpdate(d *schema.ResourceData, meta interface
736
723
}
737
724
wait := incrementalWait (3 * time .Minute , 3 * time .Second )
738
725
err = resource .Retry (d .Timeout (schema .TimeoutUpdate ), func () * resource.RetryError {
739
- response , err := conn . DoRequest ( StringPointer ( action ), nil , StringPointer ( "POST" ), StringPointer ( "2017-08-01" ), StringPointer ( "AK" ) , nil , request , & util. RuntimeOptions {} )
726
+ response , err := client . RpcPost ( "polardb" , "2017-08-01" , action , nil , request , false )
740
727
if err != nil {
741
728
if IsExpectedErrors (err , []string {"TaskExists" }) || NeedRetry (err ) {
742
729
wait ()
@@ -924,7 +911,7 @@ func resourceAlicloudPolarDBClusterUpdate(d *schema.ResourceData, meta interface
924
911
//retry
925
912
wait := incrementalWait (3 * time .Second , 3 * time .Second )
926
913
err = resource .Retry (d .Timeout (schema .TimeoutUpdate ), func () * resource.RetryError {
927
- response , err := conn . DoRequest ( StringPointer ( action ), nil , StringPointer ( "POST" ), StringPointer ( "2017-08-01" ), StringPointer ( "AK" ) , nil , request , & util. RuntimeOptions {} )
914
+ response , err := client . RpcPost ( "polardb" , "2017-08-01" , action , nil , request , false )
928
915
if err != nil {
929
916
if NeedRetry (err ) {
930
917
wait ()
@@ -983,7 +970,7 @@ func resourceAlicloudPolarDBClusterUpdate(d *schema.ResourceData, meta interface
983
970
}
984
971
wait := incrementalWait (3 * time .Second , 3 * time .Second )
985
972
err := resource .Retry (d .Timeout (schema .TimeoutUpdate ), func () * resource.RetryError {
986
- response , err := conn . DoRequest ( StringPointer ( action ), nil , StringPointer ( "POST" ), StringPointer ( "2017-08-01" ), StringPointer ( "AK" ) , nil , request , & util. RuntimeOptions {} )
973
+ response , err := client . RpcPost ( "polardb" , "2017-08-01" , action , nil , request , false )
987
974
if err != nil {
988
975
if NeedRetry (err ) {
989
976
wait ()
@@ -1053,7 +1040,7 @@ func resourceAlicloudPolarDBClusterUpdate(d *schema.ResourceData, meta interface
1053
1040
//retry
1054
1041
wait := incrementalWait (3 * time .Second , 3 * time .Second )
1055
1042
err = resource .Retry (d .Timeout (schema .TimeoutUpdate ), func () * resource.RetryError {
1056
- response , err := conn . DoRequest ( StringPointer ( action ), nil , StringPointer ( "POST" ), StringPointer ( "2017-08-01" ), StringPointer ( "AK" ) , nil , request , & util. RuntimeOptions {} )
1043
+ response , err := client . RpcPost ( "polardb" , "2017-08-01" , action , nil , request , false )
1057
1044
if err != nil {
1058
1045
if NeedRetry (err ) {
1059
1046
wait ()
@@ -1095,7 +1082,7 @@ func resourceAlicloudPolarDBClusterUpdate(d *schema.ResourceData, meta interface
1095
1082
//retry
1096
1083
wait := incrementalWait (3 * time .Second , 3 * time .Second )
1097
1084
err = resource .Retry (d .Timeout (schema .TimeoutUpdate ), func () * resource.RetryError {
1098
- response , err := conn . DoRequest ( StringPointer ( action ), nil , StringPointer ( "POST" ), StringPointer ( "2017-08-01" ), StringPointer ( "AK" ) , nil , request , & util. RuntimeOptions {} )
1085
+ response , err := client . RpcPost ( "polardb" , "2017-08-01" , action , nil , request , false )
1099
1086
if err != nil {
1100
1087
if NeedRetry (err ) {
1101
1088
wait ()
@@ -1127,7 +1114,7 @@ func resourceAlicloudPolarDBClusterUpdate(d *schema.ResourceData, meta interface
1127
1114
}
1128
1115
wait := incrementalWait (3 * time .Second , 3 * time .Second )
1129
1116
err := resource .Retry (d .Timeout (schema .TimeoutUpdate ), func () * resource.RetryError {
1130
- response , err := conn . DoRequest ( StringPointer ( action ), nil , StringPointer ( "POST" ), StringPointer ( "2017-08-01" ), StringPointer ( "AK" ) , nil , request , & util. RuntimeOptions {} )
1117
+ response , err := client . RpcPost ( "polardb" , "2017-08-01" , action , nil , request , false )
1131
1118
if err != nil {
1132
1119
if NeedRetry (err ) {
1133
1120
wait ()
@@ -1264,7 +1251,7 @@ func resourceAlicloudPolarDBClusterUpdate(d *schema.ResourceData, meta interface
1264
1251
//retry
1265
1252
wait := incrementalWait (3 * time .Second , 3 * time .Second )
1266
1253
err = resource .Retry (d .Timeout (schema .TimeoutUpdate ), func () * resource.RetryError {
1267
- response , err := conn . DoRequest ( StringPointer ( action ), nil , StringPointer ( "POST" ), StringPointer ( "2017-08-01" ), StringPointer ( "AK" ) , nil , request , & util. RuntimeOptions {} )
1254
+ response , err := client . RpcPost ( "polardb" , "2017-08-01" , action , nil , request , false )
1268
1255
if err != nil {
1269
1256
if NeedRetry (err ) {
1270
1257
wait ()
@@ -1309,7 +1296,7 @@ func resourceAlicloudPolarDBClusterUpdate(d *schema.ResourceData, meta interface
1309
1296
}
1310
1297
wait := incrementalWait (3 * time .Second , 3 * time .Second )
1311
1298
err := resource .Retry (d .Timeout (schema .TimeoutUpdate ), func () * resource.RetryError {
1312
- response , err := conn . DoRequest ( StringPointer ( action ), nil , StringPointer ( "POST" ), StringPointer ( "2017-08-01" ), StringPointer ( "AK" ) , nil , request , & util. RuntimeOptions {} )
1299
+ response , err := client . RpcPost ( "polardb" , "2017-08-01" , action , nil , request , false )
1313
1300
if err != nil {
1314
1301
if NeedRetry (err ) {
1315
1302
wait ()
@@ -1358,7 +1345,7 @@ func resourceAlicloudPolarDBClusterUpdate(d *schema.ResourceData, meta interface
1358
1345
//retry
1359
1346
wait := incrementalWait (3 * time .Second , 3 * time .Second )
1360
1347
err = resource .Retry (d .Timeout (schema .TimeoutUpdate ), func () * resource.RetryError {
1361
- response , err := conn . DoRequest ( StringPointer ( action ), nil , StringPointer ( "POST" ), StringPointer ( "2017-08-01" ), StringPointer ( "AK" ) , nil , request , & util. RuntimeOptions {} )
1348
+ response , err := client . RpcPost ( "polardb" , "2017-08-01" , action , nil , request , false )
1362
1349
if err != nil {
1363
1350
if NeedRetry (err ) {
1364
1351
wait ()
0 commit comments