Module: OCI::Regions
- Defined in:
- lib/oci/regions.rb
Overview
Module defining available regions and helper methods to get value service endpoints
Constant Summary collapse
- REGION_ENUM =
[ REGION_US_PHOENIX_1 = 'us-phoenix-1'.freeze, REGION_US_ASHBURN_1 = 'us-ashburn-1'.freeze ].freeze
- SERVICE_ENDPOINT_PREFIX_MAPPING =
{ BlockstorageClient: 'iaas', ComputeClient: 'iaas', VirtualNetworkClient: 'iaas', IdentityClient: 'identity', LoadBalancerClient: 'iaas', ObjectStorageClient: 'objectstorage' }.freeze
Class Method Summary collapse
- .format_endpoint(prefix, region) ⇒ Object
-
.get_service_endpoint(region, service) ⇒ String
Returns an endpoint for the given region and service.
- .valid_region?(region) ⇒ Boolean
Class Method Details
.format_endpoint(prefix, region) ⇒ Object
39 40 41 |
# File 'lib/oci/regions.rb', line 39 def self.format_endpoint(prefix, region) "https://#{prefix}.#{region}.oraclecloud.com" end |
.get_service_endpoint(region, service) ⇒ String
Returns an endpoint for the given region and service.
27 28 29 30 31 |
# File 'lib/oci/regions.rb', line 27 def self.get_service_endpoint(region, service) prefix = SERVICE_ENDPOINT_PREFIX_MAPPING[service] raise "Service '#{service}' is not supported." unless prefix format_endpoint(prefix, region) end |
.valid_region?(region) ⇒ Boolean
35 36 37 |
# File 'lib/oci/regions.rb', line 35 def self.valid_region?(region) REGION_ENUM.include? region end |