Class: Breeze::Dns::Record

Inherits:
Zone
  • Object
show all
Defined in:
lib/breeze/tasks/dns.rb

Instance Method Summary collapse

Methods inherited from Zone

#import

Methods inherited from Veur

inherited

Instance Method Details

#create(zone_id, name, type, ip, ttl = 3600) ⇒ Object



53
54
55
56
# File 'lib/breeze/tasks/dns.rb', line 53

def create(zone_id, name, type, ip, ttl=3600)
  get_zone(zone_id).records.create(:name => name, :type => type, :value => ip, :ttl => ttl)
  FogWrapper.flush_mock_data! if Fog.mocking?
end

#destroy(zone_id, name, type = nil) ⇒ Object



60
61
62
63
64
65
# File 'lib/breeze/tasks/dns.rb', line 60

def destroy(zone_id, name, type=nil)
  records = get_zone(zone_id).records.select{ |r| r.name == name && (type.nil? || r.type == type) }
  if force_or_accept?("Destroy #{records.size} record#{records.size == 1 ? '' : 's'}?")
    records.each(&:destroy)
  end
end