Region implements Serializable, Comparable<Region> { public static String formatDefaultRegionEndpoint(Service service, Region region) { return EndpointBuilder.createEndpoint(service, region); } private  Region(
            @NonNull String regionId, @NonNull Optional<String> regionCode, @NonNull Realm realm); String getRegionCode(); Optional<String> getEndpoint(Service service); int compareTo(Region other); @Override // For backward compatibility maintain the enum toString behavior String toString(); static Region[] values(); static Region valueOf(@NonNull String name); static String formatDefaultRegionEndpoint(Service service, Region region); static String formatDefaultRegionEndpoint(Service service, String regionId); static Region fromRegionId(String regionId); static Region fromRegionCode(String regionCode); static Region fromRegionCodeOrId(String regionCodeOrId); static Region register(@NonNull String regionId, @NonNull final Realm realm); static Region register(
            @NonNull String regionId, @NonNull final Realm realm, String regionCode); static void setInstanceMetadataServiceClientConfig(ClientConfig clientConfig); static void enableInstanceMetadataService(); static void skipInstanceMetadataService(); static boolean registerFromInstanceMetadataService(); static final Region AP_CHUNCHEON_1; static final Region AP_MELBOURNE_1; static final Region AP_HYDERABAD_1; static final Region AP_MUMBAI_1; static final Region AP_OSAKA_1; static final Region AP_SEOUL_1; static final Region AP_SYDNEY_1; static final Region AP_TOKYO_1; static final Region CA_MONTREAL_1; static final Region CA_TORONTO_1; static final Region EU_AMSTERDAM_1; static final Region EU_FRANKFURT_1; static final Region EU_ZURICH_1; static final Region ME_JEDDAH_1; static final Region ME_DUBAI_1; static final Region SA_SAOPAULO_1; static final Region UK_LONDON_1; static final Region US_ASHBURN_1; static final Region US_PHOENIX_1; static final Region US_SANJOSE_1; static final Region US_LANGLEY_1; static final Region US_LUKE_1; static final Region US_GOV_ASHBURN_1; static final Region US_GOV_CHICAGO_1; static final Region US_GOV_PHOENIX_1; static final Region UK_GOV_LONDON_1; static final Region UK_GOV_CARDIFF_1; static final Region AP_CHIYODA_1; }
@Test public void regionalEndpoint_withOc1RegionEnumAndId_endpointsShouldBeEqual() { final String expectedEndpoint = "https: final Region oc1Region = Region.US_PHOENIX_1; assertEquals(expectedEndpoint, Region.formatDefaultRegionEndpoint(TEST_SERVICE, oc1Region)); assertEquals( expectedEndpoint, Region.formatDefaultRegionEndpoint(TEST_SERVICE, oc1Region.getRegionId())); }
@Test public void regionalEndpoint_withOc2RegionEnumId_endpointsShouldBeEqual() { final String expectedEndpoint = "https: final Region oc2Region = Region.US_LUKE_1; assertEquals( "Endpoint from OC2 Region enum should be equal", expectedEndpoint, Region.formatDefaultRegionEndpoint(TEST_SERVICE, oc2Region)); assertEquals( "Endpoint from OC2 Region ID should be equal", expectedEndpoint, Region.formatDefaultRegionEndpoint(TEST_SERVICE, oc2Region.getRegionId())); }
@Test public void regionalEndpoint_withOc3RegionEnumAndId_endpointsShouldBeEqual() { final String expectedEndpoint = "https: final Region oc3Region = Region.US_GOV_CHICAGO_1; assertEquals( "Endpoint from OC3 Region enum should be equal", expectedEndpoint, Region.formatDefaultRegionEndpoint(TEST_SERVICE, oc3Region)); assertEquals( "Endpoint from OC3 Region ID should be equal", expectedEndpoint, Region.formatDefaultRegionEndpoint(TEST_SERVICE, oc3Region.getRegionId())); }
@Ignore @Test(timeout = 10000) public void testFormatDefaultRegionEndpoint() { Region.setInstanceMetadataServiceClientConfig( new ClientConfig() .property(ClientProperties.CONNECT_TIMEOUT, 1000) .property(ClientProperties.READ_TIMEOUT, 5000)); Service svc = Services.serviceBuilder() .serviceName("test") .serviceEndpointPrefix("test") .serviceEndpointTemplate("https: .build(); Region.formatDefaultRegionEndpoint(svc, "unknown"); }