class Route53
Attributes
client[RW]
r53[RW]
Public Class Methods
new(id, domain_name)
click to toggle source
Calls superclass method
# File lib/route53_auto.rb, line 9 def initialize(id, domain_name) super(id) puts "\nswitcher initialized" if @switcher @client = r53_client_connect puts 'Client auth successfull' if @client @r53 = auto_change(domain_name) puts 'r53 client auth successfull' if @r53 end
Public Instance Methods
r53_client_connect()
click to toggle source
# File lib/route53_auto.rb, line 18 def r53_client_connect Aws::Route53::Client.new(region: @region, credentials: @credentials) end
reload()
click to toggle source
# File lib/route53_auto.rb, line 22 def reload @client = self.r53_client_connect end
Private Instance Methods
auto_change(domain_name)
click to toggle source
# File lib/route53_auto.rb, line 28 def auto_change(domain_name) @client.change_resource_record_sets({ hosted_zone_id: @client.list_hosted_zones[:hosted_zones][0][:id], change_batch: { changes: [{ action: "UPSERT", resource_record_set: { name: domain_name, type: "CNAME", ttl: 60, resource_records: [{ value: @ec2.public_dns_name }] } }] } }) end