2011-06-17 06:17:02 -04:00
|
|
|
module Fog
|
2011-07-14 20:22:43 -04:00
|
|
|
module DNS
|
|
|
|
class Dynect
|
2011-06-17 06:17:02 -04:00
|
|
|
class Real
|
|
|
|
|
2011-07-14 20:22:43 -04:00
|
|
|
# Get one or more zones
|
2011-06-17 06:17:02 -04:00
|
|
|
#
|
2011-07-14 20:22:43 -04:00
|
|
|
# ==== Parameters
|
|
|
|
# * options<~Hash>:
|
|
|
|
# * zone<~String> - name of zone to lookup, or omit to return list of zones
|
2011-06-17 06:17:02 -04:00
|
|
|
|
2011-07-14 20:22:43 -04:00
|
|
|
def get_zone(options = {})
|
2011-06-17 06:17:02 -04:00
|
|
|
request(
|
2011-07-14 20:22:43 -04:00
|
|
|
:expects => 200,
|
2012-05-28 10:20:29 -04:00
|
|
|
:idempotent => true,
|
2011-07-14 20:22:43 -04:00
|
|
|
:method => :get,
|
|
|
|
:path => ['Zone', options['zone']].compact.join('/')
|
|
|
|
)
|
2011-06-17 06:17:02 -04:00
|
|
|
end
|
|
|
|
end
|
2011-08-29 19:04:13 -04:00
|
|
|
|
|
|
|
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']]
|
2011-08-29 19:04:13 -04:00
|
|
|
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
|
2011-06-17 06:17:02 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|