2023-07-27 12:20:55 +00:00
|
|
|
# coding: utf-8
|
|
|
|
|
|
|
|
import types
|
|
|
|
import six
|
|
|
|
|
|
|
|
from huaweicloudsdkcore.region.region import Region
|
|
|
|
from huaweicloudsdkcore.region.provider import RegionProviderChain
|
|
|
|
|
|
|
|
class PanguLargeModelsRegion:
|
|
|
|
_PROVIDER = RegionProviderChain.get_default_region_provider_chain("PANGULARGEMODELS")
|
|
|
|
|
|
|
|
CN_NORTH_4 = Region("cn-north-4",
|
|
|
|
"https://pangu.cn-north-4.myhuaweicloud.com")
|
|
|
|
CN_EAST_3 = Region("cn-east-3",
|
|
|
|
"https://pangu.cn-east-3.myhuaweicloud.com")
|
2023-11-02 08:35:25 +00:00
|
|
|
CN_SOUTHWEST_2 = Region("cn-southwest-2",
|
|
|
|
"https://pangu.cn-southwest-2.myhuaweicloud.com")
|
2023-07-27 12:20:55 +00:00
|
|
|
|
|
|
|
static_fields = {
|
|
|
|
"cn-north-4": CN_NORTH_4,
|
|
|
|
"cn-east-3": CN_EAST_3,
|
2023-11-02 08:35:25 +00:00
|
|
|
"cn-southwest-2": CN_SOUTHWEST_2,
|
2023-07-27 12:20:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@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)
|
|
|
|
|
|
|
|
|