2020-12-24 01:46:02 +00:00
|
|
|
# coding: utf-8
|
|
|
|
|
2021-01-16 06:42:05 +00:00
|
|
|
import types
|
2021-05-26 03:09:38 +00:00
|
|
|
import six
|
2021-01-16 06:42:05 +00:00
|
|
|
|
2020-12-24 01:46:02 +00:00
|
|
|
from huaweicloudsdkcore.region.region import Region
|
2022-06-23 11:11:56 +00:00
|
|
|
from huaweicloudsdkcore.region.provider import RegionProviderChain
|
2020-12-24 01:46:02 +00:00
|
|
|
|
|
|
|
class EipRegion:
|
2022-06-23 11:11:56 +00:00
|
|
|
_PROVIDER = RegionProviderChain.get_default_region_provider_chain("EIP")
|
|
|
|
|
2020-12-24 01:46:02 +00:00
|
|
|
|
|
|
|
AF_SOUTH_1 = Region(id="af-south-1", endpoint="https://vpc.af-south-1.myhuaweicloud.com")
|
|
|
|
|
|
|
|
CN_NORTH_4 = Region(id="cn-north-4", endpoint="https://vpc.cn-north-4.myhuaweicloud.com")
|
|
|
|
|
|
|
|
CN_NORTH_1 = Region(id="cn-north-1", endpoint="https://vpc.cn-north-1.myhuaweicloud.com")
|
|
|
|
|
|
|
|
CN_EAST_2 = Region(id="cn-east-2", endpoint="https://vpc.cn-east-2.myhuaweicloud.com")
|
|
|
|
|
|
|
|
CN_EAST_3 = Region(id="cn-east-3", endpoint="https://vpc.cn-east-3.myhuaweicloud.com")
|
|
|
|
|
|
|
|
CN_SOUTH_1 = Region(id="cn-south-1", endpoint="https://vpc.cn-south-1.myhuaweicloud.com")
|
|
|
|
|
|
|
|
CN_SOUTHWEST_2 = Region(id="cn-southwest-2", endpoint="https://vpc.cn-southwest-2.myhuaweicloud.com")
|
|
|
|
|
|
|
|
AP_SOUTHEAST_2 = Region(id="ap-southeast-2", endpoint="https://vpc.ap-southeast-2.myhuaweicloud.com")
|
|
|
|
|
2021-09-24 07:32:46 +00:00
|
|
|
AP_SOUTHEAST_1 = Region(id="ap-southeast-1", endpoint="https://vpc.ap-southeast-1.myhuaweicloud.com")
|
2020-12-24 01:46:02 +00:00
|
|
|
|
|
|
|
AP_SOUTHEAST_3 = Region(id="ap-southeast-3", endpoint="https://vpc.ap-southeast-3.myhuaweicloud.com")
|
|
|
|
|
2021-09-24 07:32:46 +00:00
|
|
|
CN_NORTH_9 = Region(id="cn-north-9", endpoint="https://vpc.cn-north-9.myhuaweicloud.com")
|
|
|
|
|
2022-04-14 11:06:46 +00:00
|
|
|
LA_NORTH_2 = Region(id="la-north-2", endpoint="https://vpc.la-north-2.myhuaweicloud.com")
|
|
|
|
|
|
|
|
SA_BRAZIL_1 = Region(id="sa-brazil-1", endpoint="https://vpc.sa-brazil-1.myhuaweicloud.com")
|
|
|
|
|
2022-11-30 08:59:35 +00:00
|
|
|
CN_NORTH_2 = Region(id="cn-north-2", endpoint="https://vpc.cn-north-2.myhuaweicloud.com")
|
|
|
|
|
|
|
|
LA_SOUTH_2 = Region(id="la-south-2", endpoint="https://vpc.la-south-2.myhuaweicloud.com")
|
|
|
|
|
|
|
|
NA_MEXICO_1 = Region(id="na-mexico-1", endpoint="https://vpc.na-mexico-1.myhuaweicloud.com")
|
|
|
|
|
2021-05-26 03:09:38 +00:00
|
|
|
static_fields = {
|
2021-01-16 06:42:05 +00:00
|
|
|
"af-south-1": AF_SOUTH_1,
|
|
|
|
"cn-north-4": CN_NORTH_4,
|
|
|
|
"cn-north-1": CN_NORTH_1,
|
|
|
|
"cn-east-2": CN_EAST_2,
|
|
|
|
"cn-east-3": CN_EAST_3,
|
|
|
|
"cn-south-1": CN_SOUTH_1,
|
|
|
|
"cn-southwest-2": CN_SOUTHWEST_2,
|
|
|
|
"ap-southeast-2": AP_SOUTHEAST_2,
|
|
|
|
"ap-southeast-1": AP_SOUTHEAST_1,
|
|
|
|
"ap-southeast-3": AP_SOUTHEAST_3,
|
2021-09-24 07:32:46 +00:00
|
|
|
"cn-north-9": CN_NORTH_9,
|
2022-04-14 11:06:46 +00:00
|
|
|
"la-north-2": LA_NORTH_2,
|
|
|
|
"sa-brazil-1": SA_BRAZIL_1,
|
2022-11-30 08:59:35 +00:00
|
|
|
"cn-north-2": CN_NORTH_2,
|
|
|
|
"la-south-2": LA_SOUTH_2,
|
|
|
|
"na-mexico-1": NA_MEXICO_1,
|
2021-05-26 03:09:38 +00:00
|
|
|
}
|
2021-01-16 06:42:05 +00:00
|
|
|
|
2022-06-23 11:11:56 +00:00
|
|
|
@classmethod
|
|
|
|
def value_of(cls, region_id, static_fields=None):
|
|
|
|
if not region_id:
|
2021-01-16 06:42:05 +00:00
|
|
|
raise KeyError("Unexpected empty parameter: region_id.")
|
2022-06-23 11:11:56 +00:00
|
|
|
|
|
|
|
fields = static_fields if static_fields else cls.static_fields
|
|
|
|
|
|
|
|
region = cls._PROVIDER.get_region(region_id)
|
|
|
|
if region:
|
|
|
|
return region
|
|
|
|
|
|
|
|
if region_id in fields:
|
|
|
|
return fields.get(region_id)
|
|
|
|
|
|
|
|
raise KeyError("Unexpected region_id: " + region_id)
|
2021-01-16 06:42:05 +00:00
|
|
|
|
2020-12-24 01:46:02 +00:00
|
|
|
|