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, REGION_UK_LONDON_1 = 'uk-london-1'.freeze ].freeze
- REGION_SHORT_NAMES_TO_LONG_NAMES =
{ 'phx': REGION_US_PHOENIX_1, 'iad': REGION_US_ASHBURN_1, 'fra': REGION_EU_FRANKFURT_1, 'lhr': REGION_UK_LONDON_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', ContainerEngineClient: 'containerengine' }.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
55 56 57 |
# File 'lib/oci/regions.rb', line 55 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.
43 44 45 46 47 |
# File 'lib/oci/regions.rb', line 43 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
51 52 53 |
# File 'lib/oci/regions.rb', line 51 def self.valid_region?(region) REGION_ENUM.include? region end |