1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/dynect/requests/dns/get_zone.rb

58 lines
1.5 KiB
Ruby
Raw Normal View History

module Fog
module DNS
class Dynect
class Real
# Get one or more zones
#
# ==== Parameters
# * options<~Hash>:
# * zone<~String> - name of zone to lookup, or omit to return list of zones
def get_zone(options = {})
request(
:expects => 200,
:method => :get,
:path => ['Zone', options['zone']].compact.join('/')
)
end
end
class Mock
def get_zone(options = {})
2011-09-01 18:01:25 -04:00
if options['zone']
raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][options['zone']]
data = {
"zone_type" => zone[:zone_type],
"serial_style" => zone[:serial_style],
"serial" => zone[:serial],
"zone" => zone[:zone]
}
info = "get: Your zone, #{zone[:zone]}"
else
data = self.data[:zones].collect { |zone, data| "/REST/Zone/#{zone}/" }
info = "get: Your #{data.size} zones"
end
response = Excon::Response.new
response.status = 200
response.body = {
"status" => "success",
"data" => data,
"job_id" => Fog::Dynect::Mock.job_id,
"msgs" => [{
"INFO" => info,
"SOURCE" => "BLL",
"ERR_CD" => nil,
"LVL" => "INFO"
}]
}
response
end
end
end
end
end