Sha256: 4159dafc0e3d4a9b93e5d3c9c12ea9746342ff67e96624a36f76a879abf74686

Contents?: true

Size: 1.53 KB

Versions: 103

Compression:

Stored size: 1.53 KB

Contents

module Fog
  module DNS
    class Bluebox
      class Real

        require 'fog/bluebox/parsers/dns/create_record'

        # Create a new record in a DNS zone
        # ==== Parameters
        # * type<~String> - type of DNS record to create (A, CNAME, etc)
        # * name<~String> - host name this DNS record is for
        # * content<~String> - data for the DNS record (ie for an A record, the IP address)
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'name'<~String> - as above
        #     * 'id'<~Integer> - Id of zone/domain - used in future API calls for this zone
        #     * 'ttl'<~Integer> - as above
        #     * 'data'<~String> - as above
        #     * 'active'<~String> - as above
        #     * 'aux'<~String> - as above
        def create_record(zone_id, type, name, content, options={})
          body = %Q{<?xml version="1.0" encoding="UTF-8"?><record><type>#{type}</type><name>#{name}</name><content>#{content}</content>}
          options.each do |k,v|
            body += %Q{<#{k}>#{v}</#{k}>}
          end
          body += %Q{</record>}
          request(
            :body     => body,
            :expects  => 202,
            :method   => 'POST',
            :parser   => Fog::Parsers::DNS::Bluebox::CreateRecord.new,
            :path     => "/api/domains/#{zone_id}/records.xml"
          )
        end

      end

      class Mock

        def create_record(zone_id, type, name, content)
          Fog::Mock.not_implemented
        end

      end
    end
  end
end

Version data entries

103 entries across 103 versions & 17 rubygems

Version Path
fog-1.22.0 lib/fog/bluebox/requests/dns/create_record.rb
fog-1.21.0 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/bluebox/requests/dns/create_record.rb
fog-1.20.0 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/bluebox/requests/dns/create_record.rb
fog-1.19.0 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/bluebox/requests/dns/create_record.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/bluebox/requests/dns/create_record.rb