module Fog
module AWS
class DNS
class Real
require 'fog/dns/parsers/aws/create_hosted_zone'
# Creates a new hosted zone
#
# ==== Parameters
# * name<~String> - The name of the domain. Must be a fully-specified domain that ends with a period
# * options<~Hash>
# * caller_ref<~String> - unique string that identifies the request & allows failed
# calls to be retried without the risk of executing the operation twice
# * comment<~Integer> -
#
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
# * 'HostedZone'<~Hash>:
# * 'Id'<~String> -
# * 'Name'<~String> -
# * 'CallerReference'<~String>
# * 'Comment'<~String> -
# * 'ChangeInfo'<~Hash> -
# * 'Id'<~String>
# * 'Status'<~String>
# * 'SubmittedAt'<~String>
# * 'NameServers'<~Array>
# * 'NameServer'<~String>
# * status<~Integer> - 201 when successful
def create_hosted_zone(name, options = {})
optional_tags = ''
if options[:caller_ref]
optional_tags+= "#{options[:call_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
request({
:body => %Q{#{name}#{optional_tags}},
:parser => Fog::Parsers::AWS::DNS::CreateHostedZone.new,
:expects => 201,
:method => 'POST',
:path => "hostedzone"
})
end
end
class Mock
def create_hosted_zone(name, options = {})
Fog::Mock.not_implemented
end
end
end
end
end