Module: Awsome::R53
- Defined in:
- lib/awsome/r53.rb
Class Method Summary collapse
- .connection ⇒ Object
- .find_cname(zone_name, name) ⇒ Object
- .find_zone(zone_name) ⇒ Object
- .redefine_cname(zone_name, name, value) ⇒ Object
- .zones ⇒ Object
Class Method Details
.connection ⇒ Object
5 6 7 |
# File 'lib/awsome/r53.rb', line 5 def self.connection @@connection ||= Route53::Connection.new(Awsome.config.aws_access_key, Awsome.config.aws_secret_key) end |
.find_cname(zone_name, name) ⇒ Object
14 15 16 |
# File 'lib/awsome/r53.rb', line 14 def self.find_cname(zone_name, name) find_zone(zone_name).get_records('CNAME').find { |r| r.name == name } end |
.find_zone(zone_name) ⇒ Object
11 12 13 |
# File 'lib/awsome/r53.rb', line 11 def self.find_zone(zone_name) self.zones.find { |z| z.name == zone_name } end |
.redefine_cname(zone_name, name, value) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/awsome/r53.rb', line 17 def self.redefine_cname(zone_name, name, value) if record = find_cname(zone_name, name) record.update(nil, nil, nil, [value], nil) else Route53::DNSRecord.new(name, 'CNAME', 300, [value], find_zone(zone_name)).create end end |
.zones ⇒ Object
8 9 10 |
# File 'lib/awsome/r53.rb', line 8 def self.zones self.connection.get_zones end |