Class: S3Website::Endpoint
- Inherits:
-
Object
- Object
- S3Website::Endpoint
- Defined in:
- lib/s3_website/endpoint.rb
Constant Summary collapse
- DEFAULT_LOCATION_CONSTRAINT =
'us-east-1'
Instance Attribute Summary collapse
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
#location_constraint ⇒ Object
readonly
Returns the value of attribute location_constraint.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#website_hostname ⇒ Object
readonly
Returns the value of attribute website_hostname.
Instance Method Summary collapse
-
#initialize(location_constraint = nil) ⇒ Endpoint
constructor
A new instance of Endpoint.
- #location_constraints ⇒ Object
Constructor Details
#initialize(location_constraint = nil) ⇒ Endpoint
Returns a new instance of Endpoint.
6 7 8 9 10 11 12 13 14 |
# File 'lib/s3_website/endpoint.rb', line 6 def initialize(location_constraint=nil) location_constraint = DEFAULT_LOCATION_CONSTRAINT if location_constraint.nil? raise "Invalid S3 location constraint #{location_constraint}" unless location_constraints.has_key?location_constraint @region = location_constraints.fetch(location_constraint)[:region] @hostname = location_constraints.fetch(location_constraint)[:endpoint] @website_hostname = location_constraints.fetch(location_constraint)[:website_hostname] @location_constraint = location_constraint end |
Instance Attribute Details
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
4 5 6 |
# File 'lib/s3_website/endpoint.rb', line 4 def hostname @hostname end |
#location_constraint ⇒ Object (readonly)
Returns the value of attribute location_constraint.
4 5 6 |
# File 'lib/s3_website/endpoint.rb', line 4 def location_constraint @location_constraint end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
4 5 6 |
# File 'lib/s3_website/endpoint.rb', line 4 def region @region end |
#website_hostname ⇒ Object (readonly)
Returns the value of attribute website_hostname.
4 5 6 |
# File 'lib/s3_website/endpoint.rb', line 4 def website_hostname @website_hostname end |
Instance Method Details
#location_constraints ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/s3_website/endpoint.rb', line 17 def location_constraints { 'us-east-1' => { :region => 'US Standard', :website_hostname => 's3-website-us-east-1.amazonaws.com', :endpoint => 's3.amazonaws.com' }, 'us-west-2' => { :region => 'US West (Oregon)', :website_hostname => 's3-website-us-west-2.amazonaws.com', :endpoint => 's3-us-west-2.amazonaws.com' }, 'us-west-1' => { :region => 'US West (Northern California)', :website_hostname => 's3-website-us-west-1.amazonaws.com', :endpoint => 's3-us-west-1.amazonaws.com' }, 'EU' => { :region => 'EU (Ireland)', :website_hostname => 's3-website-eu-west-1.amazonaws.com', :endpoint => 's3-eu-west-1.amazonaws.com' }, 'ap-southeast-1' => { :region => 'Asia Pacific (Singapore)', :website_hostname => 's3-website-ap-southeast-1.amazonaws.com', :endpoint => 's3-ap-southeast-1.amazonaws.com' }, 'ap-southeast-2' => { :region => 'Asia Pacific (Sydney)', :website_hostname => 's3-website-ap-southeast-2.amazonaws.com', :endpoint => 's3-ap-southeast-2.amazonaws.com' }, 'ap-northeast-1' => { :region => 'Asia Pacific (Tokyo)', :website_hostname => 's3-website-ap-northeast-1.amazonaws.com', :endpoint => 's3-ap-northeast-1.amazonaws.com' }, 'sa-east-1' => { :region => 'South America (Sao Paulo)', :website_hostname => 's3-website-sa-east-1.amazonaws.com', :endpoint => 's3-sa-east-1.amazonaws.com' } } end |