Top Description Fields Constructors Methods
com.oracle.bmc

public final Class Region

extends Object
implements Serializable, Comparable<Region>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable, java.io.Serializable
Imports
com.oracle.bmc.http.client.HttpClient, .HttpProvider, .HttpResponse, .Method, .StandardClientProperties, com.oracle.bmc.http.internal.SyncFutureWaiter, com.oracle.bmc.internal.Alloy, .EndpointBuilder, com.oracle.bmc.model.RegionAlloySchema, .RegionSchema, com.oracle.bmc.model.internal.JsonConverter, com.oracle.bmc.util.VisibleForTesting, com.oracle.bmc.util.internal.FileUtils, .NameUtils, .StringUtils, com.oracle.bmc.waiter.ExponentialBackoffDelayStrategyWithJitter, .WaiterConfiguration, org.slf4j.Logger, jakarta.annotation.Nonnull, java.io.File, .IOException, .Serializable, java.net.URI, java.nio.charset.StandardCharsets, java.nio.file.Files, .Paths, java.time.Duration, java.util.HashMap, .HashSet, .LinkedHashMap, .Locale, .Map, .Set, .List, .Optional, java.util.concurrent.TimeUnit, java.util.concurrent.locks.Lock, .ReentrantReadWriteLock, java.util.stream.Collectors

Class containing all of the known Regions that can be contacted.

Note, not all services may be available in all regions.

Field Summary

Modifier and TypeField and Description
public static final Region
private static final Map<String, Region>
private static final Map<String, Region>
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
pack-priv static volatile String
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
private static volatile boolean
private static volatile boolean
private static volatile boolean
private static volatile boolean
private static volatile boolean
pack-priv static volatile boolean
private static volatile boolean
public static final Region
private static volatile boolean
private static final Map<String, Region>
private static final ReentrantReadWriteLock
private static final Logger
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
private static volatile String
private static final String
private static final String
private static final Set<String>
private static final Lock
private final Realm
realm

Get the realm this region belongs to.

private final String
regionCode

The region key as defined in https://docs.oracle.com/iaas/Content/General/Concepts/regions.htm or null if none.

public static volatile Region
private final String
regionId

The region identifier as defined in https://docs.oracle.com/iaas/Content/General/Concepts/regions.htm

private static final String
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
private static final long
private static final Map<String, Map<Region, String>>
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
public static final Region
private static final Lock

Constructor Summary

AccessConstructor and Description
private
Region(String regionId, Optional<String> regionCode, Realm realm)

private
Region(String regionId, Optional<String> regionCode, Realm realm, boolean isAlloyRegion)

Method Summary

Modifier and TypeMethod and Description
public int

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.
compareTo
(Region
The Region to be compared.
other
)

Implements java.lang.Comparable.compareTo.

Compares to regions lexicographically based on their regionId.

public static void
enableInstanceMetadataService()

Enables contact to IMDS (Instance Metadata Service, only available on OCI instances) if user decides to opt-in.

public boolean
equals(final Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public static String

Returns:

The endpoint.
formatDefaultRegionEndpoint
(Service
The service.
service
,
Region
The region.
region
)

Creates a default endpoint URL for the given service in the given region.

public static String

Returns:

The endpoint.
formatDefaultRegionEndpoint
(Service
The service.
service
,
String
The region ID.
regionId
)

Creates a default endpoint URL for the given service in the given region.

public static Region

Returns:

The Region object.
fromRegionCode
(String
The region code.
regionCode
)

Returns the Region object from the public region code.

public static Region

Returns:

The Region object.
fromRegionCodeOrId
(String
The region code or id.
regionCodeOrId
)

Returns the Region object from the public region code or id. Throws IllegalArgumentException if the region code or id is not known.

public static Region

Returns:

The Region object.
fromRegionId
(String
The region ID.
regionId
)

Returns the Region object from the canonical public region ID. Throws IllegalArgumentException if the region ID is not known.

private static String
getContentFromConfigFile(String regionsConfigFilePath)

private static String
public Optional<String>

Returns:

The endpoint for the given service, or empty if the service endpoint is not known.
getEndpoint
(Service
The service.
service
)

Resolves a service name to its endpoint in the region, if available.

private static String
public Realm
private static Region
getRegion(String regionId, Realm realm, boolean isAlloyRegion)

private static Optional<Region>
getRegionAndRegisterIfNecessary(String regionCodeOrId)

Implements decision tree to determine Region.

public String
getRegionCode()

Get the region code.

public static Region
public static Region
getRegionFromImds(String metadataServiceBaseUrl)

private static Region
getRegionFromMap(Map<String, Region> regionMap, String regionId, Realm realm)

public String
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public static boolean
isAlloyRegionCoexistEnabled()

Return the Alloy region coexist status.

public static boolean

Returns:

true if service is enabled or else false.
isServiceEnabled
(String serviceName)

If Alloy config exists, read the config and check if service is enabled.

private static Optional<Region>
private static Optional<Region>
private static Optional<Region>
private static void
readAlloyRegionConfigFile()

Registers region, sets hasUsedAlloyConfigFile status to true and stores the alloy enabled services to OCI_SDK_ENABLED_SERVICES_SET.

private static void
readEnvVar()

Registers region and sets envVarUsed status to true.

private static void
readRegionConfigFile()

Registers region and sets hasUsedConfigFile status to true.

public static Region

Returns:

The registered region (or existing one if found).
register
(String
The region ID.
regionId
,
final Realm
The realm of the new region.
realm
)

Register a new region.

public static Region

Returns:

The registered region (or existing one if found).
register
(String
The region ID.
regionId
,
final Realm
The realm of the new region.
realm
,
String
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.
regionCode
)

Register a new region.

public static Region

Returns:

The registered region (or existing one if found).
register
(String
The region ID.
regionId
,
final Realm
The realm of the new region.
realm
,
String
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.
regionCode
,
boolean
'true' if region is from alloy configuration.
isAlloyRegion
)

Register a new region.

private static void
registerAllRegions()

Register all regions and sets status

public static boolean

Returns:

true if response from IMDS was received
registerFromInstanceMetadataService
()

Send request to IMDS (Instance Metadata Service, only available on OCI instances), registers region, and sets hasUsedInstanceMetadataService = true.

private static void
registerRegionWithDefaultRealm(String regionId)

Registers region using regionId and default realm env var

pack-priv static void
public static void
skipInstanceMetadataService()

Instructs the SDK to not contact the IMDS (Instance Metadata Service, only available on OCI instances).

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public static Region

Returns:

The Region object matching the specified name, if available.
valueOf
(String
The name of the region
name
)

Returns the Region object matching the specified name.

public static Region[]

Returns:

Known regions
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.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait