Sha256: 7caa6a60cf0d5c4e4691f1d9d0f7d5b8d198e63405fad6c332d00fa820405ef0

Contents?: true

Size: 1.93 KB

Versions: 39

Compression:

Stored size: 1.93 KB

Contents

module Fog
  module DNS
    class Bluebox
      class Real
        require 'fog/bluebox/parsers/dns/create_zone'

        # Create a new DNS zone
        # ==== Parameters
        #     * 'name'<~String> - The name of the zone
        #     * 'ttl'<~Integer> - TimeToLive (ttl) for the domain, in seconds
        #     * 'retry'<~Integer> - Retry interval for the domain, in seconds
        #     * 'refresh'<~Integer> - Refresh interval for the zone
        #     * 'minimum'<~Integer> - Minimum refresh interval for the zone
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'name'<~String> - The name of the zone
        #     * 'serial'<~Integer> - Serial number of the zone
        #     * 'ttl'<~Integer> - TimeToLive (ttl) for the domain, in seconds
        #     * 'retry'<~Integer> - Retry interval for the domain, in seconds
        #     * 'record-count'<~Integer> - Number of records in the zone
        #     * 'id'<~String> - Id for the zone
        #     * 'refresh'<~Integer> - Refresh interval for the zone
        #     * 'minimum'<~Integer> - Minimum refresh interval for the zone
        def create_zone(options)
          body = %Q{<?xml version="1.0" encoding="UTF-8"?><domain><name>#{options[:name]}</name><ttl>#{options[:ttl]}</ttl>}
          body += %Q{<retry>#{options[:retry]}</retry>} if options[:retry]
          body += %Q{<refresh>#{options[:retry]}</refresh>} if options[:refresh]
          body += %Q{<minimum>#{options[:minimum]}</minimum>} if options[:minimum]
          body += %Q{</domain>}
          request(
            :body     => body,
            :expects  => 202,
            :method   => 'POST',
            :parser   => Fog::Parsers::DNS::Bluebox::CreateZone.new,
            :path     => "/api/domains.xml"
          )
        end
      end

      class Mock
        def create_zone(options)
          Fog::Mock.not_implemented
        end
      end
    end
  end
end

Version data entries

39 entries across 37 versions & 5 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/lib/fog/bluebox/requests/dns/create_zone.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/lib/fog/bluebox/requests/dns/create_zone.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/lib/fog/bluebox/requests/dns/create_zone.rb
fog-1.42.1 lib/fog/bluebox/requests/dns/create_zone.rb
fog-2.0.0 lib/fog/bluebox/requests/dns/create_zone.rb
fog-1.42.0 lib/fog/bluebox/requests/dns/create_zone.rb
fog-1.41.0 lib/fog/bluebox/requests/dns/create_zone.rb
fog-1.40.0 lib/fog/bluebox/requests/dns/create_zone.rb
fog-1.39.0 lib/fog/bluebox/requests/dns/create_zone.rb
fog-1.38.0 lib/fog/bluebox/requests/dns/create_zone.rb
fog-1.37.0 lib/fog/bluebox/requests/dns/create_zone.rb
fog-1.36.0 lib/fog/bluebox/requests/dns/create_zone.rb
fog-1.35.0 lib/fog/bluebox/requests/dns/create_zone.rb
fog-2.0.0.pre.0 lib/fog/bluebox/requests/dns/create_zone.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/bluebox/requests/dns/create_zone.rb
fog-1.34.0 lib/fog/bluebox/requests/dns/create_zone.rb
fog-1.33.0 lib/fog/bluebox/requests/dns/create_zone.rb
fog-1.32.0 lib/fog/bluebox/requests/dns/create_zone.rb
fog-1.31.0 lib/fog/bluebox/requests/dns/create_zone.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/bluebox/requests/dns/create_zone.rb