Class Region
- java.lang.Object
-
- com.oracle.bmc.Region
-
- All Implemented Interfaces:
Serializable
,Comparable<Region>
public final class Region extends Object implements Serializable, Comparable<Region>
Class containing all of the known Regions that can be contacted.Note, not all services may be available in all regions.
- See Also:
- Serialized Form
-
-
Field Summary
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Region other)
Compares to regions lexicographically based on their regionId.static void
enableInstanceMetadataService()
Enables contact to IMDS (Instance Metadata Service, only available on OCI instances) if user decides to opt-in.boolean
equals(Object o)
static String
formatDefaultRegionEndpoint(Service service, Region region)
Creates a default endpoint URL for the given service in the given region.static String
formatDefaultRegionEndpoint(Service service, String regionId)
Creates a default endpoint URL for the given service in the given region.static Region
fromRegionCode(String regionCode)
Returns the Region object from the public region code.static Region
fromRegionCodeOrId(String regionCodeOrId)
Returns the Region object from the public region code or id.static Region
fromRegionId(String regionId)
Returns the Region object from the canonical public region ID.Optional<String>
getEndpoint(Service service)
Resolves a service name to its endpoint in the region, if available.Realm
getRealm()
String
getRegionCode()
Get the region code.static Region
getRegionFromImds()
static Region
getRegionFromImds(String metadataServiceBaseUrl)
String
getRegionId()
int
hashCode()
static boolean
isAlloyRegionCoexistEnabled()
Return the Alloy region coexist status.static boolean
isServiceEnabled(String serviceName)
If Alloy config exists, read the config and check if service is enabled.static Region
register(String regionId, Realm realm)
Register a new region.static Region
register(String regionId, Realm realm, String regionCode)
Register a new region.static Region
register(String regionId, Realm realm, String regionCode, boolean isAlloyRegion)
Register a new region.static boolean
registerFromInstanceMetadataService()
Send request to IMDS (Instance Metadata Service, only available on OCI instances), registers region, and sets hasUsedInstanceMetadataService = true.static void
skipInstanceMetadataService()
Instructs the SDK to not contact the IMDS (Instance Metadata Service, only available on OCI instances).String
toString()
static Region
valueOf(String name)
Returns the Region object matching the specified name.static Region[]
values()
Return all known Regions in this version of the SDK, except possibly the region returned by IMDS (Instance Metadata Service, only available on OCI instances), since IMDS is not automatically contacted by this method.
-
-
-
Field Detail
-
regionFromImds
public static volatile Region regionFromImds
-
AP_CHUNCHEON_1
public static final Region AP_CHUNCHEON_1
-
AP_MELBOURNE_1
public static final Region AP_MELBOURNE_1
-
AP_HYDERABAD_1
public static final Region AP_HYDERABAD_1
-
AP_MUMBAI_1
public static final Region AP_MUMBAI_1
-
AP_OSAKA_1
public static final Region AP_OSAKA_1
-
AP_SEOUL_1
public static final Region AP_SEOUL_1
-
AP_SYDNEY_1
public static final Region AP_SYDNEY_1
-
AP_TOKYO_1
public static final Region AP_TOKYO_1
-
CA_MONTREAL_1
public static final Region CA_MONTREAL_1
-
CA_TORONTO_1
public static final Region CA_TORONTO_1
-
EU_AMSTERDAM_1
public static final Region EU_AMSTERDAM_1
-
EU_FRANKFURT_1
public static final Region EU_FRANKFURT_1
-
EU_ZURICH_1
public static final Region EU_ZURICH_1
-
ME_JEDDAH_1
public static final Region ME_JEDDAH_1
-
ME_DUBAI_1
public static final Region ME_DUBAI_1
-
SA_SAOPAULO_1
public static final Region SA_SAOPAULO_1
-
UK_LONDON_1
public static final Region UK_LONDON_1
-
US_ASHBURN_1
public static final Region US_ASHBURN_1
-
US_PHOENIX_1
public static final Region US_PHOENIX_1
-
US_SANJOSE_1
public static final Region US_SANJOSE_1
-
UK_CARDIFF_1
public static final Region UK_CARDIFF_1
-
SA_SANTIAGO_1
public static final Region SA_SANTIAGO_1
-
SA_VINHEDO_1
public static final Region SA_VINHEDO_1
-
IL_JERUSALEM_1
public static final Region IL_JERUSALEM_1
-
EU_MARSEILLE_1
public static final Region EU_MARSEILLE_1
-
AP_SINGAPORE_1
public static final Region AP_SINGAPORE_1
-
ME_ABUDHABI_1
public static final Region ME_ABUDHABI_1
-
EU_MILAN_1
public static final Region EU_MILAN_1
-
EU_STOCKHOLM_1
public static final Region EU_STOCKHOLM_1
-
AF_JOHANNESBURG_1
public static final Region AF_JOHANNESBURG_1
-
EU_PARIS_1
public static final Region EU_PARIS_1
-
MX_QUERETARO_1
public static final Region MX_QUERETARO_1
-
EU_MADRID_1
public static final Region EU_MADRID_1
-
US_CHICAGO_1
public static final Region US_CHICAGO_1
-
MX_MONTERREY_1
public static final Region MX_MONTERREY_1
-
US_SALTLAKE_2
public static final Region US_SALTLAKE_2
-
SA_BOGOTA_1
public static final Region SA_BOGOTA_1
-
SA_VALPARAISO_1
public static final Region SA_VALPARAISO_1
-
AP_SINGAPORE_2
public static final Region AP_SINGAPORE_2
-
ME_RIYADH_1
public static final Region ME_RIYADH_1
-
US_LANGLEY_1
public static final Region US_LANGLEY_1
-
US_LUKE_1
public static final Region US_LUKE_1
-
US_GOV_ASHBURN_1
public static final Region US_GOV_ASHBURN_1
-
US_GOV_CHICAGO_1
public static final Region US_GOV_CHICAGO_1
-
US_GOV_PHOENIX_1
public static final Region US_GOV_PHOENIX_1
-
UK_GOV_LONDON_1
public static final Region UK_GOV_LONDON_1
-
UK_GOV_CARDIFF_1
public static final Region UK_GOV_CARDIFF_1
-
AP_CHIYODA_1
public static final Region AP_CHIYODA_1
-
AP_IBARAKI_1
public static final Region AP_IBARAKI_1
-
ME_DCC_MUSCAT_1
public static final Region ME_DCC_MUSCAT_1
-
AP_DCC_CANBERRA_1
public static final Region AP_DCC_CANBERRA_1
-
EU_DCC_MILAN_1
public static final Region EU_DCC_MILAN_1
-
EU_DCC_MILAN_2
public static final Region EU_DCC_MILAN_2
-
EU_DCC_DUBLIN_2
public static final Region EU_DCC_DUBLIN_2
-
EU_DCC_RATING_2
public static final Region EU_DCC_RATING_2
-
EU_DCC_RATING_1
public static final Region EU_DCC_RATING_1
-
EU_DCC_DUBLIN_1
public static final Region EU_DCC_DUBLIN_1
-
EU_JOVANOVAC_1
public static final Region EU_JOVANOVAC_1
-
EU_MADRID_2
public static final Region EU_MADRID_2
-
EU_FRANKFURT_2
public static final Region EU_FRANKFURT_2
-
EU_DCC_ZURICH_1
public static final Region EU_DCC_ZURICH_1
-
EU_CRISSIER_1
public static final Region EU_CRISSIER_1
-
ME_DCC_DOHA_1
public static final Region ME_DCC_DOHA_1
-
ME_ABUDHABI_3
public static final Region ME_ABUDHABI_3
-
ME_ALAIN_1
public static final Region ME_ALAIN_1
-
AP_DCC_GAZIPUR_1
public static final Region AP_DCC_GAZIPUR_1
-
ME_ABUDHABI_2
public static final Region ME_ABUDHABI_2
-
ME_ABUDHABI_4
public static final Region ME_ABUDHABI_4
-
US_SOMERSET_1
public static final Region US_SOMERSET_1
-
US_THAMES_1
public static final Region US_THAMES_1
-
AP_SEOUL_2
public static final Region AP_SEOUL_2
-
AP_SUWON_1
public static final Region AP_SUWON_1
-
AP_CHUNCHEON_2
public static final Region AP_CHUNCHEON_2
-
-
Method Detail
-
getRegionFromImds
public static Region getRegionFromImds()
-
getRegionCode
public String getRegionCode()
Get the region code.
-
getEndpoint
public Optional<String> getEndpoint(Service service)
Resolves a service name to its endpoint in the region, if available.- Parameters:
service
- The service.- Returns:
- The endpoint for the given service, or empty if the service endpoint is not known.
-
compareTo
public int compareTo(Region other)
Compares to regions lexicographically based on their regionId.- Specified by:
compareTo
in interfaceComparable<Region>
- Parameters:
other
- The Region to be compared.- Returns:
- the value 0 if the regionId of the compared Region is equal to the regionId of this Region; a value less than 0 if the regionId of this Region is lexicographically less than the regionId of the compared Region; and a value greater than 0 if the regionId of this Region is lexicographically greater than the regionId of the compared Region.
-
values
public static Region[] values()
Return all known Regions in this version of the SDK, except possibly the region returned by IMDS (Instance Metadata Service, only available on OCI instances), since IMDS is not automatically contacted by this method.To ensure that this method also returns the region provided by IMDS, call
registerFromInstanceMetadataService()
explicitly before callingvalues()
.- Returns:
- Known regions
-
valueOf
public static Region valueOf(@Nonnull String name) throws IllegalArgumentException
Returns the Region object matching the specified name.The name must match exactly. (Extraneous whitespace characters are not permitted.)
- Parameters:
name
- The name of the region- Returns:
- The Region object matching the specified name, if available.
- Throws:
IllegalArgumentException
- if no region exists with the specified name
-
formatDefaultRegionEndpoint
public static String formatDefaultRegionEndpoint(Service service, Region region)
Creates a default endpoint URL for the given service in the given region.Note, the regionId is not validated against known regions, this just creates a URL that follows the default format.
- Parameters:
service
- The service.region
- The region.- Returns:
- The endpoint.
-
formatDefaultRegionEndpoint
public static String formatDefaultRegionEndpoint(Service service, String regionId)
Creates a default endpoint URL for the given service in the given region.Note, the regionId is not validated against known regions, this just creates a URL that follows the default format.
This method uses a realm of
Realm.OC1
if the region cannot be determined.- Parameters:
service
- The service.regionId
- The region ID.- Returns:
- The endpoint.
-
fromRegionId
public static Region fromRegionId(String regionId)
Returns the Region object from the canonical public region ID.Throws IllegalArgumentException if the region ID is not known.
- Parameters:
regionId
- The region ID.- Returns:
- The Region object.
-
fromRegionCode
public static Region fromRegionCode(String regionCode)
Returns the Region object from the public region code.Throws IllegalArgumentException if the region code is not known.
- Parameters:
regionCode
- The region code.- Returns:
- The Region object.
-
fromRegionCodeOrId
public static Region fromRegionCodeOrId(String regionCodeOrId)
Returns the Region object from the public region code or id.Throws IllegalArgumentException if the region code or id is not known.
- Parameters:
regionCodeOrId
- The region code or id.- Returns:
- The Region object.
-
register
public static Region register(@Nonnull String regionId, @Nonnull Realm realm)
Register a new region.Used to allow the SDK to be forward compatible with unreleased regions.
- Parameters:
regionId
- The region ID.realm
- The realm of the new region.- Returns:
- The registered region (or existing one if found).
-
register
public static Region register(@Nonnull String regionId, @Nonnull Realm realm, String regionCode)
Register a new region.Used to allow the SDK to be forward compatible with unreleased regions.
- Parameters:
regionId
- The region ID.realm
- The realm of the new region.regionCode
- The 3-letter region code returned by the instance metadata service as the ‘region’ value, if it differs from regionId. This is only needed for very early regions.- Returns:
- The registered region (or existing one if found).
-
register
public static Region register(@Nonnull String regionId, @Nonnull Realm realm, String regionCode, boolean isAlloyRegion)
Register a new region.Used to allow the SDK to be forward compatible with unreleased regions.
- Parameters:
regionId
- The region ID.realm
- The realm of the new region.regionCode
- The 3-letter region code returned by the instance metadata service as the ‘region’ value, if it differs from regionId. This is only needed for very early regions.isAlloyRegion
- ‘true’ if region is from alloy configuration.- Returns:
- The registered region (or existing one if found).
-
enableInstanceMetadataService
public static void enableInstanceMetadataService()
Enables contact to IMDS (Instance Metadata Service, only available on OCI instances) if user decides to opt-in.
-
skipInstanceMetadataService
public static void skipInstanceMetadataService()
Instructs the SDK to not contact the IMDS (Instance Metadata Service, only available on OCI instances).
-
registerFromInstanceMetadataService
public static boolean registerFromInstanceMetadataService()
Send request to IMDS (Instance Metadata Service, only available on OCI instances), registers region, and sets hasUsedInstanceMetadataService = true.- Returns:
- true if response from IMDS was received
-
isServiceEnabled
public static boolean isServiceEnabled(String serviceName)
If Alloy config exists, read the config and check if service is enabled.If Alloy config doesn’t exist, return true.
- Parameters:
serviceName
-- Returns:
- true if service is enabled or else false.
-
getRegionId
public String getRegionId()
-
getRealm
public Realm getRealm()
-
isAlloyRegionCoexistEnabled
public static boolean isAlloyRegionCoexistEnabled()
Return the Alloy region coexist status.
-
-