2010-12-12 18:02:02 -05:00
|
|
|
module Fog
|
|
|
|
module Parsers
|
2011-06-15 20:25:01 -04:00
|
|
|
module DNS
|
|
|
|
module Zerigo
|
2010-12-12 18:02:02 -05:00
|
|
|
|
2010-12-13 08:51:04 -05:00
|
|
|
class FindHosts < Fog::Parsers::Base
|
2010-12-12 18:02:02 -05:00
|
|
|
|
|
|
|
def reset
|
|
|
|
@host = {}
|
|
|
|
@response = { 'hosts' => [] }
|
|
|
|
end
|
|
|
|
|
|
|
|
def end_element(name)
|
|
|
|
case name
|
2012-02-10 11:21:34 -05:00
|
|
|
when 'id', 'zone-id'
|
2011-05-12 16:15:13 -04:00
|
|
|
@host[name] = value.to_i
|
2012-02-10 11:21:34 -05:00
|
|
|
when 'priority', 'ttl'
|
|
|
|
@host[name] = value.to_i if value
|
2010-12-12 18:02:02 -05:00
|
|
|
when 'data', 'fqdn', 'host-type', 'hostname', 'notes', 'zone-id', 'created-at', 'updated-at'
|
2011-05-12 16:15:13 -04:00
|
|
|
@host[name] = value
|
2010-12-12 18:02:02 -05:00
|
|
|
when 'host'
|
|
|
|
@response['hosts'] << @host
|
|
|
|
@host = {}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|