huaweicloud-sdk-python-v3/huaweicloud-sdk-antiddos/huaweicloudsdkantiddos/v1/region/antiddos_region.py

101 lines
4.3 KiB
Python
Raw Normal View History

2021-08-17 07:57:38 +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-08-17 07:57:38 +00:00
class AntiDDoSRegion:
2022-06-23 11:11:56 +00:00
_PROVIDER = RegionProviderChain.get_default_region_provider_chain("ANTIDDOS")
2023-02-16 10:11:56 +00:00
CN_NORTH_1 = Region("cn-north-1",
"https://antiddos.cn-north-1.myhuaweicloud.com")
CN_NORTH_2 = Region("cn-north-2",
"https://antiddos.cn-north-2.myhuaweicloud.com")
CN_NORTH_4 = Region("cn-north-4",
"https://antiddos.cn-north-4.myhuaweicloud.com")
CN_EAST_3 = Region("cn-east-3",
"https://antiddos.cn-east-3.myhuaweicloud.com")
CN_EAST_2 = Region("cn-east-2",
"https://antiddos.cn-east-2.myhuaweicloud.com")
CN_SOUTH_1 = Region("cn-south-1",
"https://antiddos.cn-south-1.myhuaweicloud.com")
CN_SOUTH_2 = Region("cn-south-2",
"https://antiddos.cn-south-2.myhuaweicloud.com")
2023-11-09 09:11:11 +00:00
CN_SOUTH_4 = Region("cn-south-4",
"https://antiddos.cn-south-4.myhuaweicloud.com")
2023-02-16 10:11:56 +00:00
CN_SOUTHWEST_2 = Region("cn-southwest-2",
"https://antiddos.cn-southwest-2.myhuaweicloud.com")
AP_SOUTHEAST_1 = Region("ap-southeast-1",
"https://antiddos.ap-southeast-1.myhuaweicloud.com")
AP_SOUTHEAST_2 = Region("ap-southeast-2",
"https://antiddos.ap-southeast-2.myhuaweicloud.com")
AP_SOUTHEAST_3 = Region("ap-southeast-3",
"https://antiddos.ap-southeast-3.myhuaweicloud.com")
AF_SOUTH_1 = Region("af-south-1",
"https://antiddos.af-south-1.myhuaweicloud.com")
RU_NORTHWEST_2 = Region("ru-northwest-2",
"https://antiddos.ru-northwest-2.myhuaweicloud.com")
LA_SOUTH_2 = Region("la-south-2",
"https://antiddos.la-south-2.myhuaweicloud.com")
SA_BRAZIL_1 = Region("sa-brazil-1",
"https://antiddos.sa-brazil-1.myhuaweicloud.com")
NA_MEXICO_1 = Region("na-mexico-1",
"https://antiddos.na-mexico-1.myhuaweicloud.com")
LA_NORTH_2 = Region("la-north-2",
"https://antiddos.la-north-2.myhuaweicloud.com")
CN_NORTH_9 = Region("cn-north-9",
"https://antiddos.cn-north-9.myhuaweicloud.com")
2023-03-02 11:02:35 +00:00
AP_SOUTHEAST_4 = Region("ap-southeast-4",
"https://antiddos.ap-southeast-4.myhuaweicloud.com")
2023-10-19 08:19:16 +00:00
AE_AD_1 = Region("ae-ad-1",
"https://antiddos.ae-ad-1.myhuaweicloud.com")
2024-01-04 08:24:03 +00:00
EU_WEST_0 = Region("eu-west-0",
"https://antiddos.eu-west-0.myhuaweicloud.com")
2024-02-29 07:44:10 +00:00
MY_KUALALUMPUR_1 = Region("my-kualalumpur-1",
"https://antiddos.my-kualalumpur-1.myhuaweicloud.com")
2024-05-30 08:52:00 +00:00
ME_EAST_1 = Region("me-east-1",
"https://antiddos.me-east-1.myhuaweicloud.com")
2022-07-07 13:49:54 +00:00
2021-08-17 07:57:38 +00:00
static_fields = {
"cn-north-1": CN_NORTH_1,
"cn-north-2": CN_NORTH_2,
"cn-north-4": CN_NORTH_4,
"cn-east-3": CN_EAST_3,
"cn-east-2": CN_EAST_2,
"cn-south-1": CN_SOUTH_1,
"cn-south-2": CN_SOUTH_2,
2023-11-09 09:11:11 +00:00
"cn-south-4": CN_SOUTH_4,
2021-08-17 07:57:38 +00:00
"cn-southwest-2": CN_SOUTHWEST_2,
"ap-southeast-1": AP_SOUTHEAST_1,
"ap-southeast-2": AP_SOUTHEAST_2,
"ap-southeast-3": AP_SOUTHEAST_3,
"af-south-1": AF_SOUTH_1,
"ru-northwest-2": RU_NORTHWEST_2,
2022-07-07 13:49:54 +00:00
"la-south-2": LA_SOUTH_2,
"sa-brazil-1": SA_BRAZIL_1,
"na-mexico-1": NA_MEXICO_1,
2022-09-08 11:22:27 +00:00
"la-north-2": LA_NORTH_2,
"cn-north-9": CN_NORTH_9,
2023-03-02 11:02:35 +00:00
"ap-southeast-4": AP_SOUTHEAST_4,
2023-10-19 08:19:16 +00:00
"ae-ad-1": AE_AD_1,
2024-01-04 08:24:03 +00:00
"eu-west-0": EU_WEST_0,
2024-02-29 07:44:10 +00:00
"my-kualalumpur-1": MY_KUALALUMPUR_1,
2024-05-30 08:52:00 +00:00
"me-east-1": ME_EAST_1,
2021-08-17 07:57:38 +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 'AntiDDoS': [%s]" % (
region_id, ", ".join(sorted(fields.keys()))))