huaweicloud-sdk-python-v3/huaweicloud-sdk-iotanalytics/huaweicloudsdkiotanalytics/v1/region/iotanalytics_region.py

36 lines
921 B
Python
Raw Normal View History

2021-12-17 09:25:16 +00:00
# coding: utf-8
import types
import six
from huaweicloudsdkcore.region.region import Region
2022-06-23 11:11:56 +00:00
from huaweicloudsdkcore.region.provider import RegionProviderChain
2021-12-17 09:25:16 +00:00
class IoTAnalyticsRegion:
2022-06-23 11:11:56 +00:00
_PROVIDER = RegionProviderChain.get_default_region_provider_chain("IOTANALYTICS")
2023-02-16 10:11:56 +00:00
CN_NORTH_4 = Region("cn-north-4",
"https://iota.cn-north-4.myhuaweicloud.com")
2021-12-17 09:25:16 +00:00
static_fields = {
"cn-north-4": CN_NORTH_4,
}
2022-06-23 11:11:56 +00:00
@classmethod
def value_of(cls, region_id, static_fields=None):
if not region_id:
2021-12-17 09:25:16 +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-12-17 09:25:16 +00:00