1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

Merge pull request #154 from solud/master

Route53 zone listing fix and support for private hosted zones
This commit is contained in:
Josh Lane 2015-07-17 19:09:44 -07:00
commit 391b2f4ff5
3 changed files with 19 additions and 3 deletions

View file

@ -10,8 +10,8 @@ module Fog
model Fog::DNS::AWS::Zone
def all(options = {})
options[:marker] ||= marker
options[:maxitems] ||= max_items
options[:marker] ||= marker unless marker.nil?
options[:maxitems] ||= max_items unless max_items.nil?
data = service.list_hosted_zones(options).body['HostedZones']
load(data)
end

View file

@ -8,6 +8,8 @@ module Fog
@name_servers = []
@response = {}
@section = :hosted_zone
@vpcs = []
@vpc = {}
end
def end_element(name)
@ -15,7 +17,7 @@ module Fog
case name
when 'Id'
@hosted_zone[name]= value.sub('/hostedzone/', '')
when 'Name', 'CallerReference', 'Comment'
when 'Name', 'CallerReference', 'Comment', 'PrivateZone', 'Config', 'ResourceRecordSetCount'
@hosted_zone[name]= value
when 'HostedZone'
@response['HostedZone'] = @hosted_zone
@ -31,6 +33,15 @@ module Fog
when 'NameServers'
@response['NameServers'] = @name_servers
@name_servers = {}
when 'VPCId', 'VPCRegion'
@vpc[name] = value
when 'VPC'
@vpcs << @vpc
@vpc = {}
when 'VPCs'
@response['HostedZone']['VPCs'] = @vpcs
@vpcs = {}
@section = :vpcs
end
end
end

View file

@ -12,6 +12,8 @@ module Fog
# * caller_ref<~String> - unique string that identifies the request & allows failed
# calls to be retried without the risk of executing the operation twice
# * comment<~String> -
# * vpc_id<~String> - specify both a VPC's ID and its region to create a private zone for that VPC
# * vpc_region<~String> - specify both a VPC's ID and its region to create a private zone for that VPC
#
# ==== Returns
# * response<~Excon::Response>:
@ -40,6 +42,9 @@ module Fog
if options[:comment]
optional_tags += "<HostedZoneConfig><Comment>#{options[:comment]}</Comment></HostedZoneConfig>"
end
if options[:vpc_id] and options[:vpc_region]
optional_tags += "<VPC><VPCId>#{options[:vpc_id]}</VPCId><VPCRegion>#{options[:vpc_region]}</VPCRegion></VPC>"
end
request({
:body => %Q{<?xml version="1.0" encoding="UTF-8"?><CreateHostedZoneRequest xmlns="https://route53.amazonaws.com/doc/#{@version}/"><Name>#{name}</Name>#{optional_tags}</CreateHostedZoneRequest>},