Sha256: a719de1c8a175cc945a90c430c95a9efe5a5de9516964c6a93a1c54d754b3963

Contents?: true

Size: 1.63 KB

Versions: 19

Compression:

Stored size: 1.63 KB

Contents

module Fog
  module DNS
    class Slicehost
      class Real

        #require 'fog/slicehost/parsers/dns/update_record'

        # Get an individual DNS record from the specified zone
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'record_type'<~String> - type of DNS record to create (A, CNAME, etc)
        #     * 'zone_id'<~Integer> - ID of the zone to update
        #     * 'name'<~String> - host name this DNS record is for
        #     * 'data'<~String> - data for the DNS record (ie for an A record, the IP address)
        #     * 'ttl'<~Integer> - time to live in seconds
        #     * 'active'<~String> - whether this record is active or not ('Y' or 'N')
        #     * 'aux'<~String> - extra data required by the record
        def update_record(record_id, record_type, zone_id, name, data, options = {})
          optional_tags= ''
          options.each { |option, value|
            case option
            when :ttl
              optional_tags+= "<ttl type='integer'>#{value}</ttl>"
            when :active
              optional_tags+= "<active>#{value}</active>"
            when :aux
              optional_tags+= "<aux>#{value}</aux>"
            end
          }
          request(
            :body     => %Q{<?xml version="1.0" encoding="UTF-8"?><record><record_type>#{record_type}</record_type><zone_id type="integer">#{zone_id}</zone_id><name>#{name}</name><data>#{data}</data>#{optional_tags}</record>},
            :expects  => 200,
            :method   => 'PUT',
            :path     => "records/#{record_id}.xml"
          )
        end

      end
    end
  end
end

Version data entries

19 entries across 19 versions & 6 rubygems

Version Path
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/slicehost/requests/dns/update_record.rb
michiels-fog-1.3.1 lib/fog/slicehost/requests/dns/update_record.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/slicehost/requests/dns/update_record.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/slicehost/requests/dns/update_record.rb
fog-1.3.1 lib/fog/slicehost/requests/dns/update_record.rb
fog-1.3.0 lib/fog/slicehost/requests/dns/update_record.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/slicehost/requests/dns/update_record.rb
fog-1.2.0 lib/fog/slicehost/requests/dns/update_record.rb
ktheory-fog-1.1.2 lib/fog/slicehost/requests/dns/update_record.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/lib/fog/slicehost/requests/dns/update_record.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/lib/fog/slicehost/requests/dns/update_record.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/lib/fog/slicehost/requests/dns/update_record.rb
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/lib/fog/slicehost/requests/dns/update_record.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/lib/fog/slicehost/requests/dns/update_record.rb
fog-1.1.2 lib/fog/slicehost/requests/dns/update_record.rb
fog_tractical-1.1.4 lib/fog/slicehost/requests/dns/update_record.rb
fog_tractical-1.1.3 lib/fog/slicehost/requests/dns/update_record.rb
fog-1.1.1 lib/fog/slicehost/requests/dns/update_record.rb
fog-1.1.0 lib/fog/slicehost/requests/dns/update_record.rb