com.aliyuncs.v5.endpoint.EndpointResolverBase Maven / Gradle / Ivy
package com.aliyuncs.v5.endpoint;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public abstract class EndpointResolverBase implements EndpointResolver {
protected Map endpointsData;
public EndpointResolverBase() {
endpointsData = new HashMap();
}
public String fetchEndpointEntry(ResolveEndpointRequest request) {
String key = makeEndpointKey(request);
if (endpointsData.containsKey(key)) {
return endpointsData.get(key);
} else {
return null;
}
}
public void putEndpointEntry(String key, String endpoint) {
endpointsData.put(key, endpoint);
}
public boolean isProductCodeValid(ResolveEndpointRequest request) {
for (String key : endpointsData.keySet()) {
if (key.startsWith(request.productCodeLower)) {
return true;
}
}
return false;
}
abstract public boolean isRegionIdValid(ResolveEndpointRequest request);
abstract String makeEndpointKey(ResolveEndpointRequest request);
public Set getValidRegionIdsByProduct(String productCode) {
// Only local config can tell
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy