huaweicloud-sdk-python-v3/huaweicloud-sdk-cdn/huaweicloudsdkcdn/v2/region/cdn_region.py

31 lines
840 B
Python
Raw Normal View History

2022-03-25 08:53:59 +00:00
# coding: utf-8
import types
import six
from huaweicloudsdkcore.region.region import Region
class CdnRegion:
def __init__(self):
pass
CN_NORTH_1 = Region(id="cn-north-1", endpoint="https://cdn.myhuaweicloud.com")
AP_SOUTHEAST_1 = Region(id="ap-southeast-1", endpoint="https://cdn.myhuaweicloud.com")
static_fields = {
"cn-north-1": CN_NORTH_1,
"ap-southeast-1": AP_SOUTHEAST_1,
}
@staticmethod
def value_of(region_id, static_fields=types.MappingProxyType(static_fields) if six.PY3 else static_fields):
if region_id is None or len(region_id) == 0:
raise KeyError("Unexpected empty parameter: region_id.")
if not static_fields.get(region_id):
raise KeyError("Unexpected region_id: " + region_id)
return static_fields.get(region_id)