Class: HttpKinesis::Region

Inherits:
Object
  • Object
show all
Defined in:
lib/http-kinesis/region.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(region_name) ⇒ HttpKinesis::Region

Instantiates an AWS region, validating the supplied region name and throwing HttpKinesis::Error if invalid

Parameters:

  • region_name (String)

    The name of the region

Raises:

  • HttpKinesis::Error if specified region name is invalid


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/http-kinesis/region.rb', line 14

def initialize(region_name)
  regions = {
    'us-east-1' => 'kinesis.us-east-1.amazonaws.com',
    'us-east-2' => 'kinesis.us-east-2.amazonaws.com',
    'us-west-1' => 'kinesis.us-west-1.amazonaws.com',
    'us-west-2' => 'kinesis.us-west-2.amazonaws.com',
    'ap-south-1' => 'kinesis.ap-south-1.amazonaws.com',
    'ap-northeast-2' => 'kinesis.ap-northeast-2.amazonaws.com',
    'ap-southeast-1' => 'kinesis.ap-southeast-1.amazonaws.com',
    'ap-southeast-2' => 'kinesis.ap-southeast-2.amazonaws.com',
    'ap-northeast-1' => 'kinesis.ap-northeast-1.amazonaws.com',
    'eu-central-1' => 'kinesis.eu-central-1.amazonaws.com',
    'eu-west-1' => 'kinesis.eu-west-1.amazonaws.com',
    'sa-east-1' => 'kinesis.sa-east-1.amazonaws.com'
  }
  raise ::HttpKinesis::Error.new("Invalid region: #{region_name}") unless regions.keys.include?(region_name)
  @region_name = region_name
  @endpoint = 'https://' + regions[region_name]
end

Instance Attribute Details

#endpointObject (readonly)

Returns the value of attribute endpoint


7
8
9
# File 'lib/http-kinesis/region.rb', line 7

def endpoint
  @endpoint
end

#region_nameObject (readonly)

Returns the value of attribute region_name


7
8
9
# File 'lib/http-kinesis/region.rb', line 7

def region_name
  @region_name
end