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.
Modifier and Type | Method and 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.
|
public static volatile Region regionFromImds
public static final Region AP_CHUNCHEON_1
public static final Region AP_MELBOURNE_1
public static final Region AP_HYDERABAD_1
public static final Region AP_MUMBAI_1
public static final Region AP_OSAKA_1
public static final Region AP_SEOUL_1
public static final Region AP_SYDNEY_1
public static final Region AP_TOKYO_1
public static final Region CA_MONTREAL_1
public static final Region CA_TORONTO_1
public static final Region EU_AMSTERDAM_1
public static final Region EU_FRANKFURT_1
public static final Region EU_ZURICH_1
public static final Region ME_JEDDAH_1
public static final Region ME_DUBAI_1
public static final Region SA_SAOPAULO_1
public static final Region UK_LONDON_1
public static final Region US_ASHBURN_1
public static final Region US_PHOENIX_1
public static final Region US_SANJOSE_1
public static final Region UK_CARDIFF_1
public static final Region SA_SANTIAGO_1
public static final Region SA_VINHEDO_1
public static final Region IL_JERUSALEM_1
public static final Region EU_MARSEILLE_1
public static final Region AP_SINGAPORE_1
public static final Region ME_ABUDHABI_1
public static final Region EU_MILAN_1
public static final Region EU_STOCKHOLM_1
public static final Region AF_JOHANNESBURG_1
public static final Region EU_PARIS_1
public static final Region MX_QUERETARO_1
public static final Region EU_MADRID_1
public static final Region US_CHICAGO_1
public static final Region MX_MONTERREY_1
public static final Region US_SALTLAKE_2
public static final Region SA_BOGOTA_1
public static final Region SA_VALPARAISO_1
public static final Region AP_SINGAPORE_2
public static final Region ME_RIYADH_1
public static final Region US_LANGLEY_1
public static final Region US_LUKE_1
public static final Region US_GOV_ASHBURN_1
public static final Region US_GOV_CHICAGO_1
public static final Region US_GOV_PHOENIX_1
public static final Region UK_GOV_LONDON_1
public static final Region UK_GOV_CARDIFF_1
public static final Region AP_CHIYODA_1
public static final Region AP_IBARAKI_1
public static final Region ME_DCC_MUSCAT_1
public static final Region AP_DCC_CANBERRA_1
public static final Region EU_DCC_MILAN_1
public static final Region EU_DCC_MILAN_2
public static final Region EU_DCC_DUBLIN_2
public static final Region EU_DCC_RATING_2
public static final Region EU_DCC_RATING_1
public static final Region EU_DCC_DUBLIN_1
public static final Region EU_JOVANOVAC_1
public static final Region EU_MADRID_2
public static final Region EU_FRANKFURT_2
public static final Region EU_DCC_ZURICH_1
public static final Region EU_CRISSIER_1
public static final Region ME_DCC_DOHA_1
public static final Region ME_ABUDHABI_3
public static final Region AP_DCC_GAZIPUR_1
public static final Region ME_ABUDHABI_2
public static final Region ME_ABUDHABI_4
public static final Region US_SOMERSET_1
public static final Region US_THAMES_1
public static Region getRegionFromImds()
public String getRegionCode()
Get the region code.
public Optional<String> getEndpoint(Service service)
Resolves a service name to its endpoint in the region, if available.
service
- The service.public int compareTo(Region other)
Compares to regions lexicographically based on their regionId.
compareTo
in interface Comparable<Region>
other
- The Region to be compared.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.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 calling values()
.
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.)
name
- The name of the regionIllegalArgumentException
- if no region exists with the specified namepublic 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.
service
- The service.region
- The region.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.
service
- The service.regionId
- The region ID.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.
regionId
- The region ID.public static Region fromRegionCode(String regionCode)
Returns the Region object from the public region code. Throws IllegalArgumentException if the region code is not known.
regionCode
- The region code.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.
regionCodeOrId
- The region code or id.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.
regionId
- The region ID.realm
- The realm of the new region.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.
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.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.
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.public static void enableInstanceMetadataService()
Enables contact to IMDS (Instance Metadata Service, only available on OCI instances) if user decides to opt-in.
public static void skipInstanceMetadataService()
Instructs the SDK to not contact the IMDS (Instance Metadata Service, only available on OCI instances).
public static boolean registerFromInstanceMetadataService()
Send request to IMDS (Instance Metadata Service, only available on OCI instances), registers region, and sets hasUsedInstanceMetadataService = true.
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.
serviceName
- public String getRegionId()
public Realm getRealm()
public static boolean isAlloyRegionCoexistEnabled()
Return the Alloy region coexist status.
Copyright © 2016–2024. All rights reserved.