Module: OracleBMC::Regions

Defined in:
lib/oraclebmc/regions.rb

Constant Summary collapse

REGION_ENUM =
[REGION_US_PHOENIX_1 = 'us-phoenix-1']

Class Method Summary collapse

Class Method Details

.get_service_endpoint(region, service) ⇒ String

Returns an endpoint for the given region and service.

Parameters:

  • region (String)

    A region used to determine the service endpoint. This will usually correspond to a value in REGION_ENUM, but may be an arbitrary string.

  • service (Symbol)

    A symbol representing a service client class (e.g. :IdentityClient)

Returns:

  • (String)

    A fully qualified endpoint



15
16
17
18
19
# File 'lib/oraclebmc/regions.rb', line 15

def self.get_service_endpoint(region, service)
  prefix = SERVICE_ENDPOINT_PREFIX_MAPPING[service]
  fail "Service '#{service}' is not supported." unless prefix
  format_endpoint(prefix, region)
end

.valid_region?(region) ⇒ Boolean

Returns true if the given string corresponds to a known region, as defined in REGION_ENUM.

Returns:

  • (Boolean)

    Returns true if the given string corresponds to a known region, as defined in REGION_ENUM.



22
23
24
# File 'lib/oraclebmc/regions.rb', line 22

def self.valid_region? region
  return REGION_ENUM.include? region
end