mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
fix(region): apsara default region
This commit is contained in:
@@ -33,6 +33,7 @@ type SApsaraEndpoints struct {
|
||||
RamEndpoint string `default:"$APSARA_RAM_ENDPOINT"`
|
||||
MetricsEndpoint string `default:"$APSRRA_METRICS_ENDPOINT"`
|
||||
ResourcemanagerEndpoint string `default:"$APSARA_RESOURCEMANAGER_ENDPOINT"`
|
||||
DefaultRegion string `default:"$APSARA_DEFAULT_REGION"`
|
||||
}
|
||||
|
||||
// SHCSOEndpoints 华为私有云endpoints配置
|
||||
|
||||
@@ -301,7 +301,11 @@ func (self *SApsaraClient) trialRequest(apiName string, params map[string]string
|
||||
}
|
||||
|
||||
func (self *SApsaraClient) fetchRegions() error {
|
||||
body, err := self.ecsRequest("DescribeRegions", map[string]string{"AcceptLanguage": "zh-CN"})
|
||||
params := map[string]string{"AcceptLanguage": "zh-CN"}
|
||||
if len(self.endpoints.DefaultRegion) > 0 {
|
||||
params["RegionId"] = self.endpoints.DefaultRegion
|
||||
}
|
||||
body, err := self.ecsRequest("DescribeRegions", params)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "DescribeRegions")
|
||||
}
|
||||
|
||||
@@ -57,6 +57,9 @@ func (self *SApsaraProviderFactory) ValidateCreateCloudaccountData(ctx context.C
|
||||
return output, httperrors.NewMissingParameterError("endpoint")
|
||||
}
|
||||
output.AccessUrl = input.Endpoint
|
||||
if input.SApsaraEndpoints == nil || len(input.SApsaraEndpoints.DefaultRegion) == 0 {
|
||||
return output, httperrors.NewMissingParameterError("default_region")
|
||||
}
|
||||
return output, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user