From 0ee6c2b3b30a4af7d39a34a05442764e9955776f Mon Sep 17 00:00:00 2001 From: "guimin.hgm" Date: Thu, 17 Oct 2024 17:54:08 +0800 Subject: [PATCH] add irregularProductEndpointForIntl --- alicloud/connectivity/endpoint.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/alicloud/connectivity/endpoint.go b/alicloud/connectivity/endpoint.go index 3199b895862a..5d8f2c34dcca 100644 --- a/alicloud/connectivity/endpoint.go +++ b/alicloud/connectivity/endpoint.go @@ -337,6 +337,22 @@ var irregularProductEndpoint = map[string]string{ "market": "market.aliyuncs.com", } +// irregularProductEndpointForIntl specially records those product codes that +// cannot be parsed out by the location service and for international region or account. +// Key: product code, its value equals to the gateway code of the API after converting it to lowercase and using underscores +// Value: product endpoint +// The priority of this configuration is higher than location service, lower than user environment variable configuration +var irregularProductEndpointForIntl = map[string]string{ + "ddoscoo": "ddoscoo.ap-southeast-1.aliyuncs.com", + "dcdn": "dcdn.aliyuncs.com", + "config": "config.ap-southeast-1.aliyuncs.com", + "cas": "cas.ap-southeast-1.aliyuncs.com", + "cdn": "cdn.ap-southeast-1.aliyuncs.com", + "eds_user": "eds-user.ap-southeast-1.aliyuncs.com", + "computenest": "computenest.ap-southeast-1.aliyuncs.com", + "resourcecenter": "resourcecenter-intl.aliyuncs.com", +} + // regularProductEndpoint specially records those product codes that have been confirmed to be // regional or central endpoints. // Key: product code, its value equals to the gateway code of the API after converting it to lowercase and using underscores @@ -431,6 +447,9 @@ func (client *AliyunClient) loadEndpoint(productCode string) error { // Secondly, load endpoint from known rules if endpointFmt, ok := irregularProductEndpoint[productCode]; ok { + if v, ok := irregularProductEndpointForIntl[productCode]; ok && !strings.HasPrefix(client.RegionId, "cn-") { + endpointFmt = v + } if strings.Contains(endpointFmt, "%s") { endpointFmt = fmt.Sprintf(endpointFmt, client.RegionId) }