update aliyun and aws region

Signed-off-by: Ziming Zhang <zziming@vmware.com>
This commit is contained in:
Ziming Zhang 2021-04-16 18:46:45 +08:00
parent fb50b1313e
commit e8450d99ce
2 changed files with 67 additions and 100 deletions

View File

@ -145,31 +145,42 @@ func (a *adapter) Info() (info *model.RegistryInfo, err error) {
} }
func getAdapterInfo() *model.AdapterPattern { func getAdapterInfo() *model.AdapterPattern {
var endpoints []*model.Endpoint
// https://help.aliyun.com/document_detail/40654.html?spm=a2c4g.11186623.2.7.58683ae5Q4lo1o
for _, e := range []string{
"cn-qingdao",
"cn-beijing",
"cn-zhangjiakou",
"cn-huhehaote",
"cn-wulanchabu",
"cn-hangzhou",
"cn-shanghai",
"cn-shenzhen",
"cn-heyuan",
"cn-guangzhou",
"cn-chengdu",
"cn-hongkong",
"ap-southeast-1",
"ap-southeast-2",
"ap-southeast-3",
"ap-southeast-5",
"ap-south-1",
"ap-northeast-1",
"us-west-1",
"us-east-1",
"eu-central-1",
"eu-west-1",
"me-east-1",
} {
endpoints = append(endpoints, &model.Endpoint{
Key: e,
Value: fmt.Sprintf("https://registry.%s.aliyuncs.com", e),
})
}
info := &model.AdapterPattern{ info := &model.AdapterPattern{
EndpointPattern: &model.EndpointPattern{ EndpointPattern: &model.EndpointPattern{
EndpointType: model.EndpointPatternTypeList, EndpointType: model.EndpointPatternTypeList,
Endpoints: []*model.Endpoint{ Endpoints: endpoints,
{Key: "cn-hangzhou", Value: "https://registry.cn-hangzhou.aliyuncs.com"},
{Key: "cn-shanghai", Value: "https://registry.cn-shanghai.aliyuncs.com"},
{Key: "cn-qingdao", Value: "https://registry.cn-qingdao.aliyuncs.com"},
{Key: "cn-beijing", Value: "https://registry.cn-beijing.aliyuncs.com"},
{Key: "cn-zhangjiakou", Value: "https://registry.cn-zhangjiakou.aliyuncs.com"},
{Key: "cn-huhehaote", Value: "https://registry.cn-huhehaote.aliyuncs.com"},
{Key: "cn-shenzhen", Value: "https://registry.cn-shenzhen.aliyuncs.com"},
{Key: "cn-chengdu", Value: "https://registry.cn-chengdu.aliyuncs.com"},
{Key: "cn-hongkong", Value: "https://registry.cn-hongkong.aliyuncs.com"},
{Key: "ap-southeast-1", Value: "https://registry.ap-southeast-1.aliyuncs.com"},
{Key: "ap-southeast-2", Value: "https://registry.ap-southeast-2.aliyuncs.com"},
{Key: "ap-southeast-3", Value: "https://registry.ap-southeast-3.aliyuncs.com"},
{Key: "ap-southeast-5", Value: "https://registry.ap-southeast-5.aliyuncs.com"},
{Key: "ap-northeast-1", Value: "https://registry.ap-northeast-1.aliyuncs.com"},
{Key: "ap-south-1", Value: "https://registry.ap-south-1.aliyuncs.com"},
{Key: "eu-central-1", Value: "https://registry.eu-central-1.aliyuncs.com"},
{Key: "eu-west-1", Value: "https://registry.eu-west-1.aliyuncs.com"},
{Key: "us-west-1", Value: "https://registry.us-west-1.aliyuncs.com"},
{Key: "us-east-1", Value: "https://registry.us-east-1.aliyuncs.com"},
{Key: "me-east-1", Value: "https://registry.me-east-1.aliyuncs.com"},
},
}, },
} }
return info return info

View File

@ -16,6 +16,7 @@ package awsecr
import ( import (
"errors" "errors"
"fmt"
"regexp" "regexp"
"github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/awserr"
@ -116,87 +117,42 @@ func (*adapter) Info() (info *model.RegistryInfo, err error) {
} }
func getAdapterInfo() *model.AdapterPattern { func getAdapterInfo() *model.AdapterPattern {
var endpoints []*model.Endpoint
// https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints
for _, e := range []string{
"us-east-2",
"us-east-1",
"us-west-1",
"us-west-2",
"af-south-1",
"ap-east-1",
"ap-south-1",
"ap-northeast-3",
"ap-northeast-2",
"ap-southeast-1",
"ap-southeast-2",
"ap-northeast-1",
"ca-central-1",
"cn-north-1",
"cn-northwest-1",
"eu-central-1",
"eu-west-1",
"eu-west-2",
"eu-south-1",
"eu-west-3",
"eu-north-1",
"me-south-1",
"sa-east-1",
} {
endpoints = append(endpoints, &model.Endpoint{
Key: e,
Value: fmt.Sprintf("https://%s.amazonaws.com", e),
})
}
info := &model.AdapterPattern{ info := &model.AdapterPattern{
EndpointPattern: &model.EndpointPattern{ EndpointPattern: &model.EndpointPattern{
EndpointType: model.EndpointPatternTypeList, EndpointType: model.EndpointPatternTypeList,
Endpoints: []*model.Endpoint{ Endpoints: endpoints,
{
Key: "ap-northeast-1",
Value: "https://api.ecr.ap-northeast-1.amazonaws.com",
},
{
Key: "us-east-1",
Value: "https://api.ecr.us-east-1.amazonaws.com",
},
{
Key: "us-east-2",
Value: "https://api.ecr.us-east-2.amazonaws.com",
},
{
Key: "us-west-1",
Value: "https://api.ecr.us-west-1.amazonaws.com",
},
{
Key: "us-west-2",
Value: "https://api.ecr.us-west-2.amazonaws.com",
},
{
Key: "ap-east-1",
Value: "https://api.ecr.ap-east-1.amazonaws.com",
},
{
Key: "ap-south-1",
Value: "https://api.ecr.ap-south-1.amazonaws.com",
},
{
Key: "ap-northeast-2",
Value: "https://api.ecr.ap-northeast-2.amazonaws.com",
},
{
Key: "ap-southeast-1",
Value: "https://api.ecr.ap-southeast-1.amazonaws.com",
},
{
Key: "ap-southeast-2",
Value: "https://api.ecr.ap-southeast-2.amazonaws.com",
},
{
Key: "ca-central-1",
Value: "https://api.ecr.ca-central-1.amazonaws.com",
},
{
Key: "eu-central-1",
Value: "https://api.ecr.eu-central-1.amazonaws.com",
},
{
Key: "eu-west-1",
Value: "https://api.ecr.eu-west-1.amazonaws.com",
},
{
Key: "eu-west-2",
Value: "https://api.ecr.eu-west-2.amazonaws.com",
},
{
Key: "eu-west-3",
Value: "https://api.ecr.eu-west-3.amazonaws.com",
},
{
Key: "eu-north-1",
Value: "https://api.ecr.eu-north-1.amazonaws.com",
},
{
Key: "sa-east-1",
Value: "https://api.ecr.sa-east-1.amazonaws.com",
},
{
Key: "cn-north-1",
Value: "https://api.ecr.cn-north-1.amazonaws.com.cn",
},
{
Key: "cn-northwest-1",
Value: "https://api.ecr.cn-northwest-1.amazonaws.com.cn",
},
},
}, },
} }
return info return info