Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from ..acs_exception import error_code, error_msg
LOCATION_SERVICE_PRODUCT_NAME = "Location"
LOCATION_SERVICE_DOMAIN = "location-readonly.aliyuncs.com"
LOCATION_SERVICE_VERSION = "2015-06-12"
LOCATION_SERVICE_DESCRIBE_ENDPOINT_ACTION = "DescribeEndpoints"
LOCATION_SERVICE_REGION = "cn-hangzhou"
LOCATION_CACHE_EXPIRE_TIME = 3600 # Seconds
# location endpoint list
__location_endpoints = dict()
__last_cache_clear_time_per_product = dict()
__location_service_domain = 'location-readonly.aliyuncs.com'
class DescribeEndpointRequest(RpcRequest):
def __init__(
self,
product_name,
version,
action_name,
region_id,
service_code,
endpoint_type):
RpcRequest.__init__(self, product_name, version, action_name)
self.add_query_param("Id", region_id)
self.add_query_param("ServiceCode", service_code)
self.add_query_param("Type", endpoint_type)
self.set_accept_format("JSON")
def __init__(
self,
product_name,
version,
action_name,
region_id,
service_code,
endpoint_type):
RpcRequest.__init__(self, product_name, version, action_name)
self.add_query_param("Id", region_id)
self.add_query_param("ServiceCode", service_code)
self.add_query_param("Type", endpoint_type)
self.set_accept_format("JSON")
raise exceptions.ClientException(error_code.SDK_INVALID_PARAMS,
'At least one of [action] and [uri_pattern] has a value')
if not self.endpoint and not self._product:
raise exceptions.ClientException(error_code.SDK_INVALID_PARAMS,
'At least one of [domain] and [product_name] has a value')
if self._uri_pattern:
self._style = STYLE_ROA
self.request = RoaRequest(product=self.get_product(), version=self.get_version(),
action_name=self.get_action_name(),
location_endpoint_type=self.get_location_endpoint_type()
)
self.fill_params()
else:
self._style = STYLE_RPC
self.request = RpcRequest(product=self.get_product(), version=self.get_version(),
action_name=self.get_action_name(),
location_endpoint_type=self.get_location_endpoint_type(),
)
self.fill_params()