mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
add list_hosted_zones request mock
This commit is contained in:
parent
52501a30d1
commit
b1f83c9474
1 changed files with 43 additions and 0 deletions
|
@ -49,6 +49,49 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Mock
|
||||||
|
|
||||||
|
def list_hosted_zones(options = {})
|
||||||
|
if options[:max_items].nil?
|
||||||
|
maxitems = 100
|
||||||
|
else
|
||||||
|
maxitems = options[:max_items]
|
||||||
|
end
|
||||||
|
|
||||||
|
if options[:marker].nil?
|
||||||
|
start = 0
|
||||||
|
else
|
||||||
|
start = self.data[:zones].find_index {|z| z[:zone_id] == options[:marker]}
|
||||||
|
end
|
||||||
|
|
||||||
|
zones = self.data[:zones].values[start, maxitems]
|
||||||
|
next_zone = self.data[:zones].values[start + maxitems]
|
||||||
|
truncated = !next_zone.nil?
|
||||||
|
|
||||||
|
response = Excon::Response.new
|
||||||
|
response.body = {
|
||||||
|
'HostedZones' => zones.map do |z|
|
||||||
|
{
|
||||||
|
'Id' => z[:zone_id],
|
||||||
|
'Name' => z[:name],
|
||||||
|
'CallerReference' => z[:reference],
|
||||||
|
'Comment' => z[:comment],
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
'Marker' => options[:marker].to_s,
|
||||||
|
'MaxItems' => options[:max_items].to_s,
|
||||||
|
'IsTruncated' => truncated.to_s
|
||||||
|
}
|
||||||
|
|
||||||
|
if truncated
|
||||||
|
response.body['NextMarker'] = next_zone[:zone_id]
|
||||||
|
end
|
||||||
|
|
||||||
|
response
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue