From bb7c819733f92de1f8811b6175d953f8c387e6ce Mon Sep 17 00:00:00 2001 From: solud Date: Fri, 17 Jul 2015 16:20:38 -0700 Subject: [PATCH] added new function create_hosted_zone_private This adds base level support for creating private Route53 zones. --- .../aws/requests/dns/create_hosted_zone.rb | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/fog/aws/requests/dns/create_hosted_zone.rb b/lib/fog/aws/requests/dns/create_hosted_zone.rb index b4cb8d48f..838bf92da 100644 --- a/lib/fog/aws/requests/dns/create_hosted_zone.rb +++ b/lib/fog/aws/requests/dns/create_hosted_zone.rb @@ -50,6 +50,33 @@ module Fog }) end end + + def create_hosted_zone_private(name, vpc, options = {}) + optional_tags = '' + if options[:caller_ref] + optional_tags += "#{options[:caller_ref]}" + else + #make sure we have a unique call reference + caller_ref = "ref-#{rand(1000000).to_s}" + optional_tags += "#{caller_ref}" + end + if options[:comment] + optional_tags += "#{options[:comment]}" + end + if vpc[:VPCId] and vpc[:VPCRegion] + optional_tags += "#{vpc[:VPCId]}#{vpc[:VPCRegion]}" + else + raise "Must specify VPCId and VPCRegion for private zone." + end + + request({ + :body => %Q{#{name}#{optional_tags}}, + :parser => Fog::Parsers::DNS::AWS::CreateHostedZone.new, + :expects => 201, + :method => 'POST', + :path => "hostedzone" + }) + end class Mock require 'time'