Class: DynamoDB::Endpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/ddbcli/ddb-endpoint.rb

Constant Summary collapse

ENDPOINTS =
{
  'dynamodb.us-east-1.amazonaws.com'      => 'us-east-1',
  'dynamodb.us-west-2.amazonaws.com'      => 'us-west-2',
  'dynamodb.us-west-1.amazonaws.com'      => 'us-west-1',
  'dynamodb.eu-west-1.amazonaws.com'      => 'eu-west-1',
  'dynamodb.eu-central-1.amazonaws.com'   => 'eu-central-1',
  'dynamodb.ap-southeast-1.amazonaws.com' => 'ap-southeast-1',
  'dynamodb.ap-southeast-2.amazonaws.com' => 'ap-southeast-2',
  'dynamodb.ap-northeast-1.amazonaws.com' => 'ap-northeast-1',
  'dynamodb.sa-east-1.amazonaws.com'      => 'sa-east-1',
}

Class Method Summary collapse

Class Method Details

.endpoint_and_region(endpoint_or_region) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/ddbcli/ddb-endpoint.rb', line 19

def self.endpoint_and_region(endpoint_or_region)
  if ENDPOINTS.key?(endpoint_or_region)
    [endpoint_or_region, ENDPOINTS[endpoint_or_region]]
  elsif ENDPOINTS.value?(endpoint_or_region)
    ep_key = ENDPOINTS.respond_to?(:key) ? ENDPOINTS.key(endpoint_or_region) : ENDPOINTS.index(endpoint_or_region)
    [ep_key, endpoint_or_region]
  else
    raise DynamoDB::Error, 'Unknown endpoint or region'
  end
end

.regionsObject



30
31
32
# File 'lib/ddbcli/ddb-endpoint.rb', line 30

def self.regions
  ENDPOINTS.values.dup
end