Skip to content

Commit

Permalink
Clean up REST docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cluobah committed Mar 13, 2015
1 parent 31a49c3 commit 74cdb74
Show file tree
Hide file tree
Showing 13 changed files with 385 additions and 129 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/pkg/
/spec/reports/
/tmp/
/.idea/
407 changes: 296 additions & 111 deletions .idea/workspace.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Chris Luo <[email protected]>
9 changes: 9 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
require "bundler/gem_tasks"

def name
@name ||= Dir['*.gemspec'].first.split('.').first
end

desc "Open an irb session preloaded with this library"
task :console do
puts "#{name}"
sh "irb -rubygems -r ./lib/fog/powerdns.rb"
end
6 changes: 2 additions & 4 deletions lib/fog/powerdns/models/dns/record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Fog
module DNS
class PowerDNS
class Record < Fog::Model
# TODO: Needs work to comply with powerdns api
identity :name

attribute :content
Expand All @@ -20,12 +21,9 @@ def domain
end
def destroy
# service.delete_record(id)
# maybe hack our own delete? this does nothing for now
# TODO: maybe hack our own delete? this does nothing for now
true
end
def zone
@zone
end

end
end
Expand Down
1 change: 0 additions & 1 deletion lib/fog/powerdns/models/dns/zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def records

def save
requires :zone
# TODO: What does this do?
data = service.create_zone(zone).body["zone"]
merge_attributes(data)
true
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/powerdns/requests/dns/delete_zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Real
# * response<~Excon::Response>:
# * body<~Hash>:
# * status<~Integer> - 204 when successful
# TODO: Verify this returns
#

def delete_zone(server, zone)
request(
Expand Down
3 changes: 2 additions & 1 deletion lib/fog/powerdns/requests/dns/list_cryptokeys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ class Real
# Get details of all public cryptokeys
#
# ==== Parameters
# Need server_id, zone_id
# server<~String> - server id
# zone<~String> - zone id
#
# ==== Returns
# * response<~Excon::Response>:
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/powerdns/requests/dns/list_zones.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Real
# Get details of a server's DNS zones
#
# ==== Parameters
# * zone<~String> - server id
# * server<~String> - server id
#
# ==== Returns
# * response<~Excon::Response>:
Expand Down
26 changes: 24 additions & 2 deletions lib/fog/powerdns/requests/dns/notify_zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,30 @@ class Real
# * zone<~String> - zone name
#
# ==== Returns
# TODO: Fill this out
#
# TODO: Untested
# * 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> 200 when successful

def notify_zone(server, zone)
request(
Expand Down
26 changes: 24 additions & 2 deletions lib/fog/powerdns/requests/dns/retrieve_zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,30 @@ class Real
# * zone<~String> - zone name
#
# ==== Returns
# TODO: Fill this out
#
# TODO: Untested
# * 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 retrieve_zone(server, zone)
request(
Expand Down
26 changes: 21 additions & 5 deletions lib/fog/powerdns/requests/dns/update_rrsets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,31 @@ class Real
# Modify existing RRset's of a zone
#
# ==== Parameters
# TODO: Display response JSON keys
# server<~String> - server id
# zone<~String> - zone id
# options<~Hash> - see pdns api for rules
#
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
# * 'zone'<~Hash> The representation of the rrsets.
# * 'rrsets'<~Hash> The representation of the rrsets:
# * 'name': <~String>,
# * 'type': <~String>,
# * 'changetype': <~String>,
# * 'records' <~Hash> domain records:
# * 'content': <~String>,
# * 'name': <~String>,
# * 'ttl': <~Integer>,
# * 'type': <~String>,
# * 'disabled': <~Boolean>,
# * 'set-ptr': <~Boolean>
# * 'comments' <~Hash> comments:
# * 'account': <~String>,
# * 'content': <~String>,
# * 'modfied_at': <~Integer>

def update_rrsets(server, id, options = {})
# TODO: Have kind default to Native

def update_rrsets(server, zone, options = {})
options.each { |option, value|
body[option] = value;
}
Expand All @@ -22,7 +38,7 @@ def update_rrsets(server, id, options = {})
:body => Fog::JSON.encode(body),
:expects => 200,
:method => 'PATCH',
:path => "/servers/#{server}/zones/#{id}/"
:path => "/servers/#{server}/zones/#{zone}/"
)
end
end
Expand Down
4 changes: 3 additions & 1 deletion lib/fog/powerdns/requests/dns/update_zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ class Real
# Modify a single zone in PowerDNS
#
# ==== Parameters
# server, name, options
# server<~String> - server id
# zone<~String> - zone id
# options<~Hash> - pairs enumerated below
#
#
# ==== Returns
Expand Down

0 comments on commit 74cdb74

Please sign in to comment.