huaweicloud-sdk-python-v3/huaweicloud-sdk-ges/huaweicloudsdkges/v2/region/ges_region.py

57 lines
1.9 KiB
Python
Raw Normal View History

2023-01-12 11:18:53 +00:00
# coding: utf-8
import types
import six
from huaweicloudsdkcore.region.region import Region
from huaweicloudsdkcore.region.provider import RegionProviderChain
class GesRegion:
_PROVIDER = RegionProviderChain.get_default_region_provider_chain("GES")
2023-07-20 09:10:13 +00:00
EU_WEST_101 = Region("eu-west-101",
"https://ges.eu-west-101.myhuaweicloud.eu")
2023-02-16 10:11:56 +00:00
CN_NORTH_2 = Region("cn-north-2",
"https://ges.cn-north-2.myhuaweicloud.com")
CN_NORTH_4 = Region("cn-north-4",
"https://ges.cn-north-4.myhuaweicloud.com")
CN_NORTH_1 = Region("cn-north-1",
"https://ges.cn-north-1.myhuaweicloud.com")
CN_EAST_3 = Region("cn-east-3",
"https://ges.cn-east-3.myhuaweicloud.com")
CN_SOUTH_1 = Region("cn-south-1",
"https://ges.cn-south-1.myhuaweicloud.com")
AP_SOUTHEAST_1 = Region("ap-southeast-1",
"https://ges.ap-southeast-1.myhuaweicloud.com")
AP_SOUTHEAST_3 = Region("ap-southeast-3",
"https://ges.ap-southeast-3.myhuaweicloud.com")
2023-01-12 11:18:53 +00:00
static_fields = {
2023-07-20 09:10:13 +00:00
"eu-west-101": EU_WEST_101,
2023-01-12 11:18:53 +00:00
"cn-north-2": CN_NORTH_2,
"cn-north-4": CN_NORTH_4,
"cn-north-1": CN_NORTH_1,
"cn-east-3": CN_EAST_3,
"cn-south-1": CN_SOUTH_1,
"ap-southeast-1": AP_SOUTHEAST_1,
"ap-southeast-3": AP_SOUTHEAST_3,
}
@classmethod
def value_of(cls, region_id, static_fields=None):
if not region_id:
raise KeyError("Unexpected empty parameter: region_id.")
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)