in cvm-attestation/src/EndpointSelector.py [0:0]
def _get_endpoint(self, region):
"""
Retrieve the attestation URI for a specific region. If the region is not
found, return a randomly selected URI from the available endpoints.
Parameters:
region (str): Region name.
Returns:
str: Attestation URI for the region or a randomly selected one.
"""
region = region.replace(" ", "").lower()
self.logger.info(f"Getting endpoint for region: {region}")
if region in self.endpoints:
return self.endpoints[region]
self.logger.warning(
f"Region '{region}' not found in configured endpoints. Using random endpoint instead."
)
return random.choice(list(self.endpoints.values()))