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

added new function create_hosted_zone_private

This adds base level support for creating private Route53 zones.
This commit is contained in:
solud 2015-07-17 16:20:38 -07:00
parent 2a3750718c
commit bb7c819733

View file

@ -50,6 +50,33 @@ module Fog
})
end
end
def create_hosted_zone_private(name, vpc, options = {})
optional_tags = ''
if options[:caller_ref]
optional_tags += "<CallerReference>#{options[:caller_ref]}</CallerReference>"
else
#make sure we have a unique call reference
caller_ref = "ref-#{rand(1000000).to_s}"
optional_tags += "<CallerReference>#{caller_ref}</CallerReference>"
end
if options[:comment]
optional_tags += "<HostedZoneConfig><Comment>#{options[:comment]}</Comment></HostedZoneConfig>"
end
if vpc[:VPCId] and vpc[:VPCRegion]
optional_tags += "<VPC><VPCId>#{vpc[:VPCId]}</VPCId><VPCRegion>#{vpc[:VPCRegion]}</VPCRegion></VPC>"
else
raise "Must specify VPCId and VPCRegion for private zone."
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>},
:parser => Fog::Parsers::DNS::AWS::CreateHostedZone.new,
:expects => 201,
:method => 'POST',
:path => "hostedzone"
})
end
class Mock
require 'time'