Sha256: ddb4f448439b521832c93a6561d0d068177795d13849bf571c0616bb9eb1d84a
Contents?: true
Size: 805 Bytes
Versions: 8
Compression:
Stored size: 805 Bytes
Contents
Sunzi::Dependency.load('route53') module Sunzi class DNS class Route53 < Base def initialize(config, cloud) @api = ::Route53::Connection.new(config['route53']['key'], config['route53']['secret']) zone = config['fqdn']['zone'] @route53_zone = @api.get_zones.find{|i| i.name.sub(/\.$/,'') == zone } abort_with "zone for #{zone} was not found on Route 53!" unless @route53_zone end def add(fqdn, ip) say 'adding the public IP to Route 53...' ::Route53::DNSRecord.new(fqdn, "A", "300", [ip], @route53_zone).create end def delete(ip) say 'deleting the public IP from Route 53...' record = @route53_zone.get_records.find{|i| i.values.first == ip } record.delete if record end end end end
Version data entries
8 entries across 8 versions & 1 rubygems