diff --git a/alicloud/data_source_alicloud_ga_accelerator_spare_ip_attachments.go b/alicloud/data_source_alicloud_ga_accelerator_spare_ip_attachments.go index 1c6d541e22ef..ab0e5dacc2e4 100644 --- a/alicloud/data_source_alicloud_ga_accelerator_spare_ip_attachments.go +++ b/alicloud/data_source_alicloud_ga_accelerator_spare_ip_attachments.go @@ -86,15 +86,12 @@ func dataSourceAlicloudGaAcceleratorSpareIpAttachmentsRead(d *schema.ResourceDat } status, statusOk := d.GetOk("status") var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/data_source_alicloud_ga_accelerators.go b/alicloud/data_source_alicloud_ga_accelerators.go index f21f35ed5154..8b640972d42e 100644 --- a/alicloud/data_source_alicloud_ga_accelerators.go +++ b/alicloud/data_source_alicloud_ga_accelerators.go @@ -175,14 +175,11 @@ func dataSourceAlicloudGaAcceleratorsRead(d *schema.ResourceData, meta interface status, statusOk := d.GetOk("status") bandwidthBillingType, BandwidthBillingTypeOk := d.GetOk("bandwidth_billing_type") var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ga_accelerators", action, AlibabaCloudSdkGoERROR) } diff --git a/alicloud/data_source_alicloud_ga_acls.go b/alicloud/data_source_alicloud_ga_acls.go index 035419483123..9780a8591733 100644 --- a/alicloud/data_source_alicloud_ga_acls.go +++ b/alicloud/data_source_alicloud_ga_acls.go @@ -134,16 +134,13 @@ func dataSourceAlicloudGaAclsRead(d *schema.ResourceData, meta interface{}) erro } status, statusOk := d.GetOk("status") var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/data_source_alicloud_ga_additional_certificates.go b/alicloud/data_source_alicloud_ga_additional_certificates.go index 4eb93686ee0d..eaffff6d2d91 100644 --- a/alicloud/data_source_alicloud_ga_additional_certificates.go +++ b/alicloud/data_source_alicloud_ga_additional_certificates.go @@ -90,16 +90,13 @@ func dataSourceAlicloudGaAdditionalCertificatesRead(d *schema.ResourceData, meta } } var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/data_source_alicloud_ga_bandwidth_packages.go b/alicloud/data_source_alicloud_ga_bandwidth_packages.go index ae46f17fff27..7df7cba4fc31 100644 --- a/alicloud/data_source_alicloud_ga_bandwidth_packages.go +++ b/alicloud/data_source_alicloud_ga_bandwidth_packages.go @@ -149,14 +149,11 @@ func dataSourceAlicloudGaBandwidthPackagesRead(d *schema.ResourceData, meta inte } status, statusOk := d.GetOk("status") var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ga_bandwidth_packages", action, AlibabaCloudSdkGoERROR) } diff --git a/alicloud/data_source_alicloud_ga_basic_accelerate_ip_endpoint_relations.go b/alicloud/data_source_alicloud_ga_basic_accelerate_ip_endpoint_relations.go index 5e2982a8fbbf..c57022a08d82 100644 --- a/alicloud/data_source_alicloud_ga_basic_accelerate_ip_endpoint_relations.go +++ b/alicloud/data_source_alicloud_ga_basic_accelerate_ip_endpoint_relations.go @@ -139,17 +139,14 @@ func dataSourceAlicloudGaBasicAccelerateIpEndpointRelationsRead(d *schema.Resour } var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/data_source_alicloud_ga_basic_accelerate_ips.go b/alicloud/data_source_alicloud_ga_basic_accelerate_ips.go index 3bca28e4cdc7..25fff75366db 100644 --- a/alicloud/data_source_alicloud_ga_basic_accelerate_ips.go +++ b/alicloud/data_source_alicloud_ga_basic_accelerate_ips.go @@ -115,17 +115,14 @@ func dataSourceAlicloudGaBasicAccelerateIpsRead(d *schema.ResourceData, meta int } var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/data_source_alicloud_ga_basic_accelerators.go b/alicloud/data_source_alicloud_ga_basic_accelerators.go index d24c11c15fb1..a7aad3b3e170 100644 --- a/alicloud/data_source_alicloud_ga_basic_accelerators.go +++ b/alicloud/data_source_alicloud_ga_basic_accelerators.go @@ -192,16 +192,13 @@ func dataSourceAlicloudGaBasicAcceleratorsRead(d *schema.ResourceData, meta inte } var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/data_source_alicloud_ga_basic_endpoints.go b/alicloud/data_source_alicloud_ga_basic_endpoints.go index 1577a9331500..31e671afb4b5 100644 --- a/alicloud/data_source_alicloud_ga_basic_endpoints.go +++ b/alicloud/data_source_alicloud_ga_basic_endpoints.go @@ -166,17 +166,14 @@ func dataSourceAlicloudGaBasicEndpointsRead(d *schema.ResourceData, meta interfa } var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/data_source_alicloud_ga_custom_routing_endpoint_group_destinations.go b/alicloud/data_source_alicloud_ga_custom_routing_endpoint_group_destinations.go index 074075e50d4a..5384ad5ca550 100644 --- a/alicloud/data_source_alicloud_ga_custom_routing_endpoint_group_destinations.go +++ b/alicloud/data_source_alicloud_ga_custom_routing_endpoint_group_destinations.go @@ -157,17 +157,14 @@ func dataSourceAlicloudGaCustomRoutingEndpointGroupDestinationsRead(d *schema.Re } var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/data_source_alicloud_ga_custom_routing_endpoint_groups.go b/alicloud/data_source_alicloud_ga_custom_routing_endpoint_groups.go index 9eb868b77e43..52c60c0cdb35 100644 --- a/alicloud/data_source_alicloud_ga_custom_routing_endpoint_groups.go +++ b/alicloud/data_source_alicloud_ga_custom_routing_endpoint_groups.go @@ -163,17 +163,14 @@ func dataSourceAlicloudGaCustomRoutingEndpointGroupsRead(d *schema.ResourceData, } var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/data_source_alicloud_ga_custom_routing_endpoint_traffic_policies.go b/alicloud/data_source_alicloud_ga_custom_routing_endpoint_traffic_policies.go index 062699ad4fc2..c88042933413 100644 --- a/alicloud/data_source_alicloud_ga_custom_routing_endpoint_traffic_policies.go +++ b/alicloud/data_source_alicloud_ga_custom_routing_endpoint_traffic_policies.go @@ -153,17 +153,14 @@ func dataSourceAliCloudGaCustomRoutingEndpointTrafficPoliciesRead(d *schema.Reso } var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/data_source_alicloud_ga_custom_routing_endpoints.go b/alicloud/data_source_alicloud_ga_custom_routing_endpoints.go index 9677f6acf044..dd87c176f344 100644 --- a/alicloud/data_source_alicloud_ga_custom_routing_endpoints.go +++ b/alicloud/data_source_alicloud_ga_custom_routing_endpoints.go @@ -123,17 +123,14 @@ func dataSourceAlicloudGaCustomRoutingEndpointsRead(d *schema.ResourceData, meta } var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/data_source_alicloud_ga_custom_routing_port_mappings.go b/alicloud/data_source_alicloud_ga_custom_routing_port_mappings.go index 7dc5e0e946ca..f487c4f2f77b 100644 --- a/alicloud/data_source_alicloud_ga_custom_routing_port_mappings.go +++ b/alicloud/data_source_alicloud_ga_custom_routing_port_mappings.go @@ -138,17 +138,14 @@ func dataSourceAlicloudGaCustomRoutingPortMappingsRead(d *schema.ResourceData, m var objects []map[string]interface{} var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/data_source_alicloud_ga_domains.go b/alicloud/data_source_alicloud_ga_domains.go index 40d3093829c9..7470e61335bc 100644 --- a/alicloud/data_source_alicloud_ga_domains.go +++ b/alicloud/data_source_alicloud_ga_domains.go @@ -7,7 +7,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/PaesslerAG/jsonpath" - util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" @@ -110,20 +109,15 @@ func dataSourceAlicloudGaDomainsRead(d *schema.ResourceData, meta interface{}) e } } - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error var objects []interface{} var response map[string]interface{} for { action := "ListDomains" - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - resp, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -131,7 +125,6 @@ func dataSourceAlicloudGaDomainsRead(d *schema.ResourceData, meta interface{}) e } return resource.NonRetryableError(err) } - response = resp addDebug(action, response, request) return nil }) diff --git a/alicloud/data_source_alicloud_ga_endpoint_group_ip_address_cidr_blocks.go b/alicloud/data_source_alicloud_ga_endpoint_group_ip_address_cidr_blocks.go index bfc622c017cc..8fa6af1ec884 100644 --- a/alicloud/data_source_alicloud_ga_endpoint_group_ip_address_cidr_blocks.go +++ b/alicloud/data_source_alicloud_ga_endpoint_group_ip_address_cidr_blocks.go @@ -69,16 +69,13 @@ func dataSourceAliCloudGaEndpointGroupIpAddressCidrBlocksRead(d *schema.Resource } var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/data_source_alicloud_ga_endpoint_groups.go b/alicloud/data_source_alicloud_ga_endpoint_groups.go index 304a9a9ccd24..d3743aca4ad1 100644 --- a/alicloud/data_source_alicloud_ga_endpoint_groups.go +++ b/alicloud/data_source_alicloud_ga_endpoint_groups.go @@ -221,16 +221,13 @@ func dataSourceAliCloudGaEndpointGroupsRead(d *schema.ResourceData, meta interfa } var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/data_source_alicloud_ga_forwarding_rules.go b/alicloud/data_source_alicloud_ga_forwarding_rules.go index c6ec6eef8381..adcd4af95f8f 100644 --- a/alicloud/data_source_alicloud_ga_forwarding_rules.go +++ b/alicloud/data_source_alicloud_ga_forwarding_rules.go @@ -177,14 +177,11 @@ func dataSourceAlicloudGaForwardingRulesRead(d *schema.ResourceData, meta interf } status, statusOk := d.GetOk("status") var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ga_forwarding_rules", action, AlibabaCloudSdkGoERROR) } diff --git a/alicloud/data_source_alicloud_ga_ip_sets.go b/alicloud/data_source_alicloud_ga_ip_sets.go index 2888966577ec..3823f37960b1 100644 --- a/alicloud/data_source_alicloud_ga_ip_sets.go +++ b/alicloud/data_source_alicloud_ga_ip_sets.go @@ -99,14 +99,11 @@ func dataSourceAlicloudGaIpSetsRead(d *schema.ResourceData, meta interface{}) er } status, statusOk := d.GetOk("status") var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ga_ip_sets", action, AlibabaCloudSdkGoERROR) } diff --git a/alicloud/data_source_alicloud_ga_listeners.go b/alicloud/data_source_alicloud_ga_listeners.go index f15547c3588e..6719412fe868 100644 --- a/alicloud/data_source_alicloud_ga_listeners.go +++ b/alicloud/data_source_alicloud_ga_listeners.go @@ -150,14 +150,11 @@ func dataSourceAlicloudGaListenersRead(d *schema.ResourceData, meta interface{}) } status, statusOk := d.GetOk("status") var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { return WrapErrorf(err, DataDefaultErrorMsg, "alicloud_ga_listeners", action, AlibabaCloudSdkGoERROR) } diff --git a/alicloud/resource_alicloud_ga_accelerator.go b/alicloud/resource_alicloud_ga_accelerator.go index 3fc19dd743c1..18614d273346 100644 --- a/alicloud/resource_alicloud_ga_accelerator.go +++ b/alicloud/resource_alicloud_ga_accelerator.go @@ -5,7 +5,6 @@ import ( "log" "time" - util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" @@ -115,10 +114,7 @@ func resourceAliCloudGaAcceleratorCreate(d *schema.ResourceData, meta interface{ var response map[string]interface{} action := "CreateAccelerator" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error // there is an api bug that the name can not effect //if v, ok := d.GetOk("accelerator_name"); ok { // request["Name"] = v @@ -162,9 +158,7 @@ func resourceAliCloudGaAcceleratorCreate(d *schema.ResourceData, meta interface{ request["ResourceGroupId"] = v } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { return WrapErrorf(err, DefaultErrorMsg, "alicloud_ga_accelerator", action, AlibabaCloudSdkGoERROR) } @@ -261,16 +255,11 @@ func resourceAliCloudGaAcceleratorUpdate(d *schema.ResourceData, meta interface{ if update { action := "UpdateAcceleratorAutoRenewAttribute" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -323,14 +312,9 @@ func resourceAliCloudGaAcceleratorUpdate(d *schema.ResourceData, meta interface{ } action := "UpdateAccelerator" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, updateAcceleratorReq, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, updateAcceleratorReq, true) addDebug(action, response, updateAcceleratorReq) if err != nil { @@ -363,16 +347,11 @@ func resourceAliCloudGaAcceleratorUpdate(d *schema.ResourceData, meta interface{ if update { action := "UpdateAcceleratorCrossBorderStatus" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, updateAcceleratorCrossBorderStatusReq, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, updateAcceleratorCrossBorderStatusReq, true) if err != nil { if NeedRetry(err) { wait() @@ -412,16 +391,11 @@ func resourceAliCloudGaAcceleratorUpdate(d *schema.ResourceData, meta interface{ if update { action := "UpdateAcceleratorCrossBorderMode" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, updateAcceleratorCrossBorderModeReq, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, updateAcceleratorCrossBorderModeReq, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator"}) || NeedRetry(err) { wait() @@ -462,16 +436,11 @@ func resourceAliCloudGaAcceleratorUpdate(d *schema.ResourceData, meta interface{ if update { action := "ChangeResourceGroup" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, changeResourceGroupReq, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, changeResourceGroupReq, true) if err != nil { if NeedRetry(err) { wait() @@ -501,10 +470,7 @@ func resourceAliCloudGaAcceleratorDelete(d *schema.ResourceData, meta interface{ action := "DeleteAccelerator" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error object, err := gaService.DescribeGaAccelerator(d.Id()) if err != nil { @@ -525,11 +491,9 @@ func resourceAliCloudGaAcceleratorDelete(d *schema.ResourceData, meta interface{ "AcceleratorId": d.Id(), } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_accelerator_spare_ip_attachment.go b/alicloud/resource_alicloud_ga_accelerator_spare_ip_attachment.go index 3a21ecbf0fdf..0a8c731cea74 100644 --- a/alicloud/resource_alicloud_ga_accelerator_spare_ip_attachment.go +++ b/alicloud/resource_alicloud_ga_accelerator_spare_ip_attachment.go @@ -52,10 +52,7 @@ func resourceAlicloudGaAcceleratorSpareIpAttachmentCreate(d *schema.ResourceData var response map[string]interface{} action := "CreateSpareIps" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["AcceleratorId"] = d.Get("accelerator_id") if v, ok := d.GetOkExists("dry_run"); ok { request["DryRun"] = v @@ -67,7 +64,7 @@ func resourceAlicloudGaAcceleratorSpareIpAttachmentCreate(d *schema.ResourceData runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -118,10 +115,7 @@ func resourceAlicloudGaAcceleratorSpareIpAttachmentUpdate(d *schema.ResourceData } func resourceAlicloudGaAcceleratorSpareIpAttachmentDelete(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error parts, err := ParseResourceId(d.Id(), 2) if err != nil { return WrapError(err) @@ -143,7 +137,7 @@ func resourceAlicloudGaAcceleratorSpareIpAttachmentDelete(d *schema.ResourceData runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_accelerator_test.go b/alicloud/resource_alicloud_ga_accelerator_test.go index 1a841618ebf4..aa92e5a24cc9 100644 --- a/alicloud/resource_alicloud_ga_accelerator_test.go +++ b/alicloud/resource_alicloud_ga_accelerator_test.go @@ -50,15 +50,11 @@ func testSweepGaAccelerator(region string) error { request["PageSize"] = PageSizeLarge request["PageNumber"] = 1 - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } for { action := "ListAccelerators" runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) - response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err := client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { log.Printf("[ERROR] %s got an error: %v", action, err) break @@ -93,18 +89,13 @@ func testSweepGaAccelerator(region string) error { request["PageSize"] = PageSizeLarge request["PageNumber"] = 1 - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error for { action := "ListIpSets" - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) var resp interface{} wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(1*time.Minute, func() *resource.RetryError { - response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err := client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) || IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.IpSet"}) { wait() @@ -127,7 +118,7 @@ func testSweepGaAccelerator(region string) error { wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(1*time.Minute, func() *resource.RetryError { request["ClientToken"] = buildClientToken("DeleteIpSet") - resp, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) || IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.IpSet"}) { wait() @@ -147,12 +138,10 @@ func testSweepGaAccelerator(region string) error { for { action := "ListEndpointGroups" - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) var resp interface{} wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(1*time.Minute, func() *resource.RetryError { - response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err := client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) || IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.IpSet"}) { wait() @@ -169,12 +158,10 @@ func testSweepGaAccelerator(region string) error { "EndpointGroupId": v.(map[string]interface{})["EndpointGroupId"], "AcceleratorId": acceleratorId, } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) action := "DeleteEndpointGroup" wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(1*time.Minute, func() *resource.RetryError { - resp, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) || IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.EndPointGroup"}) { wait() @@ -208,7 +195,7 @@ func testSweepGaAccelerator(region string) error { } wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(1*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.BandwidthPackage", "StateError.Accelerator"}) || NeedRetry(err) { wait() @@ -231,7 +218,7 @@ func testSweepGaAccelerator(region string) error { "RegionId": client.RegionId, } request["ClientToken"] = buildClientToken("DeleteBandwidthPackage") - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) addDebug(action, response, request) if err != nil { log.Printf("[ERROR] Deleting bandwidth package %s got an error: %s", bandwidthPackageId, err) diff --git a/alicloud/resource_alicloud_ga_access_log.go b/alicloud/resource_alicloud_ga_access_log.go index d789af38d4cc..36c77404c043 100644 --- a/alicloud/resource_alicloud_ga_access_log.go +++ b/alicloud/resource_alicloud_ga_access_log.go @@ -67,10 +67,7 @@ func resourceAlicloudGaAccessLogCreate(d *schema.ResourceData, meta interface{}) var response map[string]interface{} action := "AttachLogStoreToEndpointGroup" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("AttachLogStoreToEndpointGroup") @@ -85,7 +82,7 @@ func resourceAlicloudGaAccessLogCreate(d *schema.ResourceData, meta interface{}) runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 5*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.EndPointGroup"}) || NeedRetry(err) { wait() @@ -139,10 +136,7 @@ func resourceAlicloudGaAccessLogDelete(d *schema.ResourceData, meta interface{}) var response map[string]interface{} action := "DetachLogStoreFromEndpointGroup" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error parts, err := ParseResourceId(d.Id(), 3) if err != nil { @@ -161,7 +155,7 @@ func resourceAlicloudGaAccessLogDelete(d *schema.ResourceData, meta interface{}) runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 5*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.EndPointGroup"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_acl.go b/alicloud/resource_alicloud_ga_acl.go index 95f3be271e02..9f620aed2bb4 100644 --- a/alicloud/resource_alicloud_ga_acl.go +++ b/alicloud/resource_alicloud_ga_acl.go @@ -6,7 +6,6 @@ import ( "regexp" "time" - util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" @@ -83,10 +82,7 @@ func resourceAliCloudGaAclCreate(d *schema.ResourceData, meta interface{}) error var response map[string]interface{} action := "CreateAcl" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("CreateAcl") @@ -112,11 +108,9 @@ func resourceAliCloudGaAclCreate(d *schema.ResourceData, meta interface{}) error request["DryRun"] = v } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -218,16 +212,11 @@ func resourceAliCloudGaAclUpdate(d *schema.ResourceData, meta interface{}) error } action := "UpdateAclAttribute" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 20*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Acl"}) || NeedRetry(err) { wait() @@ -268,16 +257,11 @@ func resourceAliCloudGaAclUpdate(d *schema.ResourceData, meta interface{}) error } action := "RemoveEntriesFromAcl" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) - wait := incrementalWait(3*time.Second, 20*time.Second) + wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, removeEntriesFromAclReq, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, removeEntriesFromAclReq, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Acl"}) || NeedRetry(err) { wait() @@ -317,16 +301,11 @@ func resourceAliCloudGaAclUpdate(d *schema.ResourceData, meta interface{}) error } action := "AddEntriesToAcl" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) - wait := incrementalWait(3*time.Second, 20*time.Second) + wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, addEntriesToAclReq, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, addEntriesToAclReq, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Acl"}) || NeedRetry(err) { wait() @@ -368,16 +347,10 @@ func resourceAliCloudGaAclUpdate(d *schema.ResourceData, meta interface{}) error if update { action := "ChangeResourceGroup" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } - - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) + var err error wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, changeResourceGroupReq, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, changeResourceGroupReq, true) if err != nil { if NeedRetry(err) { wait() @@ -407,10 +380,7 @@ func resourceAliCloudGaAclDelete(d *schema.ResourceData, meta interface{}) error action := "DeleteAcl" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request := map[string]interface{}{ "RegionId": client.RegionId, @@ -422,11 +392,9 @@ func resourceAliCloudGaAclDelete(d *schema.ResourceData, meta interface{}) error request["DryRun"] = v } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 20*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Acl", "AclHasBindListener"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_acl_attachment.go b/alicloud/resource_alicloud_ga_acl_attachment.go index 08bf91cb1d9b..defec89d63b9 100644 --- a/alicloud/resource_alicloud_ga_acl_attachment.go +++ b/alicloud/resource_alicloud_ga_acl_attachment.go @@ -59,10 +59,7 @@ func resourceAliCloudGaAclAttachmentCreate(d *schema.ResourceData, meta interfac var response map[string]interface{} action := "AssociateAclsWithListener" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("AssociateAclsWithListener") @@ -78,7 +75,7 @@ func resourceAliCloudGaAclAttachmentCreate(d *schema.ResourceData, meta interfac runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Acl", "StateError.Accelerator", "NotActive.Listener"}) || NeedRetry(err) { wait() @@ -140,10 +137,7 @@ func resourceAliCloudGaAclAttachmentDelete(d *schema.ResourceData, meta interfac gaService := GaService{client} action := "DissociateAclsFromListener" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error parts, err := ParseResourceId(d.Id(), 2) if err != nil { @@ -166,7 +160,7 @@ func resourceAliCloudGaAclAttachmentDelete(d *schema.ResourceData, meta interfac runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Acl", "StateError.Accelerator", "NotActive.Listener"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_acl_entry_attachment.go b/alicloud/resource_alicloud_ga_acl_entry_attachment.go index 0f82fd982295..d6450834589f 100644 --- a/alicloud/resource_alicloud_ga_acl_entry_attachment.go +++ b/alicloud/resource_alicloud_ga_acl_entry_attachment.go @@ -54,10 +54,7 @@ func resourceAlicloudGaAclEntryAttachmentCreate(d *schema.ResourceData, meta int var response map[string]interface{} action := "AddEntriesToAcl" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("AddEntriesToAcl") @@ -77,7 +74,7 @@ func resourceAlicloudGaAclEntryAttachmentCreate(d *schema.ResourceData, meta int runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Acl", "NotExist.Acl", "ACL_NOT_STEADY"}) || NeedRetry(err) { wait() @@ -144,10 +141,7 @@ func resourceAlicloudGaAclEntryAttachmentDelete(d *schema.ResourceData, meta int client := meta.(*connectivity.AliyunClient) action := "RemoveEntriesFromAcl" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error parts, err := ParseResourceId(d.Id(), 2) if err != nil { @@ -170,7 +164,7 @@ func resourceAlicloudGaAclEntryAttachmentDelete(d *schema.ResourceData, meta int runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Acl", "ACL_NOT_STEADY"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_acl_test.go b/alicloud/resource_alicloud_ga_acl_test.go index 2fc458adeab1..fcbb2f5b7d66 100644 --- a/alicloud/resource_alicloud_ga_acl_test.go +++ b/alicloud/resource_alicloud_ga_acl_test.go @@ -39,16 +39,12 @@ func testSweepGaAcl(region string) error { request["MaxResults"] = PageSizeLarge var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - log.Printf("[ERROR] %s get an error: %#v", action, err) - } for { runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -91,7 +87,7 @@ func testSweepGaAcl(region string) error { "AclId": item["AclId"], } request["ClientToken"] = buildClientToken("DeleteAcl") - _, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + _, err := client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { log.Printf("[ERROR] Failed to delete Ga Acl (%s): %s", item["AclId"].(string), err) } diff --git a/alicloud/resource_alicloud_ga_additional_certificate.go b/alicloud/resource_alicloud_ga_additional_certificate.go index f2ed8e6ca475..72d593fee495 100644 --- a/alicloud/resource_alicloud_ga_additional_certificate.go +++ b/alicloud/resource_alicloud_ga_additional_certificate.go @@ -55,10 +55,7 @@ func resourceAliCloudGaAdditionalCertificateCreate(d *schema.ResourceData, meta var response map[string]interface{} action := "AssociateAdditionalCertificatesWithListener" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("AssociateAdditionalCertificatesWithListener") @@ -71,7 +68,7 @@ func resourceAliCloudGaAdditionalCertificateCreate(d *schema.ResourceData, meta runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.Listener", "NotActive.Listener"}) || NeedRetry(err) { wait() @@ -154,16 +151,13 @@ func resourceAliCloudGaAdditionalCertificateUpdate(d *schema.ResourceData, meta if update { action := "UpdateAdditionalCertificateWithListener" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.Listener", "NotActive.Listener"}) || NeedRetry(err) { wait() @@ -199,10 +193,7 @@ func resourceAliCloudGaAdditionalCertificateDelete(d *schema.ResourceData, meta action := "DissociateAdditionalCertificatesFromListener" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error parts, err := ParseResourceId(d.Id(), 3) if err != nil { @@ -221,7 +212,7 @@ func resourceAliCloudGaAdditionalCertificateDelete(d *schema.ResourceData, meta runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.Listener", "NotActive.Listener"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_bandwidth_package.go b/alicloud/resource_alicloud_ga_bandwidth_package.go index 2e8148b58c4f..4cbaef6bbc3b 100644 --- a/alicloud/resource_alicloud_ga_bandwidth_package.go +++ b/alicloud/resource_alicloud_ga_bandwidth_package.go @@ -5,7 +5,6 @@ import ( "log" "time" - util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" @@ -139,10 +138,7 @@ func resourceAliCloudGaBandwidthPackageCreate(d *schema.ResourceData, meta inter var response map[string]interface{} action := "CreateBandwidthPackage" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("CreateBandwidthPackage") @@ -197,11 +193,9 @@ func resourceAliCloudGaBandwidthPackageCreate(d *schema.ResourceData, meta inter request["ResourceGroupId"] = v } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -311,16 +305,11 @@ func resourceAliCloudGaBandwidthPackageUpdate(d *schema.ResourceData, meta inter if update { action := "UpdateBandwidthPackagaAutoRenewAttribute" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -376,16 +365,11 @@ func resourceAliCloudGaBandwidthPackageUpdate(d *schema.ResourceData, meta inter } action := "UpdateBandwidthPackage" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, updateBandwidthPackageReq, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, updateBandwidthPackageReq, true) if err != nil { if IsExpectedErrors(err, []string{"NotExist.BandwidthPackage", "StateError.Accelerator", "StateError.BandwidthPackage", "UpgradeError.BandwidthPackage", "GreaterThanGa.IpSetBandwidth", "BandwidthIllegal.BandwidthPackage"}) || NeedRetry(err) { wait() @@ -429,16 +413,11 @@ func resourceAliCloudGaBandwidthPackageUpdate(d *schema.ResourceData, meta inter if update { action := "ChangeResourceGroup" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, changeResourceGroupReq, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, changeResourceGroupReq, true) if err != nil { if NeedRetry(err) { wait() @@ -473,10 +452,7 @@ func resourceAliCloudGaBandwidthPackageDelete(d *schema.ResourceData, meta inter action := "DeleteBandwidthPackage" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request := map[string]interface{}{ "RegionId": client.RegionId, @@ -484,11 +460,9 @@ func resourceAliCloudGaBandwidthPackageDelete(d *schema.ResourceData, meta inter "BandwidthPackageId": d.Id(), } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.BandwidthPackage", "BindExist.BandwidthPackage"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_bandwidth_package_attachment.go b/alicloud/resource_alicloud_ga_bandwidth_package_attachment.go index f014adeb6213..a0d8117c5609 100644 --- a/alicloud/resource_alicloud_ga_bandwidth_package_attachment.go +++ b/alicloud/resource_alicloud_ga_bandwidth_package_attachment.go @@ -55,10 +55,7 @@ func resourceAliCloudGaBandwidthPackageAttachmentCreate(d *schema.ResourceData, var response map[string]interface{} action := "BandwidthPackageAddAccelerator" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["AcceleratorId"] = d.Get("accelerator_id") @@ -68,7 +65,7 @@ func resourceAliCloudGaBandwidthPackageAttachmentCreate(d *schema.ResourceData, runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.BandwidthPackage", "StateError.Accelerator", "GreaterThanGa.IpSetBandwidth", "BandwidthIllegal.BandwidthPackage", "NotExist.BasicBandwidthPackage"}) || NeedRetry(err) { wait() @@ -152,16 +149,13 @@ func resourceAliCloudGaBandwidthPackageAttachmentUpdate(d *schema.ResourceData, if update { action := "ReplaceBandwidthPackage" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.BandwidthPackage", "StateError.Accelerator", "GreaterThanGa.IpSetBandwidth", "BandwidthIllegal.BandwidthPackage", "NotExist.BasicBandwidthPackage"}) || NeedRetry(err) { wait() @@ -194,10 +188,7 @@ func resourceAliCloudGaBandwidthPackageAttachmentDelete(d *schema.ResourceData, action := "BandwidthPackageRemoveAccelerator" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error if !strings.Contains(d.Id(), ":") { d.SetId(fmt.Sprintf("%v:%v", d.Get("accelerator_id"), d.Id())) @@ -218,7 +209,7 @@ func resourceAliCloudGaBandwidthPackageAttachmentDelete(d *schema.ResourceData, runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.BandwidthPackage", "StateError.Accelerator", "BindExist.CrossDomain", "Exist.EndpointGroup", "Exist.IpSet", "BandwidthPackageCannotUnbind.HasCrossRegion", "BandwidthPackageCannotUnbind.IpSet", "BandwidthPackageCannotUnbind.EndpointGroup"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_bandwidth_package_test.go b/alicloud/resource_alicloud_ga_bandwidth_package_test.go index 76389be20407..8117669ec096 100644 --- a/alicloud/resource_alicloud_ga_bandwidth_package_test.go +++ b/alicloud/resource_alicloud_ga_bandwidth_package_test.go @@ -51,15 +51,11 @@ func testSweepGaBandwidthPackage(region string) error { request["PageSize"] = PageSizeLarge request["PageNumber"] = 1 - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } for { action := "ListBandwidthPackages" runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) - response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err := client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { log.Printf("[ERROR] %s got an error: %v", action, err) break @@ -96,7 +92,7 @@ func testSweepGaBandwidthPackage(region string) error { request["ClientToken"] = buildClientToken("DeleteBandwidthPackage") wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(1*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.BandwidthPackage", "StateError.Accelerator"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_basic_accelerate_ip.go b/alicloud/resource_alicloud_ga_basic_accelerate_ip.go index 9b324fbf3e1b..a441cf7ca96a 100644 --- a/alicloud/resource_alicloud_ga_basic_accelerate_ip.go +++ b/alicloud/resource_alicloud_ga_basic_accelerate_ip.go @@ -51,10 +51,7 @@ func resourceAliCloudGaBasicAccelerateIpCreate(d *schema.ResourceData, meta inte var response map[string]interface{} action := "CreateBasicAccelerateIp" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("CreateBasicAccelerateIp") @@ -65,7 +62,7 @@ func resourceAliCloudGaBasicAccelerateIpCreate(d *schema.ResourceData, meta inte runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "NotActive.IpSet"}) || NeedRetry(err) { wait() @@ -118,10 +115,7 @@ func resourceAliCloudGaBasicAccelerateIpDelete(d *schema.ResourceData, meta inte action := "DeleteBasicAccelerateIp" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request := map[string]interface{}{ "RegionId": client.RegionId, @@ -133,7 +127,7 @@ func resourceAliCloudGaBasicAccelerateIpDelete(d *schema.ResourceData, meta inte runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "NotActive.IpSet"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_basic_accelerate_ip_endpoint_relation.go b/alicloud/resource_alicloud_ga_basic_accelerate_ip_endpoint_relation.go index 3e603985e25a..b90ced3a53b1 100644 --- a/alicloud/resource_alicloud_ga_basic_accelerate_ip_endpoint_relation.go +++ b/alicloud/resource_alicloud_ga_basic_accelerate_ip_endpoint_relation.go @@ -52,10 +52,7 @@ func resourceAlicloudGaBasicAccelerateIpEndpointRelationCreate(d *schema.Resourc var response map[string]interface{} action := "CreateBasicAccelerateIpEndpointRelation" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("CreateBasicAccelerateIpEndpointRelation") @@ -67,7 +64,7 @@ func resourceAlicloudGaBasicAccelerateIpEndpointRelationCreate(d *schema.Resourc runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"NotActive.IpSet", "StateError.Accelerator"}) || NeedRetry(err) { wait() @@ -120,10 +117,7 @@ func resourceAlicloudGaBasicAccelerateIpEndpointRelationDelete(d *schema.Resourc action := "DeleteBasicAccelerateIpEndpointRelation" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error parts, err := ParseResourceId(d.Id(), 3) if err != nil { @@ -142,7 +136,7 @@ func resourceAlicloudGaBasicAccelerateIpEndpointRelationDelete(d *schema.Resourc runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"NotActive.IpSet", "StateError.Accelerator"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_basic_accelerator.go b/alicloud/resource_alicloud_ga_basic_accelerator.go index 1c6358a39264..cc077db84008 100644 --- a/alicloud/resource_alicloud_ga_basic_accelerator.go +++ b/alicloud/resource_alicloud_ga_basic_accelerator.go @@ -5,7 +5,6 @@ import ( "log" "time" - util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" @@ -101,10 +100,7 @@ func resourceAliCloudGaBasicAcceleratorCreate(d *schema.ResourceData, meta inter var response map[string]interface{} action := "CreateBasicAccelerator" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("CreateBasicAccelerator") @@ -149,11 +145,9 @@ func resourceAliCloudGaBasicAcceleratorCreate(d *schema.ResourceData, meta inter request["ResourceGroupId"] = v } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -248,16 +242,11 @@ func resourceAliCloudGaBasicAcceleratorUpdate(d *schema.ResourceData, meta inter if update { action := "UpdateBasicAccelerator" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -298,16 +287,11 @@ func resourceAliCloudGaBasicAcceleratorUpdate(d *schema.ResourceData, meta inter if update { action := "UpdateAcceleratorCrossBorderStatus" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, updateAcceleratorCrossBorderStatusReq, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, updateAcceleratorCrossBorderStatusReq, true) if err != nil { if NeedRetry(err) { wait() @@ -348,16 +332,11 @@ func resourceAliCloudGaBasicAcceleratorUpdate(d *schema.ResourceData, meta inter if update { action := "ChangeResourceGroup" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, changeResourceGroupReq, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, changeResourceGroupReq, true) if err != nil { if NeedRetry(err) { wait() @@ -387,10 +366,7 @@ func resourceAliCloudGaBasicAcceleratorDelete(d *schema.ResourceData, meta inter action := "DeleteBasicAccelerator" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error object, err := gaService.DescribeGaBasicAccelerator(d.Id()) if err != nil { @@ -411,11 +387,9 @@ func resourceAliCloudGaBasicAcceleratorDelete(d *schema.ResourceData, meta inter "AcceleratorId": d.Id(), } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_basic_endpoint.go b/alicloud/resource_alicloud_ga_basic_endpoint.go index f622acae4c21..4f4eb0386f06 100644 --- a/alicloud/resource_alicloud_ga_basic_endpoint.go +++ b/alicloud/resource_alicloud_ga_basic_endpoint.go @@ -85,10 +85,7 @@ func resourceAliCloudGaBasicEndpointCreate(d *schema.ResourceData, meta interfac var response map[string]interface{} action := "CreateBasicEndpoint" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("CreateBasicEndpoint") @@ -117,7 +114,7 @@ func resourceAliCloudGaBasicEndpointCreate(d *schema.ResourceData, meta interfac runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"NotExist.Accelerator", "NotExist.EndPointGroup", "NotExist.Nlb", "NotFound.ECSInstance", "StateError.Accelerator"}) || NeedRetry(err) { wait() @@ -196,16 +193,13 @@ func resourceAliCloudGaBasicEndpointUpdate(d *schema.ResourceData, meta interfac if update { action := "UpdateBasicEndpoint" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -231,10 +225,7 @@ func resourceAliCloudGaBasicEndpointDelete(d *schema.ResourceData, meta interfac action := "DeleteBasicEndpoint" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error parts, err := ParseResourceId(d.Id(), 2) if err != nil { @@ -252,7 +243,7 @@ func resourceAliCloudGaBasicEndpointDelete(d *schema.ResourceData, meta interfac runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.EndPointGroup"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_basic_endpoint_group.go b/alicloud/resource_alicloud_ga_basic_endpoint_group.go index 75a889d3b5c0..01ef823247f3 100644 --- a/alicloud/resource_alicloud_ga_basic_endpoint_group.go +++ b/alicloud/resource_alicloud_ga_basic_endpoint_group.go @@ -77,10 +77,7 @@ func resourceAliCloudGaBasicEndpointGroupCreate(d *schema.ResourceData, meta int var response map[string]interface{} action := "CreateBasicEndpointGroup" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("CreateBasicEndpointGroup") @@ -111,7 +108,7 @@ func resourceAliCloudGaBasicEndpointGroupCreate(d *schema.ResourceData, meta int runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "NotExist.BasicBandwidthPackage"}) || NeedRetry(err) { wait() @@ -197,16 +194,13 @@ func resourceAliCloudGaBasicEndpointGroupUpdate(d *schema.ResourceData, meta int if update { action := "UpdateBasicEndpointGroup" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.EndPointGroup", "NotExist.BasicBandwidthPackage"}) || NeedRetry(err) { wait() @@ -237,10 +231,7 @@ func resourceAliCloudGaBasicEndpointGroupDelete(d *schema.ResourceData, meta int action := "DeleteBasicEndpointGroup" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request := map[string]interface{}{ "ClientToken": buildClientToken("DeleteBasicEndpointGroup"), @@ -251,7 +242,7 @@ func resourceAliCloudGaBasicEndpointGroupDelete(d *schema.ResourceData, meta int runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.EndPointGroup", "ExistBoundEndpoint.EndpointGroup", "NotExist.BasicBandwidthPackage"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_basic_ip_set.go b/alicloud/resource_alicloud_ga_basic_ip_set.go index f38769947982..fbf110b14702 100644 --- a/alicloud/resource_alicloud_ga_basic_ip_set.go +++ b/alicloud/resource_alicloud_ga_basic_ip_set.go @@ -62,10 +62,7 @@ func resourceAliCloudGaBasicIpSetCreate(d *schema.ResourceData, meta interface{} var response map[string]interface{} action := "CreateBasicIpSet" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("CreateBasicIpSet") @@ -84,7 +81,7 @@ func resourceAliCloudGaBasicIpSetCreate(d *schema.ResourceData, meta interface{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 5*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "NotExist.BasicBandwidthPackage"}) || NeedRetry(err) { wait() @@ -151,16 +148,13 @@ func resourceAliCloudGaBasicIpSetUpdate(d *schema.ResourceData, meta interface{} if update { action := "UpdateBasicIpSet" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 5*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator"}) || NeedRetry(err) { wait() @@ -191,10 +185,7 @@ func resourceAliCloudGaBasicIpSetDelete(d *schema.ResourceData, meta interface{} action := "DeleteBasicIpSet" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request := map[string]interface{}{ "RegionId": client.RegionId, @@ -206,7 +197,7 @@ func resourceAliCloudGaBasicIpSetDelete(d *schema.ResourceData, meta interface{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 5*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "NotActive.IpSet", "NotExist.BasicBandwidthPackage", "ExistBoundAccelerateIp.IpSet"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_custom_routing_endpoint.go b/alicloud/resource_alicloud_ga_custom_routing_endpoint.go index 7a73a752c2c6..cdd6b5078c69 100644 --- a/alicloud/resource_alicloud_ga_custom_routing_endpoint.go +++ b/alicloud/resource_alicloud_ga_custom_routing_endpoint.go @@ -76,10 +76,7 @@ func resourceAliCloudGaCustomRoutingEndpointCreate(d *schema.ResourceData, meta var response map[string]interface{} action := "CreateCustomRoutingEndpoints" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("CreateCustomRoutingEndpoints") @@ -101,7 +98,7 @@ func resourceAliCloudGaCustomRoutingEndpointCreate(d *schema.ResourceData, meta runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"NotActive.Listener", "StateError.EndPointGroup"}) || NeedRetry(err) { wait() @@ -190,16 +187,13 @@ func resourceAliCloudGaCustomRoutingEndpointUpdate(d *schema.ResourceData, meta if update { action := "UpdateCustomRoutingEndpoints" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"NotActive.Listener", "StateError.EndPointGroup"}) || NeedRetry(err) { wait() @@ -230,10 +224,7 @@ func resourceAliCloudGaCustomRoutingEndpointDelete(d *schema.ResourceData, meta action := "DeleteCustomRoutingEndpoints" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error parts, err := ParseResourceId(d.Id(), 2) if err != nil { @@ -251,7 +242,7 @@ func resourceAliCloudGaCustomRoutingEndpointDelete(d *schema.ResourceData, meta runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"NotActive.Listener", "StateError.EndPointGroup"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_custom_routing_endpoint_group.go b/alicloud/resource_alicloud_ga_custom_routing_endpoint_group.go index ed201af9d483..62b52273d143 100644 --- a/alicloud/resource_alicloud_ga_custom_routing_endpoint_group.go +++ b/alicloud/resource_alicloud_ga_custom_routing_endpoint_group.go @@ -64,10 +64,7 @@ func resourceAliCloudGaCustomRoutingEndpointGroupCreate(d *schema.ResourceData, var response map[string]interface{} action := "CreateCustomRoutingEndpointGroups" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("CreateCustomRoutingEndpointGroups") @@ -93,7 +90,7 @@ func resourceAliCloudGaCustomRoutingEndpointGroupCreate(d *schema.ResourceData, runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"NotActive.Listener", "StateError.Accelerator"}) || NeedRetry(err) { wait() @@ -175,16 +172,13 @@ func resourceAliCloudGaCustomRoutingEndpointGroupUpdate(d *schema.ResourceData, if update { action := "UpdateCustomRoutingEndpointGroupAttribute" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"NotActive.Listener", "StateError.Accelerator"}) || NeedRetry(err) { wait() @@ -215,10 +209,7 @@ func resourceAliCloudGaCustomRoutingEndpointGroupDelete(d *schema.ResourceData, action := "DeleteCustomRoutingEndpointGroups" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request := map[string]interface{}{ "RegionId": client.RegionId, @@ -230,7 +221,7 @@ func resourceAliCloudGaCustomRoutingEndpointGroupDelete(d *schema.ResourceData, runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"NotActive.Listener", "StateError.Accelerator"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_custom_routing_endpoint_group_destination.go b/alicloud/resource_alicloud_ga_custom_routing_endpoint_group_destination.go index 71d7f69ba161..f5876fc9d300 100644 --- a/alicloud/resource_alicloud_ga_custom_routing_endpoint_group_destination.go +++ b/alicloud/resource_alicloud_ga_custom_routing_endpoint_group_destination.go @@ -74,10 +74,7 @@ func resourceAliCloudGaCustomRoutingEndpointGroupDestinationCreate(d *schema.Res var response map[string]interface{} action := "CreateCustomRoutingEndpointGroupDestinations" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("CreateCustomRoutingEndpointGroupDestinations") @@ -95,7 +92,7 @@ func resourceAliCloudGaCustomRoutingEndpointGroupDestinationCreate(d *schema.Res runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"NotActive.Listener", "StateError.Accelerator", "StateError.EndPointGroup"}) || NeedRetry(err) { wait() @@ -192,16 +189,13 @@ func resourceAliCloudGaCustomRoutingEndpointGroupDestinationUpdate(d *schema.Res if update { action := "UpdateCustomRoutingEndpointGroupDestinations" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"NotActive.Listener", "StateError.Accelerator", "StateError.EndPointGroup"}) || NeedRetry(err) { wait() @@ -232,10 +226,7 @@ func resourceAliCloudGaCustomRoutingEndpointGroupDestinationDelete(d *schema.Res action := "DeleteCustomRoutingEndpointGroupDestinations" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error parts, err := ParseResourceId(d.Id(), 2) if err != nil { @@ -253,7 +244,7 @@ func resourceAliCloudGaCustomRoutingEndpointGroupDestinationDelete(d *schema.Res runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"NotActive.Listener", "StateError.Accelerator", "StateError.EndPointGroup"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_custom_routing_endpoint_traffic_policy.go b/alicloud/resource_alicloud_ga_custom_routing_endpoint_traffic_policy.go index b3e1b65611da..a5096397eb9c 100644 --- a/alicloud/resource_alicloud_ga_custom_routing_endpoint_traffic_policy.go +++ b/alicloud/resource_alicloud_ga_custom_routing_endpoint_traffic_policy.go @@ -81,10 +81,7 @@ func resourceAliCloudGaCustomRoutingEndpointTrafficPolicyCreate(d *schema.Resour var response map[string]interface{} action := "CreateCustomRoutingEndpointTrafficPolicies" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("CreateCustomRoutingEndpointTrafficPolicies") @@ -121,7 +118,7 @@ func resourceAliCloudGaCustomRoutingEndpointTrafficPolicyCreate(d *schema.Resour runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"NotActive.Listener", "StateError.Accelerator", "StateError.EndPointGroup"}) || NeedRetry(err) { wait() @@ -251,16 +248,13 @@ func resourceAliCloudGaCustomRoutingEndpointTrafficPolicyUpdate(d *schema.Resour if update { action := "UpdateCustomRoutingEndpointTrafficPolicies" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"NotActive.Listener", "StateError.Accelerator", "StateError.EndPointGroup"}) || NeedRetry(err) { wait() @@ -291,10 +285,7 @@ func resourceAliCloudGaCustomRoutingEndpointTrafficPolicyDelete(d *schema.Resour action := "DeleteCustomRoutingEndpointTrafficPolicies" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error parts, err := ParseResourceId(d.Id(), 2) if err != nil { @@ -312,7 +303,7 @@ func resourceAliCloudGaCustomRoutingEndpointTrafficPolicyDelete(d *schema.Resour runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"NotActive.Listener", "StateError.Accelerator", "StateError.EndPointGroup"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_domain.go b/alicloud/resource_alicloud_ga_domain.go index f27f1653a6e8..881ad72a2c49 100644 --- a/alicloud/resource_alicloud_ga_domain.go +++ b/alicloud/resource_alicloud_ga_domain.go @@ -5,7 +5,6 @@ import ( "log" "time" - util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" @@ -45,10 +44,7 @@ func resourceAlicloudGaDomain() *schema.Resource { func resourceAlicloudGaDomainCreate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error if v, ok := d.GetOk("accelerator_id"); ok { request["AcceleratorIds.1"] = v @@ -61,7 +57,7 @@ func resourceAlicloudGaDomainCreate(d *schema.ResourceData, meta interface{}) er action := "CreateDomain" wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - resp, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, false) if err != nil { if NeedRetry(err) { wait() @@ -69,7 +65,6 @@ func resourceAlicloudGaDomainCreate(d *schema.ResourceData, meta interface{}) er } return resource.NonRetryableError(err) } - response = resp addDebug(action, response, request) return nil }) @@ -108,10 +103,7 @@ func resourceAlicloudGaDomainRead(d *schema.ResourceData, meta interface{}) erro func resourceAlicloudGaDomainDelete(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error parts, err := ParseResourceId(d.Id(), 2) if err != nil { return WrapError(err) @@ -125,7 +117,7 @@ func resourceAlicloudGaDomainDelete(d *schema.ResourceData, meta interface{}) er action := "DeleteDomainAcceleratorRelation" wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - resp, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + response, err := client.RpcPost("Ga", "2019-11-20", action, nil, request, false) if err != nil { if NeedRetry(err) { wait() @@ -133,7 +125,7 @@ func resourceAlicloudGaDomainDelete(d *schema.ResourceData, meta interface{}) er } return resource.NonRetryableError(err) } - addDebug(action, resp, request) + addDebug(action, response, request) return nil }) if err != nil { diff --git a/alicloud/resource_alicloud_ga_endpoint_group.go b/alicloud/resource_alicloud_ga_endpoint_group.go index c340cc722c23..160569023295 100644 --- a/alicloud/resource_alicloud_ga_endpoint_group.go +++ b/alicloud/resource_alicloud_ga_endpoint_group.go @@ -171,10 +171,7 @@ func resourceAliCloudGaEndpointGroupCreate(d *schema.ResourceData, meta interfac var response map[string]interface{} action := "CreateEndpointGroup" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("CreateEndpointGroup") @@ -281,7 +278,7 @@ func resourceAliCloudGaEndpointGroupCreate(d *schema.ResourceData, meta interfac runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"GA_NOT_STEADY", "StateError.Accelerator", "StateError.EndPointGroup", "NotActive.Listener"}) || NeedRetry(err) { wait() @@ -567,16 +564,13 @@ func resourceAliCloudGaEndpointGroupUpdate(d *schema.ResourceData, meta interfac if update { action := "UpdateEndpointGroup" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.EndPointGroup", "NotActive.Listener"}) || NeedRetry(err) { wait() @@ -623,10 +617,7 @@ func resourceAliCloudGaEndpointGroupDelete(d *schema.ResourceData, meta interfac action := "DeleteEndpointGroup" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request := map[string]interface{}{ "ClientToken": buildClientToken("DeleteEndpointGroup"), @@ -638,7 +629,7 @@ func resourceAliCloudGaEndpointGroupDelete(d *schema.ResourceData, meta interfac runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.EndPointGroup", "NotActive.Listener"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_forwarding_rule.go b/alicloud/resource_alicloud_ga_forwarding_rule.go index dd27cfdfa1fa..b1e4fe8bfbbd 100644 --- a/alicloud/resource_alicloud_ga_forwarding_rule.go +++ b/alicloud/resource_alicloud_ga_forwarding_rule.go @@ -157,10 +157,7 @@ func resourceAliCloudGaForwardingRuleCreate(d *schema.ResourceData, meta interfa var response map[string]interface{} action := "CreateForwardingRules" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("CreateForwardingRules") @@ -271,7 +268,7 @@ func resourceAliCloudGaForwardingRuleCreate(d *schema.ResourceData, meta interfa runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator"}) || NeedRetry(err) { wait() @@ -553,16 +550,13 @@ func resourceAliCloudGaForwardingRuleUpdate(d *schema.ResourceData, meta interfa if update { action := "UpdateForwardingRules" - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error runtime := util.RuntimeOptions{} runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.ForwardingRule"}) || NeedRetry(err) { wait() @@ -593,10 +587,7 @@ func resourceAliCloudGaForwardingRuleDelete(d *schema.ResourceData, meta interfa action := "DeleteForwardingRules" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error parts, err := ParseResourceId(d.Id(), 3) if err != nil { @@ -615,7 +606,7 @@ func resourceAliCloudGaForwardingRuleDelete(d *schema.ResourceData, meta interfa runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.ForwardingRule"}) || NeedRetry(err) { wait() diff --git a/alicloud/resource_alicloud_ga_ip_set.go b/alicloud/resource_alicloud_ga_ip_set.go index 7b5d9376db4a..da6cf0f5c1b8 100644 --- a/alicloud/resource_alicloud_ga_ip_set.go +++ b/alicloud/resource_alicloud_ga_ip_set.go @@ -6,7 +6,6 @@ import ( "time" "github.com/PaesslerAG/jsonpath" - util "github.com/alibabacloud-go/tea-utils/service" "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" @@ -74,10 +73,7 @@ func resourceAliCloudGaIpSetCreate(d *schema.ResourceData, meta interface{}) err "RegionId": client.RegionId, } - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["AcceleratorId"] = d.Get("accelerator_id") request["AccelerateRegion.1.AccelerateRegionId"] = d.Get("accelerate_region_id") @@ -95,13 +91,11 @@ func resourceAliCloudGaIpSetCreate(d *schema.ResourceData, meta interface{}) err } var response map[string]interface{} - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) request["ClientToken"] = buildClientToken("CreateIpSets") action := "CreateIpSets" wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.IpSet", "NotExist.BasicBandwidthPackage", "NotSuitable.RegionSelection"}) || NeedRetry(err) { wait() @@ -161,10 +155,7 @@ func resourceAliCloudGaIpSetRead(d *schema.ResourceData, meta interface{}) error func resourceAliCloudGaIpSetUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) gaService := GaService{client} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error update := false request := map[string]interface{}{ @@ -178,13 +169,11 @@ func resourceAliCloudGaIpSetUpdate(d *schema.ResourceData, meta interface{}) err request["Bandwidth"] = d.Get("bandwidth") if update { - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) action := "UpdateIpSet" wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { request["ClientToken"] = buildClientToken("UpdateIpSet") - resp, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err := client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.IpSet", "GreaterThanGa.IpSetBandwidth"}) || NeedRetry(err) { wait() @@ -192,7 +181,7 @@ func resourceAliCloudGaIpSetUpdate(d *schema.ResourceData, meta interface{}) err } return resource.NonRetryableError(err) } - addDebug(action, resp, request) + addDebug(action, response, request) return nil }) @@ -212,23 +201,18 @@ func resourceAliCloudGaIpSetUpdate(d *schema.ResourceData, meta interface{}) err func resourceAliCloudGaIpSetDelete(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) gaService := GaService{client} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request := map[string]interface{}{ "IpSetIds.1": d.Id(), "RegionId": client.RegionId, } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) action := "DeleteIpSets" wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { request["ClientToken"] = buildClientToken("DeleteIpSet") - resp, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err := client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "StateError.IpSet"}) || NeedRetry(err) { wait() @@ -236,7 +220,7 @@ func resourceAliCloudGaIpSetDelete(d *schema.ResourceData, meta interface{}) err } return resource.NonRetryableError(err) } - addDebug(action, resp, request) + addDebug(action, response, request) return nil }) diff --git a/alicloud/resource_alicloud_ga_listener.go b/alicloud/resource_alicloud_ga_listener.go index 24fcfe3b8364..3c2a51dd525f 100644 --- a/alicloud/resource_alicloud_ga_listener.go +++ b/alicloud/resource_alicloud_ga_listener.go @@ -160,10 +160,7 @@ func resourceAliCloudGaListenerCreate(d *schema.ResourceData, meta interface{}) var response map[string]interface{} action := "CreateListener" request := make(map[string]interface{}) - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request["RegionId"] = client.RegionId request["ClientToken"] = buildClientToken("CreateListener") @@ -248,7 +245,7 @@ func resourceAliCloudGaListenerCreate(d *schema.ResourceData, meta interface{}) runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutCreate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "NotExist.BasicBandwidthPackage"}) || NeedRetry(err) { wait() @@ -370,10 +367,7 @@ func resourceAliCloudGaListenerRead(d *schema.ResourceData, meta interface{}) er func resourceAliCloudGaListenerUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) gaService := GaService{client} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error var response map[string]interface{} update := false request := map[string]interface{}{ @@ -489,7 +483,7 @@ func resourceAliCloudGaListenerUpdate(d *schema.ResourceData, meta interface{}) runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "NotActive.Listener"}) || NeedRetry(err) { wait() @@ -520,10 +514,7 @@ func resourceAliCloudGaListenerDelete(d *schema.ResourceData, meta interface{}) action := "DeleteListener" var response map[string]interface{} - conn, err := client.NewGaplusClient() - if err != nil { - return WrapError(err) - } + var err error request := map[string]interface{}{ "ClientToken": buildClientToken("DeleteListener"), @@ -535,7 +526,7 @@ func resourceAliCloudGaListenerDelete(d *schema.ResourceData, meta interface{}) runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutDelete)), func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator", "NotActive.Listener", "Exist.ForwardingRule", "Exist.EndpointGroup"}) || NeedRetry(err) { wait() diff --git a/alicloud/service_alicloud_ga.go b/alicloud/service_alicloud_ga.go index d35ed09a141e..13411e2097fa 100644 --- a/alicloud/service_alicloud_ga.go +++ b/alicloud/service_alicloud_ga.go @@ -19,23 +19,16 @@ type GaService struct { func (s *GaService) DescribeGaAccelerator(id string) (object map[string]interface{}, err error) { var response map[string]interface{} + client := s.client action := "DescribeAccelerator" - - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } - request := map[string]interface{}{ "RegionId": s.client.RegionId, "AcceleratorId": id, } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -86,20 +79,15 @@ func (s *GaService) GaAcceleratorStateRefreshFunc(id string, failStates []string func (s *GaService) DescribeGaListener(id string) (object map[string]interface{}, err error) { var response map[string]interface{} - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } + client := s.client action := "DescribeListener" request := map[string]interface{}{ "RegionId": s.client.RegionId, "ListenerId": id, } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -146,13 +134,8 @@ func (s *GaService) GaListenerStateRefreshFunc(id string, failStates []string) r func (s *GaService) DescribeGaBandwidthPackage(id string) (object map[string]interface{}, err error) { var response map[string]interface{} + client := s.client action := "DescribeBandwidthPackage" - - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } - request := map[string]interface{}{ "RegionId": s.client.RegionId, "BandwidthPackageId": id, @@ -162,7 +145,7 @@ func (s *GaService) DescribeGaBandwidthPackage(id string) (object map[string]int runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 5*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -214,23 +197,16 @@ func (s *GaService) GaBandwidthPackageStateRefreshFunc(id string, failStates []s func (s *GaService) DescribeGaEndpointGroup(id string) (object map[string]interface{}, err error) { var response map[string]interface{} + client := s.client action := "DescribeEndpointGroup" - - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } - request := map[string]interface{}{ "RegionId": s.client.RegionId, "EndpointGroupId": id, } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -265,13 +241,8 @@ func (s *GaService) DescribeGaEndpointGroup(id string) (object map[string]interf func (s *GaService) DescribeGaForwardingRule(id string) (object map[string]interface{}, err error) { var response map[string]interface{} + client := s.client action := "ListForwardingRules" - - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } - parts, err := ParseResourceId(id, 3) if err != nil { err = WrapError(err) @@ -293,7 +264,7 @@ func (s *GaService) DescribeGaForwardingRule(id string) (object map[string]inter runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if IsExpectedErrors(err, []string{"StateError.Accelerator"}) || NeedRetry(err) { wait() @@ -340,10 +311,7 @@ func (s *GaService) DescribeGaForwardingRule(id string) (object map[string]inter } func (s *GaService) DescribeGaIpSet(id string) (object map[string]interface{}, err error) { - conn, err := s.client.NewGaplusClient() - if err != nil { - return object, WrapError(err) - } + client := s.client request := map[string]interface{}{ "IpSetId": id, @@ -352,11 +320,9 @@ func (s *GaService) DescribeGaIpSet(id string) (object map[string]interface{}, e var response map[string]interface{} action := "DescribeIpSet" - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -499,20 +465,15 @@ func (s *GaService) GaIpSetStateRefreshFunc(d *schema.ResourceData, failStates [ func (s *GaService) DescribeAcceleratorAutoRenewAttribute(id string) (object map[string]interface{}, err error) { var response map[string]interface{} - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } + client := s.client action := "DescribeAcceleratorAutoRenewAttribute" request := map[string]interface{}{ "RegionId": s.client.RegionId, "AcceleratorId": id, } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) || IsExpectedErrors(err, []string{"StateError.Accelerator"}) { wait() @@ -536,20 +497,15 @@ func (s *GaService) DescribeAcceleratorAutoRenewAttribute(id string) (object map func (s *GaService) DescribeGaAcl(id string) (object map[string]interface{}, err error) { var response map[string]interface{} - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } + client := s.client action := "GetAcl" request := map[string]interface{}{ "RegionId": s.client.RegionId, "AclId": id, } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -596,20 +552,15 @@ func (s *GaService) GaAclStateRefreshFunc(id string, failStates []string) resour func (s *GaService) GetAcl(id string) (object map[string]interface{}, err error) { var response map[string]interface{} - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } + client := s.client action := "GetAcl" request := map[string]interface{}{ "RegionId": s.client.RegionId, "AclId": id, } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -636,10 +587,7 @@ func (s *GaService) GetAcl(id string) (object map[string]interface{}, err error) func (s *GaService) DescribeGaAclAttachment(id string) (object map[string]interface{}, err error) { var response map[string]interface{} - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } + client := s.client action := "DescribeListener" parts, err := ParseResourceId(id, 2) if err != nil { @@ -651,11 +599,9 @@ func (s *GaService) DescribeGaAclAttachment(id string) (object map[string]interf "ListenerId": parts[0], } idExist := false - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -716,10 +662,7 @@ func (s *GaService) GaAclAttachmentStateRefreshFunc(id string, failStates []stri func (s *GaService) DescribeGaAdditionalCertificate(id string) (object map[string]interface{}, err error) { var response map[string]interface{} - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } + client := s.client action := "ListListenerCertificates" parts, err := ParseResourceId(id, 3) if err != nil { @@ -739,7 +682,7 @@ func (s *GaService) DescribeGaAdditionalCertificate(id string) (object map[strin runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -781,10 +724,7 @@ func (s *GaService) DescribeGaAdditionalCertificate(id string) (object map[strin func (s *GaService) DescribeGaAcceleratorSpareIpAttachment(id string) (object map[string]interface{}, err error) { var response map[string]interface{} - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } + client := s.client action := "GetSpareIp" parts, err := ParseResourceId(id, 2) if err != nil { @@ -796,11 +736,9 @@ func (s *GaService) DescribeGaAcceleratorSpareIpAttachment(id string) (object ma "AcceleratorId": parts[0], "SpareIp": parts[1], } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -847,20 +785,15 @@ func (s *GaService) GaAcceleratorSpareIpAttachmentStateRefreshFunc(id string, fa func (s *GaService) DescribeBandwidthPackageAutoRenewAttribute(id string) (object map[string]interface{}, err error) { var response map[string]interface{} - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } + client := s.client action := "DescribeBandwidthPackageAutoRenewAttribute" request := map[string]interface{}{ "RegionId": s.client.RegionId, "InstanceId": id, } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -884,13 +817,8 @@ func (s *GaService) DescribeBandwidthPackageAutoRenewAttribute(id string) (objec func (s *GaService) DescribeGaAccessLog(id string) (object map[string]interface{}, err error) { var response map[string]interface{} + client := s.client action := "DescribeLogStoreOfEndpointGroup" - - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } - parts, err := ParseResourceId(id, 3) if err != nil { return nil, WrapError(err) @@ -902,11 +830,9 @@ func (s *GaService) DescribeGaAccessLog(id string) (object map[string]interface{ "EndpointGroupId": parts[2], } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -957,14 +883,11 @@ func (s *GaService) GaAccessLogStateRefreshFunc(id string, failStates []string) func (s *GaService) DescribeGaAclEntryAttachment(id string) (object map[string]interface{}, err error) { var response map[string]interface{} - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } parts, err := ParseResourceId(id, 2) if err != nil { return object, WrapError(err) } + client := s.client action := "GetAcl" request := map[string]interface{}{ "RegionId": s.client.RegionId, @@ -972,11 +895,9 @@ func (s *GaService) DescribeGaAclEntryAttachment(id string) (object map[string]i } idExist := false - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -1016,24 +937,17 @@ func (s *GaService) DescribeGaAclEntryAttachment(id string) (object map[string]i } func (s *GaService) DescribeGaBasicAccelerator(id string) (object map[string]interface{}, err error) { + client := s.client var response map[string]interface{} action := "GetBasicAccelerator" - - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } - request := map[string]interface{}{ "RegionId": s.client.RegionId, "AcceleratorId": id, } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -1084,25 +998,18 @@ func (s *GaService) GaBasicAcceleratorStateRefreshFunc(id string, failStates []s } func (s *GaService) DescribeGaBasicEndpointGroup(id string) (object map[string]interface{}, err error) { + client := s.client var response map[string]interface{} action := "GetBasicEndpointGroup" - - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } - request := map[string]interface{}{ "RegionId": s.client.RegionId, "ClientToken": buildClientToken("GetBasicEndpointGroup"), "EndpointGroupId": id, } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -1152,25 +1059,18 @@ func (s *GaService) GaBasicEndpointGroupStateRefreshFunc(id string, failStates [ } func (s *GaService) DescribeGaBasicIpSet(id string) (object map[string]interface{}, err error) { + client := s.client var response map[string]interface{} action := "GetBasicIpSet" - - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } - request := map[string]interface{}{ "RegionId": s.client.RegionId, "ClientToken": buildClientToken("GetBasicIpSet"), "IpSetId": id, } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -1222,23 +1122,16 @@ func (s *GaService) GaBasicIpSetStateRefreshFunc(id string, failStates []string) func (s *GaService) DescribeGaBasicAccelerateIp(id string) (object map[string]interface{}, err error) { var response map[string]interface{} action := "GetBasicAccelerateIp" - - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } - + client := s.client request := map[string]interface{}{ "RegionId": s.client.RegionId, "ClientToken": buildClientToken("GetBasicAccelerateIp"), "AccelerateIpId": id, } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -1290,12 +1183,7 @@ func (s *GaService) GaBasicAccelerateIpStateRefreshFunc(id string, failStates [] func (s *GaService) DescribeGaBasicEndpoint(id string) (object map[string]interface{}, err error) { var response map[string]interface{} action := "GetBasicEndpoint" - - conn, err := s.client.NewGaplusClient() - if err != nil { - return object, WrapError(err) - } - + client := s.client parts, err := ParseResourceId(id, 2) if err != nil { return nil, WrapError(err) @@ -1307,11 +1195,9 @@ func (s *GaService) DescribeGaBasicEndpoint(id string) (object map[string]interf "EndpointId": parts[1], } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -1361,14 +1247,9 @@ func (s *GaService) GaBasicEndpointStateRefreshFunc(id string, failStates []stri } func (s *GaService) DescribeGaBasicAccelerateIpEndpointRelation(id string) (object map[string]interface{}, err error) { + client := s.client var response map[string]interface{} action := "GetBasicAccelerateIpEndpointRelation" - - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } - parts, err := ParseResourceId(id, 3) if err != nil { return nil, WrapError(err) @@ -1382,11 +1263,9 @@ func (s *GaService) DescribeGaBasicAccelerateIpEndpointRelation(id string) (obje "EndpointId": parts[2], } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -1437,10 +1316,7 @@ func (s *GaService) GaBasicAccelerateIpEndpointRelationStateRefreshFunc(id strin } func (s *GaService) DescribeGaDomain(id string) (object map[string]interface{}, err error) { - conn, err := s.client.NewGaplusClient() - if err != nil { - return object, WrapError(err) - } + client := s.client parts, err := ParseResourceId(id, 2) if err != nil { return object, WrapError(err) @@ -1454,11 +1330,9 @@ func (s *GaService) DescribeGaDomain(id string) (object map[string]interface{}, var response map[string]interface{} action := "ListDomains" - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - resp, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -1466,7 +1340,6 @@ func (s *GaService) DescribeGaDomain(id string) (object map[string]interface{}, } return resource.NonRetryableError(err) } - response = resp addDebug(action, response, request) return nil }) @@ -1487,21 +1360,16 @@ func (s *GaService) DescribeGaCustomRoutingEndpointGroup(id string) (object map[ var response map[string]interface{} action := "DescribeCustomRoutingEndpointGroup" - conn, err := s.client.NewGaplusClient() - if err != nil { - return object, WrapError(err) - } + client := s.client request := map[string]interface{}{ "RegionId": s.client.RegionId, "EndpointGroupId": id, } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -1559,10 +1427,7 @@ func (s *GaService) DescribeGaCustomRoutingEndpointGroupDestination(id string) ( var response map[string]interface{} action := "DescribeCustomRoutingEndpointGroupDestinations" - conn, err := s.client.NewGaplusClient() - if err != nil { - return object, WrapError(err) - } + client := s.client parts, err := ParseResourceId(id, 2) if err != nil { @@ -1574,11 +1439,9 @@ func (s *GaService) DescribeGaCustomRoutingEndpointGroupDestination(id string) ( "DestinationId": parts[1], } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -1636,10 +1499,7 @@ func (s *GaService) DescribeGaCustomRoutingEndpoint(id string) (object map[strin var response map[string]interface{} action := "DescribeCustomRoutingEndpoint" - conn, err := s.client.NewGaplusClient() - if err != nil { - return object, WrapError(err) - } + client := s.client parts, err := ParseResourceId(id, 2) if err != nil { @@ -1652,11 +1512,9 @@ func (s *GaService) DescribeGaCustomRoutingEndpoint(id string) (object map[strin "EndpointId": parts[1], } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -1714,10 +1572,7 @@ func (s *GaService) DescribeGaCustomRoutingEndpointTrafficPolicy(id string) (obj var response map[string]interface{} action := "DescribeCustomRoutingEndPointTrafficPolicy" - conn, err := s.client.NewGaplusClient() - if err != nil { - return object, WrapError(err) - } + client := s.client parts, err := ParseResourceId(id, 2) if err != nil { @@ -1730,11 +1585,9 @@ func (s *GaService) DescribeGaCustomRoutingEndpointTrafficPolicy(id string) (obj "PolicyId": parts[1], } - runtime := util.RuntimeOptions{} - runtime.SetAutoretry(true) wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &runtime) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -1789,10 +1642,7 @@ func (s *GaService) GaCustomRoutingEndpointTrafficPolicyStateRefreshFunc(id stri } func (s *GaService) ListTagResources(id string, resourceType string) (object interface{}, err error) { - conn, err := s.client.NewGaplusClient() - if err != nil { - return nil, WrapError(err) - } + client := s.client action := "ListTagResources" request := map[string]interface{}{ @@ -1819,7 +1669,7 @@ func (s *GaService) ListTagResources(id string, resourceType string) (object int for { wait := incrementalWait(3*time.Second, 3*time.Second) err = resource.Retry(5*time.Minute, func() *resource.RetryError { - response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, true) if err != nil { if NeedRetry(err) { wait() @@ -1853,17 +1703,13 @@ func (s *GaService) ListTagResources(id string, resourceType string) (object int } func (s *GaService) SetResourceTags(d *schema.ResourceData, resourceType string) error { - + client := s.client resourceIdNum := strings.Count(d.Id(), ":") if d.HasChange("tags") { added, removed := parsingTags(d) var response map[string]interface{} - conn, err := s.client.NewGaplusClient() - if err != nil { - return WrapError(err) - } - + var err error removedTagKeys := make([]string, 0) for _, v := range removed { if !ignoredTags(v, "") { @@ -1894,7 +1740,7 @@ func (s *GaService) SetResourceTags(d *schema.ResourceData, resourceType string) } wait := incrementalWait(2*time.Second, 1*time.Second) err := resource.Retry(10*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, false) if err != nil { if NeedRetry(err) { wait() @@ -1938,7 +1784,7 @@ func (s *GaService) SetResourceTags(d *schema.ResourceData, resourceType string) wait := incrementalWait(2*time.Second, 1*time.Second) err := resource.Retry(10*time.Minute, func() *resource.RetryError { - response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2019-11-20"), StringPointer("AK"), nil, request, &util.RuntimeOptions{}) + response, err = client.RpcPost("Ga", "2019-11-20", action, nil, request, false) if err != nil { if NeedRetry(err) { wait() diff --git a/website/docs/d/ga_accelerator_spare_ip_attachments.html.markdown b/website/docs/d/ga_accelerator_spare_ip_attachments.html.markdown index ec82cc75c7fb..c744540cd77d 100644 --- a/website/docs/d/ga_accelerator_spare_ip_attachments.html.markdown +++ b/website/docs/d/ga_accelerator_spare_ip_attachments.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Ga Accelerator Spare Ip Attachments to the user. --- -# alicloud\_ga\_accelerator\_spare\_ip\_attachments +# alicloud_ga_accelerator_spare_ip_attachments This data source provides the Ga Accelerator Spare Ip Attachments of the current Alibaba Cloud user. --> **NOTE:** Available in v1.167.0+. +-> **NOTE:** Available since v1.167.0. ## Example Usage @@ -36,12 +36,12 @@ The following arguments are supported: * `output_file` - (Optional) File name where to save data source results (after running `terraform plan`). * `status` - (Optional, ForceNew) The status of the standby CNAME IP address. Valid values: `active`, `inuse`. -## Argument Reference +## Attributes Reference The following attributes are exported in addition to the arguments listed above: * `attachments` - A list of Ga Accelerator Spare Ip Attachments. Each element contains the following attributes: - * `accelerator_id` - The ID of the global acceleration instance. - * `id` - The ID of the Accelerator Spare Ip Attachment. - * `spare_ip` - The standby IP address of CNAME. When the acceleration area is abnormal, the traffic is switched to the standby IP address. - * `status` - The status of the standby CNAME IP address. Valid values: `active`, `inuse`. \ No newline at end of file + * `accelerator_id` - The ID of the global acceleration instance. + * `id` - The ID of the Accelerator Spare Ip Attachment. + * `spare_ip` - The standby IP address of CNAME. When the acceleration area is abnormal, the traffic is switched to the standby IP address. + * `status` - The status of the standby CNAME IP address. Valid values: `active`, `inuse`. \ No newline at end of file diff --git a/website/docs/d/ga_acls.html.markdown b/website/docs/d/ga_acls.html.markdown index 90851ae21966..a45564ecffde 100644 --- a/website/docs/d/ga_acls.html.markdown +++ b/website/docs/d/ga_acls.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Ga Acls to the user. --- -# alicloud\_ga\_acls +# alicloud_ga_acls This data source provides the Ga Acls of the current Alibaba Cloud user. --> **NOTE:** Available in v1.150.0+. +-> **NOTE:** Available since v1.150.0. ## Example Usage @@ -42,17 +42,17 @@ The following arguments are supported: * `output_file` - (Optional) File name where to save data source results (after running `terraform plan`). * `status` - (Optional, ForceNew) The status of the resource. Valid values: `active`, `configuring`, `deleting`, `init`. -## Argument Reference +## Attributes Reference The following attributes are exported in addition to the arguments listed above: * `names` - A list of Acl names. * `acls` - A list of Ga Acls. Each element contains the following attributes: - * `acl_entries` - The entries of the Acl. - * `entry` - The IP entry that you want to add to the ACL. - * `entry_description` - The description of the IP entry. - * `acl_id` - The ID of the Acl. - * `acl_name` - The name of the acl. - * `address_ip_version` - The address ip version. - * `id` - The ID of the Acl. Its value is same as `acl_id`. - * `status` - The status of the resource. \ No newline at end of file + * `acl_entries` - The entries of the Acl. + * `entry` - The IP entry that you want to add to the ACL. + * `entry_description` - The description of the IP entry. + * `acl_id` - The ID of the Acl. + * `acl_name` - The name of the acl. + * `address_ip_version` - The address ip version. + * `id` - The ID of the Acl. Its value is same as `acl_id`. + * `status` - The status of the resource. \ No newline at end of file diff --git a/website/docs/d/ga_additional_certificates.html.markdown b/website/docs/d/ga_additional_certificates.html.markdown index 757ff38dacb6..20072979e0de 100644 --- a/website/docs/d/ga_additional_certificates.html.markdown +++ b/website/docs/d/ga_additional_certificates.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Ga Additional Certificates to the user. --- -# alicloud\_ga\_additional\_certificates +# alicloud_ga_additional_certificates This data source provides the Ga Additional Certificates of the current Alibaba Cloud user. --> **NOTE:** Available in v1.150.0+. +-> **NOTE:** Available since v1.150.0. ## Example Usage @@ -37,13 +37,13 @@ The following arguments are supported: * `listener_id` - (Required, ForceNew) The ID of the listener. Only HTTPS listeners support this parameter. * `output_file` - (Optional) File name where to save data source results (after running `terraform plan`). -## Argument Reference +## Attributes Reference The following attributes are exported in addition to the arguments listed above: * `certificates` - A list of Ga Additional Certificates. Each element contains the following attributes: - * `accelerator_id` - The ID of the GA instance. - * `certificate_id` - The Certificate ID. - * `domain` - The domain name specified by the certificate. - * `id` - The ID of the Additional Certificate. The value formats as `::`. - * `listener_id` - The ID of the listener. Only HTTPS listeners support this parameter. \ No newline at end of file + * `accelerator_id` - The ID of the GA instance. + * `certificate_id` - The Certificate ID. + * `domain` - The domain name specified by the certificate. + * `id` - The ID of the Additional Certificate. The value formats as `::`. + * `listener_id` - The ID of the listener. Only HTTPS listeners support this parameter. \ No newline at end of file diff --git a/website/docs/d/ga_bandwidth_packages.html.markdown b/website/docs/d/ga_bandwidth_packages.html.markdown index 7da4d6170ae2..e3c7a14ee6e7 100644 --- a/website/docs/d/ga_bandwidth_packages.html.markdown +++ b/website/docs/d/ga_bandwidth_packages.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Global Accelerator (GA) Bandwidth Packages to the user. --- -# alicloud\_ga\_bandwidth\_packages +# alicloud_ga_bandwidth_packages This data source provides the Global Accelerator (GA) Bandwidth Packages of the current Alibaba Cloud user. --> **NOTE:** Available in v1.112.0+. +-> **NOTE:** Available since v1.112.0. ## Example Usage @@ -39,21 +39,21 @@ The following arguments are supported: * `type` - (Optional, ForceNew) The type of the bandwidth plan. Valid values: `Basic`, `CrossDomain`. * `enable_details` - (Optional) Default to `false`. Set it to `true` can output more details about resource attributes. -## Argument Reference +## Attributes Reference The following attributes are exported in addition to the arguments listed above: * `names` - A list of Bandwidth Package names. * `packages` - A list of Ga Bandwidth Packages. Each element contains the following attributes: - * `bandwidth` - The bandwidth value of bandwidth packet. - * `bandwidth_package_id` - The Resource ID of the bandwidth. - * `bandwidth_package_name` - The name of the bandwidth packet. - * `bandwidth_type` - The bandwidth type of the bandwidth. - * `cbn_geographic_region_ida` - Interworking area A of cross domain acceleration package. Only international stations support returning this parameter. - * `cbn_geographic_region_idb` - Interworking area B of cross domain acceleration package. Only international stations support returning this parameter. - * `description` - The description of bandwidth package. - * `expired_time` - Bandwidth package expiration time. - * `id` - The ID of the Bandwidth Package. - * `payment_type` - The payment type of the bandwidth. - * `status` - The status of the bandwidth plan. - * `type` - The type of the bandwidth packet. China station only supports return to basic. + * `bandwidth` - The bandwidth value of bandwidth packet. + * `bandwidth_package_id` - The Resource ID of the bandwidth. + * `bandwidth_package_name` - The name of the bandwidth packet. + * `bandwidth_type` - The bandwidth type of the bandwidth. + * `cbn_geographic_region_ida` - Interworking area A of cross domain acceleration package. Only international stations support returning this parameter. + * `cbn_geographic_region_idb` - Interworking area B of cross domain acceleration package. Only international stations support returning this parameter. + * `description` - The description of bandwidth package. + * `expired_time` - Bandwidth package expiration time. + * `id` - The ID of the Bandwidth Package. + * `payment_type` - The payment type of the bandwidth. + * `status` - The status of the bandwidth plan. + * `type` - The type of the bandwidth packet. China station only supports return to basic. diff --git a/website/docs/d/ga_basic_accelerate_ip_endpoint_relations.html.markdown b/website/docs/d/ga_basic_accelerate_ip_endpoint_relations.html.markdown index ee8a21b211f6..ddecb94070c9 100644 --- a/website/docs/d/ga_basic_accelerate_ip_endpoint_relations.html.markdown +++ b/website/docs/d/ga_basic_accelerate_ip_endpoint_relations.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Global Accelerator (GA) Basic Accelerate Ip Endpoint Relations to the user. --- -# alicloud\_ga\_basic\_accelerate\_ip\_endpoint\_relations +# alicloud_ga_basic_accelerate_ip_endpoint_relations This data source provides the Global Accelerator (GA) Basic Accelerate Ip Endpoint Relations of the current Alibaba Cloud user. --> **NOTE:** Available in v1.194.0+. +-> **NOTE:** Available since v1.194.0. ## Example Usage @@ -44,16 +44,16 @@ The following arguments are supported: The following attributes are exported in addition to the arguments listed above: * `relations` - A list of Global Accelerator Basic Accelerate Ip Endpoint Relations. Each element contains the following attributes: - * `id` - The id of the Global Accelerator Basic Accelerate Ip Endpoint Relation. It formats as `::`. - * `accelerator_id` - The ID of the Global Accelerator Basic Accelerator instance. - * `accelerate_ip_id` - The ID of the Basic Accelerate IP. - * `endpoint_id` - The ID of the Basic Endpoint. - * `endpoint_type` - The type of the Basic Endpoint. - * `endpoint_address` - The address of the Basic Endpoint. - * `endpoint_sub_address_type` - The sub address type of the Basic Endpoint. - * `endpoint_sub_address` - The sub address of the Basic Endpoint. - * `endpoint_zone_id` - The zone id of the Basic Endpoint. - * `ip_address` - The address of the Basic Accelerate IP. - * `basic_endpoint_name` - The name of the Basic Endpoint. - * `status` - The status of the Basic Accelerate Ip Endpoint Relation. + * `id` - The id of the Global Accelerator Basic Accelerate Ip Endpoint Relation. It formats as `::`. + * `accelerator_id` - The ID of the Global Accelerator Basic Accelerator instance. + * `accelerate_ip_id` - The ID of the Basic Accelerate IP. + * `endpoint_id` - The ID of the Basic Endpoint. + * `endpoint_type` - The type of the Basic Endpoint. + * `endpoint_address` - The address of the Basic Endpoint. + * `endpoint_sub_address_type` - The sub address type of the Basic Endpoint. + * `endpoint_sub_address` - The sub address of the Basic Endpoint. + * `endpoint_zone_id` - The zone id of the Basic Endpoint. + * `ip_address` - The address of the Basic Accelerate IP. + * `basic_endpoint_name` - The name of the Basic Endpoint. + * `status` - The status of the Basic Accelerate Ip Endpoint Relation. \ No newline at end of file diff --git a/website/docs/d/ga_basic_accelerate_ips.html.markdown b/website/docs/d/ga_basic_accelerate_ips.html.markdown index ba79db579858..74ae346daed5 100644 --- a/website/docs/d/ga_basic_accelerate_ips.html.markdown +++ b/website/docs/d/ga_basic_accelerate_ips.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Global Accelerator (GA) Basic Accelerate IPs to the user. --- -# alicloud\_ga\_basic\_accelerate\_ips +# alicloud_ga_basic_accelerate_ips This data source provides the Global Accelerator (GA) Basic Accelerate IPs of the current Alibaba Cloud user. --> **NOTE:** Available in v1.194.0+. +-> **NOTE:** Available since v1.194.0. ## Example Usage @@ -44,10 +44,10 @@ The following arguments are supported: The following attributes are exported in addition to the arguments listed above: * `ips` - A list of Global Accelerator Basic Accelerate IPs. Each element contains the following attributes: - * `id` - The id of the Basic Accelerate IP. - * `accelerate_ip_id` - The id of the Basic Accelerate IP. - * `accelerate_ip_address` - The address of the Basic Accelerate IP. - * `accelerator_id` - The id of the Global Accelerator Basic Accelerator instance. - * `ip_set_id` - The ID of the Basic Ip Set. - * `status` - The status of the Basic Accelerate IP instance. + * `id` - The id of the Basic Accelerate IP. + * `accelerate_ip_id` - The id of the Basic Accelerate IP. + * `accelerate_ip_address` - The address of the Basic Accelerate IP. + * `accelerator_id` - The id of the Global Accelerator Basic Accelerator instance. + * `ip_set_id` - The ID of the Basic Ip Set. + * `status` - The status of the Basic Accelerate IP instance. \ No newline at end of file diff --git a/website/docs/d/ga_basic_accelerators.html.markdown b/website/docs/d/ga_basic_accelerators.html.markdown index b5edee644b1f..d2855c9a1728 100644 --- a/website/docs/d/ga_basic_accelerators.html.markdown +++ b/website/docs/d/ga_basic_accelerators.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Global Accelerator (GA) Basic Accelerators to the user. --- -# alicloud\_ga\_basic\_accelerators +# alicloud_ga_basic_accelerators This data source provides the Global Accelerator (GA) Basic Accelerators of the current Alibaba Cloud user. --> **NOTE:** Available in v1.194.0+. +-> **NOTE:** Available since v1.194.0. ## Example Usage @@ -51,22 +51,22 @@ The following attributes are exported in addition to the arguments listed above: * `names` - A list of Global Accelerator Basic Accelerator names. * `accelerators` - A list of Global Accelerator Basic Accelerators. Each element contains the following attributes: - * `id` - The id of the Global Accelerator Basic Accelerator. - * `basic_accelerator_id` - The id of the Global Accelerator Basic Accelerator instance. - * `basic_accelerator_name` - The name of the Global Accelerator Basic Accelerator instance. - * `basic_endpoint_group_id` - The ID of the endpoint group that is associated with the Global Accelerator Basic Accelerator instance. - * `basic_ip_set_id` - The ID of the acceleration region. - * `bandwidth_billing_type` - The bandwidth billing method. - * `instance_charge_type` - The billing method of the Global Accelerator Basic Accelerator instance. Only `PREPAY` is returned, which indicates the subscription billing method. - * `description` - The description of the Global Accelerator Basic Accelerator instance. - * `region_id` - The ID of the region where the Global Accelerator Basic Accelerator instance is deployed. - * `create_time` - The timestamp that indicates when the Global Accelerator Basic Accelerator instance was created. - * `expired_time` - The timestamp that indicates when the Global Accelerator Basic Accelerator instance was expired. - * `status` - The status of the Global Accelerator Basic Accelerator instance. - * `basic_bandwidth_package` - The details about the basic bandwidth plan that is associated with the Global Accelerator Basic Accelerator instance. - * `instance_id` - The ID of the basic bandwidth plan. - * `bandwidth` - The bandwidth value of the basic bandwidth plan. Unit: Mbit/s. - * `bandwidth_type` - The type of the bandwidth that is provided by the basic bandwidth plan. - * `cross_domain_bandwidth_package` - The details about the cross-region acceleration bandwidth plan that is associated with the Global Accelerator Basic Accelerator instance. **NOTE:** This array is returned only for Global Accelerator Basic Accelerator instances that are created on the International site. - * `instance_id` - The ID of the cross-region acceleration bandwidth plan. - * `bandwidth` - The bandwidth value of the cross-region acceleration bandwidth plan. Unit: Mbit/s. + * `id` - The id of the Global Accelerator Basic Accelerator. + * `basic_accelerator_id` - The id of the Global Accelerator Basic Accelerator instance. + * `basic_accelerator_name` - The name of the Global Accelerator Basic Accelerator instance. + * `basic_endpoint_group_id` - The ID of the endpoint group that is associated with the Global Accelerator Basic Accelerator instance. + * `basic_ip_set_id` - The ID of the acceleration region. + * `bandwidth_billing_type` - The bandwidth billing method. + * `instance_charge_type` - The billing method of the Global Accelerator Basic Accelerator instance. Only `PREPAY` is returned, which indicates the subscription billing method. + * `description` - The description of the Global Accelerator Basic Accelerator instance. + * `region_id` - The ID of the region where the Global Accelerator Basic Accelerator instance is deployed. + * `create_time` - The timestamp that indicates when the Global Accelerator Basic Accelerator instance was created. + * `expired_time` - The timestamp that indicates when the Global Accelerator Basic Accelerator instance was expired. + * `status` - The status of the Global Accelerator Basic Accelerator instance. + * `basic_bandwidth_package` - The details about the basic bandwidth plan that is associated with the Global Accelerator Basic Accelerator instance. + * `instance_id` - The ID of the basic bandwidth plan. + * `bandwidth` - The bandwidth value of the basic bandwidth plan. Unit: Mbit/s. + * `bandwidth_type` - The type of the bandwidth that is provided by the basic bandwidth plan. + * `cross_domain_bandwidth_package` - The details about the cross-region acceleration bandwidth plan that is associated with the Global Accelerator Basic Accelerator instance. **NOTE:** This array is returned only for Global Accelerator Basic Accelerator instances that are created on the International site. + * `instance_id` - The ID of the cross-region acceleration bandwidth plan. + * `bandwidth` - The bandwidth value of the cross-region acceleration bandwidth plan. Unit: Mbit/s. diff --git a/website/docs/d/ga_basic_endpoints.html.markdown b/website/docs/d/ga_basic_endpoints.html.markdown index b3b7fed3ab62..f3f6bd82d713 100644 --- a/website/docs/d/ga_basic_endpoints.html.markdown +++ b/website/docs/d/ga_basic_endpoints.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Global Accelerator (GA) Basic Endpoints to the user. --- -# alicloud\_ga\_basic\_endpoints +# alicloud_ga_basic_endpoints This data source provides the Global Accelerator (GA) Basic Endpoints of the current Alibaba Cloud user. --> **NOTE:** Available in v1.194.0+. +-> **NOTE:** Available since v1.194.0. ## Example Usage @@ -56,15 +56,15 @@ The following attributes are exported in addition to the arguments listed above: * `names` - A list of Global Accelerator Basic Endpoint names. * `endpoints` - A list of Global Accelerator Basic Endpoints. Each element contains the following attributes: - * `id` - The id of the Global Accelerator Basic Endpoint. It formats as `:`. - * `endpoint_group_id` - The ID of the Basic Endpoint Group. - * `endpoint_id` - The ID of the Basic Endpoint. - * `accelerator_id` - The ID of the Global Accelerator Basic Accelerator instance. - * `endpoint_type` - The type of the Basic Endpoint. - * `endpoint_address` - The address of the Basic Endpoint. - * `endpoint_sub_address_type` - The sub address type of the Basic Endpoint. - * `endpoint_sub_address` - The sub address of the Basic Endpoint. - * `endpoint_zone_id` - The zone id of the Basic Endpoint. - * `basic_endpoint_name` - The name of the Basic Endpoint. - * `status` - The status of the Basic Endpoint. + * `id` - The id of the Global Accelerator Basic Endpoint. It formats as `:`. + * `endpoint_group_id` - The ID of the Basic Endpoint Group. + * `endpoint_id` - The ID of the Basic Endpoint. + * `accelerator_id` - The ID of the Global Accelerator Basic Accelerator instance. + * `endpoint_type` - The type of the Basic Endpoint. + * `endpoint_address` - The address of the Basic Endpoint. + * `endpoint_sub_address_type` - The sub address type of the Basic Endpoint. + * `endpoint_sub_address` - The sub address of the Basic Endpoint. + * `endpoint_zone_id` - The zone id of the Basic Endpoint. + * `basic_endpoint_name` - The name of the Basic Endpoint. + * `status` - The status of the Basic Endpoint. \ No newline at end of file diff --git a/website/docs/d/ga_custom_routing_endpoint_group_destinations.html.markdown b/website/docs/d/ga_custom_routing_endpoint_group_destinations.html.markdown index f00bbc6eeada..9119dffcefff 100644 --- a/website/docs/d/ga_custom_routing_endpoint_group_destinations.html.markdown +++ b/website/docs/d/ga_custom_routing_endpoint_group_destinations.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Global Accelerator (GA) Custom Routing Endpoint Group Destinations to the user. --- -# alicloud\_ga\_custom\_routing\_endpoint\_group\_destinations +# alicloud_ga_custom_routing_endpoint_group_destinations This data source provides the Global Accelerator (GA) Custom Routing Endpoint Group Destinations of the current Alibaba Cloud user. --> **NOTE:** Available in 1.197.0+ +-> **NOTE:** Available since 1.197.0. ## Example Usage diff --git a/website/docs/d/ga_custom_routing_endpoint_groups.html.markdown b/website/docs/d/ga_custom_routing_endpoint_groups.html.markdown index 7b75a0d2508f..280c2ac4df2e 100644 --- a/website/docs/d/ga_custom_routing_endpoint_groups.html.markdown +++ b/website/docs/d/ga_custom_routing_endpoint_groups.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Global Accelerator (GA) Custom Routing Endpoint Groups to the user. --- -# alicloud\_ga\_custom\_routing\_endpoint\_groups +# alicloud_ga_custom_routing_endpoint_groups This data source provides the Global Accelerator (GA) Custom Routing Endpoint Groups of the current Alibaba Cloud user. --> **NOTE:** Available in 1.197.0+ +-> **NOTE:** Available since 1.197.0. ## Example Usage diff --git a/website/docs/d/ga_custom_routing_endpoint_traffic_policies.html.markdown b/website/docs/d/ga_custom_routing_endpoint_traffic_policies.html.markdown index f34d24cdc453..aa834a4bdd48 100644 --- a/website/docs/d/ga_custom_routing_endpoint_traffic_policies.html.markdown +++ b/website/docs/d/ga_custom_routing_endpoint_traffic_policies.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Global Accelerator (GA) Custom Routing Endpoint Traffic Policies to the user. --- -# alicloud\_ga\_custom\_routing\_endpoint\_traffic\_policies +# alicloud_ga_custom_routing_endpoint_traffic_policies This data source provides the Global Accelerator (GA) Custom Routing Endpoint Traffic Policies of the current Alibaba Cloud user. --> **NOTE:** Available in 1.197.0+ +-> **NOTE:** Available since 1.197.0. ## Example Usage diff --git a/website/docs/d/ga_custom_routing_endpoints.html.markdown b/website/docs/d/ga_custom_routing_endpoints.html.markdown index f8d738cbffde..57280ff4a845 100644 --- a/website/docs/d/ga_custom_routing_endpoints.html.markdown +++ b/website/docs/d/ga_custom_routing_endpoints.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Global Accelerator (GA) Custom Routing Endpoints to the user. --- -# alicloud\_ga\_custom\_routing\_endpoints +# alicloud_ga_custom_routing_endpoints This data source provides the Global Accelerator (GA) Custom Routing Endpoints of the current Alibaba Cloud user. --> **NOTE:** Available in 1.197.0+ +-> **NOTE:** Available since 1.197.0. ## Example Usage diff --git a/website/docs/d/ga_custom_routing_port_mappings.html.markdown b/website/docs/d/ga_custom_routing_port_mappings.html.markdown index 246078782a8a..4fd87629b94a 100644 --- a/website/docs/d/ga_custom_routing_port_mappings.html.markdown +++ b/website/docs/d/ga_custom_routing_port_mappings.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Global Accelerator (GA) Custom Routing Port Mappings to the user. --- -# alicloud\_ga\_custom\_routing\_port\_mappings +# alicloud_ga_custom_routing_port_mappings This data source provides the Global Accelerator (GA) Custom Routing Port Mappings of the current Alibaba Cloud user. --> **NOTE:** Available in 1.197.0+ +-> **NOTE:** Available since 1.197.0. ## Example Usage diff --git a/website/docs/d/ga_domains.html.markdown b/website/docs/d/ga_domains.html.markdown index 5d0ced940280..d55c03316f3e 100644 --- a/website/docs/d/ga_domains.html.markdown +++ b/website/docs/d/ga_domains.html.markdown @@ -11,7 +11,7 @@ description: |- This data source provides Ga Domain available to the user.[What is Domain](https://www.alibabacloud.com/help/en/global-accelerator/latest/createdomain) --> **NOTE:** Available in 1.197.0+ +-> **NOTE:** Available since 1.197.0. ## Example Usage diff --git a/website/docs/d/ga_forwarding_rules.html.markdown b/website/docs/d/ga_forwarding_rules.html.markdown index 1276b76431c5..ec221e8efba4 100644 --- a/website/docs/d/ga_forwarding_rules.html.markdown +++ b/website/docs/d/ga_forwarding_rules.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Global Accelerator (GA) Forwarding Rules to the user. --- -# alicloud\_ga\_forwarding\_rules +# alicloud_ga_forwarding_rules This data source provides the Global Accelerator (GA) Forwarding Rules of the current Alibaba Cloud user. --> **NOTE:** Available in v1.120.0+. +-> **NOTE:** Available since v1.120.0. ## Example Usage @@ -39,26 +39,26 @@ The following arguments are supported: * `output_file` - (Optional) File name where to save data source results (after running `terraform plan`). * `status` - (Optional, ForceNew) The status of the acceleration region. Valid values: `active`, `configuring`. -## Argument Reference +## Attributes Reference The following attributes are exported in addition to the arguments listed above: * `forwarding_rules` - A list of Ga Forwarding Rules. Each element contains the following attributes: - * `priority` - Forwarding policy priority. - * `forwarding_rule_id` - Forwarding Policy ID. - * `forwarding_rule_name` - Forwarding policy name. The length of the name is 2-128 English or Chinese characters. - * `listener_id` - The ID of the listener. - * `rule_conditions` - Forward action. - `rule_condition_type` - Forwarding condition type. - `path_config` - Path configuration information. - `values` - The length of the path is 1-128 characters. - `host_config` - Domain name configuration information. - `values` - The domain name is 3-128 characters long. - * `rule_actions` - The IP protocol used by the GA instance. - `order` - Forwarding priority. - `rule_action_type` - Forward action type. - `forward_group_config` - Forwarding configuration. - `server_group_tuples` - Terminal node group configuration. - `endpoint_group_id` - Terminal node group ID. - * `id` - The resource ID in terraform of Forwarding Rule. - * `forwarding_rule_status` - Forwarding Policy Status. + * `priority` - Forwarding policy priority. + * `forwarding_rule_id` - Forwarding Policy ID. + * `forwarding_rule_name` - Forwarding policy name. The length of the name is 2-128 English or Chinese characters. + * `listener_id` - The ID of the listener. + * `rule_conditions` - Forward action. + * `rule_condition_type` - Forwarding condition type. + * `path_config` - Path configuration information. + * `values` - The length of the path is 1-128 characters. + * `host_config` - Domain name configuration information. + * `values` - The domain name is 3-128 characters long. + * `rule_actions` - The IP protocol used by the GA instance. + * `order` - Forwarding priority. + * `rule_action_type` - Forward action type. + * `forward_group_config` - Forwarding configuration. + * `server_group_tuples` - Terminal node group configuration. + * `endpoint_group_id` - Terminal node group ID. + * `id` - The resource ID in terraform of Forwarding Rule. + * `forwarding_rule_status` - Forwarding Policy Status. diff --git a/website/docs/d/ga_ip_sets.html.markdown b/website/docs/d/ga_ip_sets.html.markdown index 3e552c82cb78..3116f391a78b 100644 --- a/website/docs/d/ga_ip_sets.html.markdown +++ b/website/docs/d/ga_ip_sets.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Global Accelerator (GA) Ip Sets to the user. --- -# alicloud\_ga\_ip\_sets +# alicloud_ga_ip_sets This data source provides the Global Accelerator (GA) Ip Sets of the current Alibaba Cloud user. --> **NOTE:** Available in v1.113.0+. +-> **NOTE:** Available since v1.113.0. ## Example Usage @@ -37,15 +37,15 @@ The following arguments are supported: * `output_file` - (Optional) File name where to save data source results (after running `terraform plan`). * `status` - (Optional, ForceNew) The status of the acceleration region. Valid values: `active`, `deleting`, `init`, `updating`. -## Argument Reference +## Attributes Reference The following attributes are exported in addition to the arguments listed above: * `sets` - A list of Ga Ip Sets. Each element contains the following attributes: - * `accelerate_region_id` - The ID of an acceleration region. - * `bandwidth` - The bandwidth allocated to the acceleration region. - * `id` - The ID of the Ip Set. - * `ip_address_list` - The list of accelerated IP addresses in the acceleration region. - * `ip_set_id` - Accelerated area ID. - * `ip_version` - The IP protocol used by the GA instance. - * `status` - The status of the acceleration region. + * `accelerate_region_id` - The ID of an acceleration region. + * `bandwidth` - The bandwidth allocated to the acceleration region. + * `id` - The ID of the Ip Set. + * `ip_address_list` - The list of accelerated IP addresses in the acceleration region. + * `ip_set_id` - Accelerated area ID. + * `ip_version` - The IP protocol used by the GA instance. + * `status` - The status of the acceleration region. diff --git a/website/docs/d/ga_listeners.html.markdown b/website/docs/d/ga_listeners.html.markdown index a40eca915d87..1b35b4507e26 100644 --- a/website/docs/d/ga_listeners.html.markdown +++ b/website/docs/d/ga_listeners.html.markdown @@ -7,11 +7,11 @@ description: |- Provides a list of Global Accelerator (GA) Listeners to the user. --- -# alicloud\_ga\_listeners +# alicloud_ga_listeners This data source provides the Global Accelerator (GA) Listeners of the current Alibaba Cloud user. --> **NOTE:** Available in v1.111.0+. +-> **NOTE:** Available since v1.111.0. ## Example Usage @@ -39,22 +39,22 @@ The following arguments are supported: * `output_file` - (Optional) File name where to save data source results (after running `terraform plan`). * `status` - (Optional, ForceNew) The status of the listener. Valid values: `active`, `configuring`, `creating`. -## Argument Reference +## Attributes Reference The following attributes are exported in addition to the arguments listed above: * `names` - A list of Listener names. * `listeners` - A list of Ga Listeners. Each element contains the following attributes: - * `certificates` - The certificates of the listener. - * `id` - The id of the certificate. - * `type` - The type of the certificate. - * `client_affinity` - The clientAffinity of the listener. - * `description` - The description of the listener. - * `id` - The ID of the Listener. - * `listener_id` - The listenerId of the listener. - * `name` - The name of the listener. The length of the name is 2-128 characters. It starts with uppercase and lowercase letters or Chinese characters. It can contain numbers and underscores and dashes. - * `port_ranges` - The portRanges of the listener. - * `from_port` - The initial listening port used to receive requests and forward them to terminal nodes. - * `to_port` - The end listening port used to receive requests and forward them to terminal nodes. - * `protocol` - Type of network transport protocol monitored. - * `status` - The status of the listener. + * `certificates` - The certificates of the listener. + * `id` - The id of the certificate. + * `type` - The type of the certificate. + * `client_affinity` - The clientAffinity of the listener. + * `description` - The description of the listener. + * `id` - The ID of the Listener. + * `listener_id` - The listenerId of the listener. + * `name` - The name of the listener. The length of the name is 2-128 characters. It starts with uppercase and lowercase letters or Chinese characters. It can contain numbers and underscores and dashes. + * `port_ranges` - The portRanges of the listener. + * `from_port` - The initial listening port used to receive requests and forward them to terminal nodes. + * `to_port` - The end listening port used to receive requests and forward them to terminal nodes. + * `protocol` - Type of network transport protocol monitored. + * `status` - The status of the listener.