2011-08-27 18:46:15 -04:00
|
|
|
module Fog
|
|
|
|
module DNS
|
|
|
|
class Rackspace
|
|
|
|
class Real
|
|
|
|
def create_domains(domains)
|
|
|
|
data = {
|
|
|
|
'domains' => []
|
|
|
|
}
|
|
|
|
|
|
|
|
domains.each do |domain|
|
2011-08-27 22:06:46 -04:00
|
|
|
domain_data =
|
|
|
|
{
|
|
|
|
'name' => domain[:name],
|
|
|
|
'emailAddress' => domain[:email]
|
|
|
|
}
|
|
|
|
|
|
|
|
if domain.has_key? :records
|
|
|
|
domain_data['recordsList'] = {
|
2011-08-27 18:46:15 -04:00
|
|
|
'records' => domain[:records].collect do |record|
|
|
|
|
record_data = {
|
|
|
|
'ttl' => record[:ttl],
|
|
|
|
'data' => record[:data],
|
|
|
|
'name' => record[:name],
|
|
|
|
'type' => record[:type],
|
|
|
|
}
|
|
|
|
|
|
|
|
if record.has_key? :priority
|
|
|
|
record_data.merge!({'priority' => record[:priority]})
|
|
|
|
else
|
|
|
|
record_data
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
2011-08-27 22:06:46 -04:00
|
|
|
end
|
|
|
|
data['domains'] << domain_data
|
2011-08-27 18:46:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
request(
|
|
|
|
:expects => 202,
|
|
|
|
:method => 'POST',
|
|
|
|
:path => 'domains',
|
2012-04-25 10:31:28 -04:00
|
|
|
:body => Fog::JSON.encode(data)
|
2011-08-27 18:46:15 -04:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|