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, REGION_EU_FRANKFURT_1 = 'eu-frankfurt-1'.freeze ].freeze
- REGION_SHORT_NAMES_TO_LONG_NAMES =
{ 'phx': REGION_US_PHOENIX_1, 'iad': REGION_US_ASHBURN_1, 'fra': REGION_EU_FRANKFURT_1 }.freeze
- SERVICE_ENDPOINT_PREFIX_MAPPING =
{ BlockstorageClient: 'iaas', ComputeClient: 'iaas', VirtualNetworkClient: 'iaas', IdentityClient: 'identity', LoadBalancerClient: 'iaas', ObjectStorageClient: 'objectstorage', DatabaseClient: 'database', AuditClient: 'audit', Auth: 'auth', DnsClient: 'dns', FileStorageClient: 'filestorage', EmailClient: 'email' }.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
52 53 54 |
# File 'lib/oci/regions.rb', line 52 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.
40 41 42 43 44 |
# File 'lib/oci/regions.rb', line 40 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
48 49 50 |
# File 'lib/oci/regions.rb', line 48 def self.valid_region?(region) REGION_ENUM.include? region end |