/** * Searches through all known regions to find one with any service at the * specified endpoint. If no region is found with a service at that * endpoint, an exception is thrown. * * @param endpoint The endpoint for any service residing in the desired * region. * @return The region containing any service running at the specified * endpoint, otherwise an exception is thrown if no region is found * with a service at the specified endpoint. * @throws IllegalArgumentException If the given URL is malformed, or if the * one of the service URLs on record is malformed. */ public Region getRegionByEndpoint(final String endpoint) { String host = getHost(endpoint); for (Region region : regions) { for (String serviceEndpoint : region.getServiceEndpoints().values()) { if (host.equals(getHost(serviceEndpoint))) { return region; } } } throw new IllegalArgumentException( "No region found with any service for endpoint " + endpoint); }
/** * Searches through all known regions to find one with any service at the * specified endpoint. If no region is found with a service at that * endpoint, an exception is thrown. * * @param endpoint The endpoint for any service residing in the desired * region. * @return The region containing any service running at the specified * endpoint, otherwise an exception is thrown if no region is found * with a service at the specified endpoint. * @throws IllegalArgumentException If the given URL is malformed, or if the * one of the service URLs on record is malformed. */ public Region getRegionByEndpoint(final String endpoint) { String host = getHost(endpoint); for (Region region : regions) { for (String serviceEndpoint : region.getServiceEndpoints().values()) { if (host.equals(getHost(serviceEndpoint))) { return region; } } } throw new IllegalArgumentException( "No region found with any service for endpoint " + endpoint); }
/** * Searches through all known regions to find one with any service at the * specified endpoint. If no region is found with a service at that * endpoint, an exception is thrown. * * @param endpoint The endpoint for any service residing in the desired * region. * @return The region containing any service running at the specified * endpoint, otherwise an exception is thrown if no region is found * with a service at the specified endpoint. * @throws IllegalArgumentException If the given URL is malformed, or if the * one of the service URLs on record is malformed. */ public Region getRegionByEndpoint(final String endpoint) { String host = getHost(endpoint); for (Region region : regions) { for (String serviceEndpoint : region.getServiceEndpoints().values()) { if (host.equals(getHost(serviceEndpoint))) { return region; } } } throw new IllegalArgumentException( "No region found with any service for endpoint " + endpoint); }