2021-05-26 03:00:08 +00:00
|
|
|
# coding: utf-8
|
|
|
|
|
|
|
|
from huaweicloudsdkcore.region.region import Region
|
2022-06-23 11:11:56 +00:00
|
|
|
from huaweicloudsdkcore.region.provider import RegionProviderChain
|
2021-05-26 03:00:08 +00:00
|
|
|
|
2023-09-14 09:28:03 +00:00
|
|
|
class CodeArtsPipelineRegion:
|
|
|
|
_PROVIDER = RegionProviderChain.get_default_region_provider_chain("CODEARTSPIPELINE")
|
2022-06-23 11:11:56 +00:00
|
|
|
|
2023-02-16 10:11:56 +00:00
|
|
|
CN_NORTH_1 = Region("cn-north-1",
|
|
|
|
"https://cloudpipeline-ext.cn-north-1.myhuaweicloud.com")
|
|
|
|
CN_NORTH_4 = Region("cn-north-4",
|
|
|
|
"https://cloudpipeline-ext.cn-north-4.myhuaweicloud.com")
|
|
|
|
CN_SOUTH_1 = Region("cn-south-1",
|
|
|
|
"https://cloudpipeline-ext.cn-south-1.myhuaweicloud.com")
|
|
|
|
CN_SOUTH_2 = Region("cn-south-2",
|
|
|
|
"https://cloudpipeline-ext.cn-south-2.myhuaweicloud.com")
|
|
|
|
CN_EAST_3 = Region("cn-east-3",
|
|
|
|
"https://cloudpipeline-ext.cn-east-3.myhuaweicloud.com")
|
|
|
|
CN_EAST_2 = Region("cn-east-2",
|
|
|
|
"https://cloudpipeline-ext.cn-east-2.myhuaweicloud.com")
|
2023-09-14 09:28:03 +00:00
|
|
|
CN_SOUTHWEST_2 = Region("cn-southwest-2",
|
|
|
|
"https://cloudpipeline-ext.cn-southwest-2.myhuaweicloud.com")
|
|
|
|
AP_SOUTHEAST_3 = Region("ap-southeast-3",
|
|
|
|
"https://cloudpipeline-ext.ap-southeast-3.myhuaweicloud.com")
|
|
|
|
SA_BRAZIL_1 = Region("sa-brazil-1",
|
|
|
|
"https://cloudpipeline-ext.sa-brazil-1.myhuaweicloud.com")
|
|
|
|
LA_NORTH_2 = Region("la-north-2",
|
|
|
|
"https://cloudpipeline-ext.la-north-2.myhuaweicloud.com")
|
2023-12-07 07:58:00 +00:00
|
|
|
TR_WEST_1 = Region("tr-west-1",
|
|
|
|
"https://pipeline-external.tr-west-1.myhuaweicloud.com")
|
2024-01-25 08:47:44 +00:00
|
|
|
LA_SOUTH_2 = Region("la-south-2",
|
|
|
|
"https://pipeline-external.la-south-2.myhuaweicloud.com")
|
2021-05-26 03:00:08 +00:00
|
|
|
|
|
|
|
static_fields = {
|
|
|
|
"cn-north-1": CN_NORTH_1,
|
|
|
|
"cn-north-4": CN_NORTH_4,
|
|
|
|
"cn-south-1": CN_SOUTH_1,
|
|
|
|
"cn-south-2": CN_SOUTH_2,
|
|
|
|
"cn-east-3": CN_EAST_3,
|
|
|
|
"cn-east-2": CN_EAST_2,
|
2023-09-14 09:28:03 +00:00
|
|
|
"cn-southwest-2": CN_SOUTHWEST_2,
|
|
|
|
"ap-southeast-3": AP_SOUTHEAST_3,
|
|
|
|
"sa-brazil-1": SA_BRAZIL_1,
|
|
|
|
"la-north-2": LA_NORTH_2,
|
2023-12-07 07:58:00 +00:00
|
|
|
"tr-west-1": TR_WEST_1,
|
2024-01-25 08:47:44 +00:00
|
|
|
"la-south-2": LA_SOUTH_2,
|
2021-05-26 03:00:08 +00:00
|
|
|
}
|
|
|
|
|
2022-06-23 11:11:56 +00:00
|
|
|
@classmethod
|
|
|
|
def value_of(cls, region_id, static_fields=None):
|
|
|
|
if not region_id:
|
2024-01-18 09:04:41 +00:00
|
|
|
raise KeyError("Unexpected empty parameter: region_id")
|
2022-06-23 11:11:56 +00:00
|
|
|
|
2024-01-18 09:04:41 +00:00
|
|
|
fields = static_fields or cls.static_fields
|
2022-06-23 11:11:56 +00:00
|
|
|
|
|
|
|
region = cls._PROVIDER.get_region(region_id)
|
|
|
|
if region:
|
|
|
|
return region
|
|
|
|
|
|
|
|
if region_id in fields:
|
|
|
|
return fields.get(region_id)
|
|
|
|
|
2024-01-18 09:04:41 +00:00
|
|
|
raise KeyError("region_id '%s' is not in the following supported regions of service 'CodeArtsPipeline': [%s]" % (
|
|
|
|
region_id, ", ".join(sorted(fields.keys()))))
|