Sha256: 8915ade9b84ca941cedd549a631cf72e6a02f6cf82cfeb2deee0f12f604057b2

Contents?: true

Size: 1.84 KB

Versions: 5

Compression:

Stored size: 1.84 KB

Contents

# frozen_string_literal: true

module Fog
  module DNS
    class PowerDNS
      class Real
        # Create a single zone in PowerDNS
        # Server, name and nameservers LIST are required
        #
        # ==== Parameters
        # * server<~String> - Server ID
        # * name<~String> - Name of domain
        # * nameservers<~Array> - List of nameservers
        # * options<~Hash> - Other options
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'id': <~String>,
        #     * "name": <~String>,
        #     * 'type': <~String>,
        #     * 'url': <~String>,
        #     * 'kind': <~String>,
        #     * 'serial': <~Integer>,
        #     * 'notified_serial': <~Int>,
        #     * 'masters': <~Array,
        #     * 'dnssec': <~Boolean>,
        #     * 'nsec3param': <~String>,
        #     * 'nsec3narrow': <~Boolean>,
        #     * 'presigned': <~Boolean>,
        #     * 'soa_edit': '<~String>',
        #     * 'soa_edit_api': '<~String>',
        #     * 'account': '<~String>',
        #     * 'nameservers': <~Array>,
        #     * 'servers': <~Array>,
        #     * 'recursion_desired': <~Boolean>,
        #     * 'records': <~Array>,
        #     * 'comments': <~Array>,
        #   * status<~Integer>  201 when successful

        def create_zone(server, name, nameservers, options = {})
          body = {
            'name' => name,
            'nameservers' => nameservers
          }

          options.each do |option, value|
            body[option] = value
          end

          request(
            body: Fog::JSON.encode(body),
            expects: 201,
            method: 'POST',
            path: "/api/#{@api_version}/servers/#{server}/zones"
          ).body
        end
      end
      class Mock
        # TODO: Write this
      end
    end
  end
end

Version data entries

5 entries across 3 versions & 2 rubygems

Version Path
fog-powerdns-0.2.1 lib/fog/dns/powerdns/requests/create_zone.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-powerdns-0.2.0/lib/fog/dns/powerdns/requests/create_zone.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-powerdns-0.2.0/lib/fog/dns/powerdns/requests/create_zone.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-powerdns-0.2.0/lib/fog/dns/powerdns/requests/create_zone.rb
fog-powerdns-0.2.0 lib/fog/dns/powerdns/requests/create_zone.rb