pdns_api 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pdns_api/api.rb +43 -27
- data/lib/pdns_api/client.rb +43 -3
- data/lib/pdns_api/config.rb +52 -10
- data/lib/pdns_api/cryptokey.rb +32 -5
- data/lib/pdns_api/http.rb +86 -33
- data/lib/pdns_api/metadata.rb +60 -15
- data/lib/pdns_api/override.rb +35 -6
- data/lib/pdns_api/server.rb +64 -15
- data/lib/pdns_api/version.rb +22 -2
- data/lib/pdns_api/zone.rb +142 -85
- data/lib/pdns_api.rb +23 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc62c8d844cbb2661dc1f19f56e6a12b4f659095
|
4
|
+
data.tar.gz: 28c1046f94f11236f1c4ab43ecce060976351104
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02ea243ba0cba7ea74b905c6b6475682e94227f0a97899a01d9a4167651440512e73d720baad8b5a804886e6f7c7c9cd4b43a9c1ae8f329b0e399526649b852d
|
7
|
+
data.tar.gz: d069a42d616b1b48d65ca6a4f41bd31be5204284308545763b59dbecc982ca0a8c3afb8ba13fce0275e7729440b6c634f1841c328f449428c58987ae538978f2
|
data/lib/pdns_api/api.rb
CHANGED
@@ -1,58 +1,74 @@
|
|
1
|
+
# Copyright 2016 - Silke Hofstra
|
2
|
+
#
|
3
|
+
# Licensed under the EUPL, Version 1.1 or -- as soon they will be approved by
|
4
|
+
# the European Commission -- subsequent versions of the EUPL (the "Licence");
|
5
|
+
# You may not use this work except in compliance with the Licence.
|
6
|
+
# You may obtain a copy of the Licence at:
|
7
|
+
#
|
8
|
+
# https://joinup.ec.europa.eu/software/page/eupl
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the Licence is distributed on an "AS IS" basis,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
13
|
+
# express or implied.
|
14
|
+
# See the Licence for the specific language governing
|
15
|
+
# permissions and limitations under the Licence.
|
16
|
+
#
|
17
|
+
|
1
18
|
require 'pdns_api/http'
|
2
19
|
|
3
|
-
|
20
|
+
##
|
21
|
+
#
|
4
22
|
module PDNS
|
5
|
-
|
23
|
+
##
|
24
|
+
# The superclass for all PDNS objects.
|
6
25
|
class API
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
@class = :client
|
11
|
-
@http = PDNS::HTTP.new(args)
|
12
|
-
@version = @http.version
|
13
|
-
@parent = self
|
14
|
-
@url = @http.uri
|
15
|
-
@info = {}
|
16
|
-
end
|
26
|
+
##
|
27
|
+
# The url of the resource object.
|
28
|
+
attr_reader :url
|
17
29
|
|
18
|
-
##
|
30
|
+
##
|
31
|
+
# The class of the resource object.
|
32
|
+
attr_reader :class
|
19
33
|
|
20
|
-
|
34
|
+
##
|
35
|
+
# Gets the information of this object from the API and use it
|
36
|
+
# to update the object's information.
|
21
37
|
def get
|
22
38
|
@info = @http.get @url
|
23
39
|
end
|
24
40
|
|
25
|
-
|
41
|
+
##
|
42
|
+
# Deletes this object
|
26
43
|
def delete
|
27
44
|
@http.delete @url
|
28
45
|
end
|
29
46
|
|
30
|
-
|
47
|
+
##
|
48
|
+
# Creates this object on the server
|
31
49
|
def create(info = nil)
|
32
50
|
info(info)
|
33
51
|
@http.post("#{@parent.url}/#{@class}", @info)
|
34
52
|
end
|
35
53
|
|
36
|
-
|
54
|
+
##
|
55
|
+
# Gets and sets the object information.
|
56
|
+
# This does not cause an API request.
|
57
|
+
#
|
58
|
+
# If +info+ is set this method updates the current information.
|
59
|
+
#
|
37
60
|
def info(info = nil)
|
38
61
|
return @info if info.nil?
|
39
62
|
|
40
63
|
@info.merge!(info)
|
41
64
|
end
|
42
65
|
|
43
|
-
##
|
44
|
-
|
66
|
+
##
|
67
|
+
# Ensures the object is an array.
|
68
|
+
# If it is not, an array containing the item is returned
|
45
69
|
def ensure_array(item)
|
46
70
|
return item if item.is_a? Array
|
47
71
|
[item]
|
48
72
|
end
|
49
|
-
|
50
|
-
def self.hash_sym_to_string(hash)
|
51
|
-
hash.map { |symbol, value| [symbol.to_s, value] }.to_h
|
52
|
-
end
|
53
|
-
|
54
|
-
def self.hash_string_to_sym(hash)
|
55
|
-
hash.map { |string, value| [string.to_sym, value] }.to_h
|
56
|
-
end
|
57
73
|
end
|
58
74
|
end
|
data/lib/pdns_api/client.rb
CHANGED
@@ -1,14 +1,54 @@
|
|
1
|
+
# Copyright 2016 - Silke Hofstra
|
2
|
+
#
|
3
|
+
# Licensed under the EUPL, Version 1.1 or -- as soon they will be approved by
|
4
|
+
# the European Commission -- subsequent versions of the EUPL (the "Licence");
|
5
|
+
# You may not use this work except in compliance with the Licence.
|
6
|
+
# You may obtain a copy of the Licence at:
|
7
|
+
#
|
8
|
+
# https://joinup.ec.europa.eu/software/page/eupl
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the Licence is distributed on an "AS IS" basis,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
13
|
+
# express or implied.
|
14
|
+
# See the Licence for the specific language governing
|
15
|
+
# permissions and limitations under the Licence.
|
16
|
+
#
|
17
|
+
|
1
18
|
require 'pdns_api/version'
|
2
19
|
require 'pdns_api/api'
|
3
20
|
require 'pdns_api/server'
|
4
21
|
|
5
|
-
|
22
|
+
##
|
23
|
+
#
|
6
24
|
module PDNS
|
7
|
-
|
25
|
+
##
|
26
|
+
# Class for interaction with the top level API.
|
8
27
|
class Client < API
|
28
|
+
##
|
29
|
+
# The PowerDNS API version in use.
|
9
30
|
attr_reader :version
|
10
31
|
|
11
|
-
##
|
32
|
+
##
|
33
|
+
# Creates a client object.
|
34
|
+
# +args+ is used to create an HTTP object,
|
35
|
+
# which is used by all created objects.
|
36
|
+
def initialize(args)
|
37
|
+
@class = :client
|
38
|
+
@http = PDNS::HTTP.new(args)
|
39
|
+
@version = @http.version
|
40
|
+
@parent = self
|
41
|
+
@url = @http.uri
|
42
|
+
@info = {}
|
43
|
+
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# Returns existing or creates a +Server+ object.
|
47
|
+
#
|
48
|
+
# If +id+ is not set the current servers are returned in a hash
|
49
|
+
# containing +Server+ objects.
|
50
|
+
#
|
51
|
+
# If +id+ is set a +Server+ object with the provided ID is returned.
|
12
52
|
def servers(id = nil)
|
13
53
|
return Server.new(@http, self, id) unless id.nil?
|
14
54
|
|
data/lib/pdns_api/config.rb
CHANGED
@@ -1,9 +1,41 @@
|
|
1
|
-
#
|
1
|
+
# Copyright 2016 - Silke Hofstra
|
2
|
+
#
|
3
|
+
# Licensed under the EUPL, Version 1.1 or -- as soon they will be approved by
|
4
|
+
# the European Commission -- subsequent versions of the EUPL (the "Licence");
|
5
|
+
# You may not use this work except in compliance with the Licence.
|
6
|
+
# You may obtain a copy of the Licence at:
|
7
|
+
#
|
8
|
+
# https://joinup.ec.europa.eu/software/page/eupl
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the Licence is distributed on an "AS IS" basis,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
13
|
+
# express or implied.
|
14
|
+
# See the Licence for the specific language governing
|
15
|
+
# permissions and limitations under the Licence.
|
16
|
+
#
|
17
|
+
|
18
|
+
##
|
19
|
+
#
|
2
20
|
module PDNS
|
3
|
-
|
21
|
+
##
|
22
|
+
# Configuration option for a DNS Server.
|
4
23
|
class Config < API
|
5
|
-
|
24
|
+
##
|
25
|
+
# The name of the configuration option.
|
26
|
+
attr_accessor :name
|
27
|
+
|
28
|
+
##
|
29
|
+
# The value of the configuration option.
|
30
|
+
attr_accessor :value
|
6
31
|
|
32
|
+
##
|
33
|
+
# Creates a configuration option object.
|
34
|
+
#
|
35
|
+
# - +http+: An HTTP object for interaction with the PowerDNS server.
|
36
|
+
# - +parent+: This object's parent.
|
37
|
+
# - +name+: Name of the configuration option.
|
38
|
+
# - +value+: Optional value of the configuration option.
|
7
39
|
def initialize(http, parent, name, value = nil)
|
8
40
|
@class = :config
|
9
41
|
@http = http
|
@@ -14,21 +46,31 @@ module PDNS
|
|
14
46
|
value(@value)
|
15
47
|
end
|
16
48
|
|
17
|
-
##
|
18
|
-
#
|
49
|
+
##
|
50
|
+
# Gets or sets the +value+ attribute.
|
51
|
+
#
|
52
|
+
# If +value+ is not set the current +value+ is returned.
|
53
|
+
# If +value+ is set the object's +value+ is updated and +info+ is set and returned
|
19
54
|
def value(value = nil)
|
20
|
-
return @
|
55
|
+
return @value if value.nil?
|
21
56
|
@value = value
|
22
57
|
@info = { type: 'ConfigSetting', name: @name, value: value }
|
23
58
|
end
|
24
59
|
|
25
|
-
|
60
|
+
##
|
61
|
+
# Gets the current information.
|
62
|
+
# This also updates +value+.
|
26
63
|
def get
|
27
|
-
res = @http.get
|
28
|
-
|
64
|
+
res = @http.get @url
|
65
|
+
value(res[:value]) if res.key? :value
|
66
|
+
res
|
29
67
|
end
|
30
68
|
|
31
|
-
|
69
|
+
##
|
70
|
+
# Updates the object on the server.
|
71
|
+
#
|
72
|
+
# If +value+ is set, the current +value+ is used.
|
73
|
+
# If +value+ is not set, +value+ is updated and then used.
|
32
74
|
def change(value = nil)
|
33
75
|
value(value)
|
34
76
|
@http.put(@url, @info)
|
data/lib/pdns_api/cryptokey.rb
CHANGED
@@ -1,7 +1,33 @@
|
|
1
|
-
#
|
1
|
+
# Copyright 2016 - Silke Hofstra
|
2
|
+
#
|
3
|
+
# Licensed under the EUPL, Version 1.1 or -- as soon they will be approved by
|
4
|
+
# the European Commission -- subsequent versions of the EUPL (the "Licence");
|
5
|
+
# You may not use this work except in compliance with the Licence.
|
6
|
+
# You may obtain a copy of the Licence at:
|
7
|
+
#
|
8
|
+
# https://joinup.ec.europa.eu/software/page/eupl
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the Licence is distributed on an "AS IS" basis,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
13
|
+
# express or implied.
|
14
|
+
# See the Licence for the specific language governing
|
15
|
+
# permissions and limitations under the Licence.
|
16
|
+
#
|
17
|
+
|
18
|
+
##
|
19
|
+
#
|
2
20
|
module PDNS
|
3
|
-
|
21
|
+
##
|
22
|
+
# Cryptokey for a zone.
|
4
23
|
class CryptoKey < API
|
24
|
+
##
|
25
|
+
# Creates a cryptokey object.
|
26
|
+
#
|
27
|
+
# - +http+: An HTTP object for interaction with the PowerDNS server.
|
28
|
+
# - +parent+: This object's parent.
|
29
|
+
# - +id+: Identifier of the cryptokey.
|
30
|
+
# - +info+: Optional information about the cryptokey.
|
5
31
|
def initialize(http, parent, id, info = {})
|
6
32
|
@class = :cryptokeys
|
7
33
|
@http = http
|
@@ -11,9 +37,10 @@ module PDNS
|
|
11
37
|
@url = "#{parent.url}/#{@class}/#{id}"
|
12
38
|
end
|
13
39
|
|
14
|
-
##
|
15
|
-
|
16
|
-
#
|
40
|
+
##
|
41
|
+
# Changes cryptokey information
|
42
|
+
#
|
43
|
+
# +rrset+ is used as changeset for the update.
|
17
44
|
def change(rrsets)
|
18
45
|
@http.put(@url, rrsets)
|
19
46
|
end
|
data/lib/pdns_api/http.rb
CHANGED
@@ -1,10 +1,47 @@
|
|
1
|
-
#
|
1
|
+
# Copyright 2016 - Silke Hofstra
|
2
|
+
#
|
3
|
+
# Licensed under the EUPL, Version 1.1 or -- as soon they will be approved by
|
4
|
+
# the European Commission -- subsequent versions of the EUPL (the "Licence");
|
5
|
+
# You may not use this work except in compliance with the Licence.
|
6
|
+
# You may obtain a copy of the Licence at:
|
7
|
+
#
|
8
|
+
# https://joinup.ec.europa.eu/software/page/eupl
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the Licence is distributed on an "AS IS" basis,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
13
|
+
# express or implied.
|
14
|
+
# See the Licence for the specific language governing
|
15
|
+
# permissions and limitations under the Licence.
|
16
|
+
#
|
17
|
+
|
18
|
+
##
|
19
|
+
#
|
2
20
|
module PDNS
|
3
|
-
|
21
|
+
##
|
22
|
+
# Class for connecting to the PowerDNS API.
|
4
23
|
class HTTP
|
24
|
+
##
|
25
|
+
# The headers used for requests.
|
5
26
|
attr_accessor :headers
|
27
|
+
|
28
|
+
##
|
29
|
+
# The PowerDNS API version in use.
|
6
30
|
attr_reader :version
|
7
31
|
|
32
|
+
##
|
33
|
+
# Creates a PDNS connection.
|
34
|
+
#
|
35
|
+
# +args+ is a a hash which should include:
|
36
|
+
# - +:host+: hostname or IP address of the PowerDNS server.
|
37
|
+
# - +:key+: API key for the PowerDNS server.
|
38
|
+
#
|
39
|
+
# It may include:
|
40
|
+
# - +:port+: Port the server listens on. Defaults to +8081+.
|
41
|
+
# - +:version+: Version of the API to use. Defaults to +1+.
|
42
|
+
# The version of the API depends on the version of PowerDNS.
|
43
|
+
#
|
44
|
+
# TODO: retrieve endpoint from +/api+ if version is not provided.
|
8
45
|
def initialize(args)
|
9
46
|
@host = args[:host]
|
10
47
|
@key = args[:key]
|
@@ -13,25 +50,17 @@ module PDNS
|
|
13
50
|
@headers = { 'X-API-Key' => @key }
|
14
51
|
end
|
15
52
|
|
53
|
+
##
|
54
|
+
# Returns the correct URI for a request.
|
55
|
+
# This depends on the API version.
|
16
56
|
def uri(request = '')
|
17
57
|
base = ''
|
18
|
-
base = "/api/v#{@version}" unless @version == 0 || request[0..
|
58
|
+
base = "/api/v#{@version}" unless @version == 0 || request[0..3] == '/api'
|
19
59
|
base + request
|
20
60
|
end
|
21
61
|
|
22
|
-
|
23
|
-
|
24
|
-
# Create the right request
|
25
|
-
case method
|
26
|
-
when 'GET' then Net::HTTP::Get.new(uri, @headers)
|
27
|
-
when 'PATCH' then Net::HTTP::Patch.new(uri, @headers)
|
28
|
-
when 'POST' then Net::HTTP::Post.new(uri, @headers)
|
29
|
-
when 'PUT' then Net::HTTP::Put.new(uri, @headers)
|
30
|
-
when 'DELETE' then Net::HTTP::Delete.new(uri, @headers)
|
31
|
-
else abort('Unknown method: ' + method)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
62
|
+
##
|
63
|
+
# Decodes the response from the server.
|
35
64
|
def response_decode(response)
|
36
65
|
return {} if response.body.nil?
|
37
66
|
|
@@ -43,17 +72,21 @@ module PDNS
|
|
43
72
|
end
|
44
73
|
end
|
45
74
|
|
46
|
-
|
47
|
-
|
75
|
+
##
|
76
|
+
# Does an HTTP request and returns the response.
|
77
|
+
# Parameters are:
|
78
|
+
# - +net+: Net::HTTP method object to use in request.
|
79
|
+
# - +body+: Optional body of the request.
|
80
|
+
# Returns the decoded response.
|
81
|
+
def http(net, body = nil)
|
82
|
+
# Debug output
|
83
|
+
puts 'Body: ' + body.to_json if ENV['DEBUG']
|
84
|
+
|
48
85
|
# Start an HTTP connection
|
49
86
|
begin
|
50
87
|
response = Net::HTTP.start(@host, @port) do |http|
|
51
|
-
# Create uri & request
|
52
|
-
uri = uri(request)
|
53
|
-
req = http_method(method, uri)
|
54
|
-
|
55
88
|
# Do the request
|
56
|
-
http.request(
|
89
|
+
http.request(net, body.to_json)
|
57
90
|
end
|
58
91
|
rescue StandardError, Timeout::Error => e
|
59
92
|
abort("Error: #{e}")
|
@@ -62,29 +95,49 @@ module PDNS
|
|
62
95
|
response_decode(response)
|
63
96
|
end
|
64
97
|
|
65
|
-
|
98
|
+
##
|
99
|
+
# Does an HTTP +DELETE+ request to +uri+.
|
100
|
+
# Returns the decoded response.
|
66
101
|
def delete(uri)
|
67
|
-
|
102
|
+
uri = uri(uri)
|
103
|
+
net = Net::HTTP::Delete.new(uri, @headers)
|
104
|
+
http(net)
|
68
105
|
end
|
69
106
|
|
70
|
-
|
107
|
+
##
|
108
|
+
# Does an HTTP +GET+ request to +uri+.
|
109
|
+
# Returns the decoded response.
|
71
110
|
def get(uri)
|
72
|
-
|
111
|
+
uri = uri(uri)
|
112
|
+
net = Net::HTTP::Get.new(uri, @headers)
|
113
|
+
http(net)
|
73
114
|
end
|
74
115
|
|
75
|
-
|
116
|
+
##
|
117
|
+
# Does an HTTP +PATCH+ request to +uri+.
|
118
|
+
# Returns the decoded response.
|
76
119
|
def patch(uri, body = nil)
|
77
|
-
|
120
|
+
uri = uri(uri)
|
121
|
+
net = Net::HTTP::Patch.new(uri, @headers)
|
122
|
+
http(net, body)
|
78
123
|
end
|
79
124
|
|
80
|
-
|
125
|
+
##
|
126
|
+
# Does an HTTP +POST+ request to +uri+.
|
127
|
+
# Returns the decoded response.
|
81
128
|
def post(uri, body = nil)
|
82
|
-
|
129
|
+
uri = uri(uri)
|
130
|
+
net = Net::HTTP::Post.new(uri, @headers)
|
131
|
+
http(net, body)
|
83
132
|
end
|
84
133
|
|
85
|
-
|
134
|
+
##
|
135
|
+
# Does an HTTP +PUT+ request to +uri+.
|
136
|
+
# Returns the decoded response.
|
86
137
|
def put(uri, body = nil)
|
87
|
-
|
138
|
+
uri = uri(uri)
|
139
|
+
net = Net::HTTP::Put.new(uri, @headers)
|
140
|
+
http(net, body)
|
88
141
|
end
|
89
142
|
end
|
90
143
|
end
|
data/lib/pdns_api/metadata.rb
CHANGED
@@ -1,37 +1,82 @@
|
|
1
|
-
#
|
1
|
+
# Copyright 2016 - Silke Hofstra
|
2
|
+
#
|
3
|
+
# Licensed under the EUPL, Version 1.1 or -- as soon they will be approved by
|
4
|
+
# the European Commission -- subsequent versions of the EUPL (the "Licence");
|
5
|
+
# You may not use this work except in compliance with the Licence.
|
6
|
+
# You may obtain a copy of the Licence at:
|
7
|
+
#
|
8
|
+
# https://joinup.ec.europa.eu/software/page/eupl
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the Licence is distributed on an "AS IS" basis,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
13
|
+
# express or implied.
|
14
|
+
# See the Licence for the specific language governing
|
15
|
+
# permissions and limitations under the Licence.
|
16
|
+
#
|
17
|
+
|
18
|
+
##
|
19
|
+
#
|
2
20
|
module PDNS
|
3
|
-
|
21
|
+
##
|
22
|
+
# Metadata for a zone.
|
4
23
|
class Metadata < API
|
5
|
-
|
24
|
+
##
|
25
|
+
# The kind of metadata.
|
26
|
+
attr_accessor :kind
|
27
|
+
|
28
|
+
##
|
29
|
+
# The value of the metadata.
|
30
|
+
attr_accessor :value
|
31
|
+
|
32
|
+
##
|
33
|
+
# Creates a configuration option object.
|
34
|
+
#
|
35
|
+
# - +http+: An HTTP object for interaction with the PowerDNS server.
|
36
|
+
# - +parent+: This object's parent.
|
37
|
+
# - +kind+: Name of the metadata.
|
38
|
+
# - +value+: Optional value of the metadata.
|
39
|
+
def initialize(http, parent, kind, value = [])
|
6
40
|
@class = :metadata
|
7
41
|
@http = http
|
8
42
|
@parent = parent
|
9
43
|
@kind = kind
|
10
|
-
@
|
11
|
-
@
|
44
|
+
@url = "#{parent.url}/#{@class}/#{kind}"
|
45
|
+
@value = value.get if value.empty?
|
46
|
+
value(@value)
|
12
47
|
end
|
13
48
|
|
14
|
-
##
|
15
|
-
|
16
|
-
#
|
49
|
+
##
|
50
|
+
# Gets or sets the +value+ attribute.
|
51
|
+
#
|
52
|
+
# If +value+ is not set the current +value+ is returned.
|
53
|
+
# If +value+ is set the object's +value+ is updated and +info+ is set and returned.
|
17
54
|
def value(value = nil)
|
18
55
|
return @info[:metadata] if value.nil?
|
19
56
|
|
20
57
|
# Convert to array if value is string
|
21
|
-
value =
|
58
|
+
value = ensure_array(value)
|
22
59
|
|
23
|
-
# Set info
|
24
|
-
@
|
60
|
+
# Set value and info
|
61
|
+
@value = value
|
62
|
+
@info = { type: 'Metadata', kind: @kind, metadata: value }
|
25
63
|
end
|
26
64
|
|
27
|
-
|
65
|
+
##
|
66
|
+
# Gets the current information.
|
67
|
+
# This also updates +value+.
|
28
68
|
def get
|
29
69
|
res = @http.get @url
|
30
|
-
|
70
|
+
value(res[:value]) if res.key? :value
|
71
|
+
res
|
31
72
|
end
|
32
73
|
|
33
|
-
|
34
|
-
|
74
|
+
##
|
75
|
+
# Updates the object on the server.
|
76
|
+
#
|
77
|
+
# If +value+ is set, the current +value+ is used.
|
78
|
+
# If +value+ is not set, +value+ is updated and then used.
|
79
|
+
def change(value = nil)
|
35
80
|
value(value)
|
36
81
|
@http.put(@url, @info)
|
37
82
|
end
|
data/lib/pdns_api/override.rb
CHANGED
@@ -1,9 +1,37 @@
|
|
1
|
-
#
|
1
|
+
# Copyright 2016 - Silke Hofstra
|
2
|
+
#
|
3
|
+
# Licensed under the EUPL, Version 1.1 or -- as soon they will be approved by
|
4
|
+
# the European Commission -- subsequent versions of the EUPL (the "Licence");
|
5
|
+
# You may not use this work except in compliance with the Licence.
|
6
|
+
# You may obtain a copy of the Licence at:
|
7
|
+
#
|
8
|
+
# https://joinup.ec.europa.eu/software/page/eupl
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the Licence is distributed on an "AS IS" basis,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
13
|
+
# express or implied.
|
14
|
+
# See the Licence for the specific language governing
|
15
|
+
# permissions and limitations under the Licence.
|
16
|
+
#
|
17
|
+
|
18
|
+
##
|
19
|
+
#
|
2
20
|
module PDNS
|
3
|
-
|
21
|
+
##
|
22
|
+
# Override for a server.
|
4
23
|
class Override < API
|
5
|
-
|
24
|
+
##
|
25
|
+
# The ID of the override.
|
26
|
+
attr_reader :id
|
6
27
|
|
28
|
+
##
|
29
|
+
# Creates a configuration option object.
|
30
|
+
#
|
31
|
+
# - +http+: An HTTP object for interaction with the PowerDNS server.
|
32
|
+
# - +parent+: This object's parent.
|
33
|
+
# - +id+: ID of the override.
|
34
|
+
# - +info+: Optional information of the override.
|
7
35
|
def initialize(http, parent, id, info = {})
|
8
36
|
@class = :overrides
|
9
37
|
@http = http
|
@@ -13,9 +41,10 @@ module PDNS
|
|
13
41
|
@url = "#{parent.url}/#{@class}/#{id}"
|
14
42
|
end
|
15
43
|
|
16
|
-
##
|
17
|
-
|
18
|
-
#
|
44
|
+
##
|
45
|
+
# Changes override information.
|
46
|
+
#
|
47
|
+
# +rrset+ is used as changeset for the update.
|
19
48
|
def change(rrsets)
|
20
49
|
@http.put(@url, rrsets)
|
21
50
|
end
|
data/lib/pdns_api/server.rb
CHANGED
@@ -1,13 +1,41 @@
|
|
1
|
+
# Copyright 2016 - Silke Hofstra
|
2
|
+
#
|
3
|
+
# Licensed under the EUPL, Version 1.1 or -- as soon they will be approved by
|
4
|
+
# the European Commission -- subsequent versions of the EUPL (the "Licence");
|
5
|
+
# You may not use this work except in compliance with the Licence.
|
6
|
+
# You may obtain a copy of the Licence at:
|
7
|
+
#
|
8
|
+
# https://joinup.ec.europa.eu/software/page/eupl
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the Licence is distributed on an "AS IS" basis,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
13
|
+
# express or implied.
|
14
|
+
# See the Licence for the specific language governing
|
15
|
+
# permissions and limitations under the Licence.
|
16
|
+
#
|
17
|
+
|
1
18
|
require 'pdns_api/config'
|
2
19
|
require 'pdns_api/override'
|
3
20
|
require 'pdns_api/zone'
|
4
21
|
|
5
|
-
|
22
|
+
##
|
23
|
+
#
|
6
24
|
module PDNS
|
7
|
-
|
25
|
+
##
|
26
|
+
# Server object for accessing data for a particular server.
|
8
27
|
class Server < API
|
28
|
+
##
|
29
|
+
# The ID of the server.
|
9
30
|
attr_reader :id
|
10
31
|
|
32
|
+
##
|
33
|
+
# Creates a Server object.
|
34
|
+
#
|
35
|
+
# - +http+: An HTTP object for interaction with the PowerDNS server.
|
36
|
+
# - +parent+: This object's parent.
|
37
|
+
# - +id+: ID of the server.
|
38
|
+
# - +info+: Optional information of the server.
|
11
39
|
def initialize(http, parent, id, info = {})
|
12
40
|
@class = :servers
|
13
41
|
@http = http
|
@@ -17,36 +45,45 @@ module PDNS
|
|
17
45
|
@info = info
|
18
46
|
end
|
19
47
|
|
20
|
-
##
|
21
|
-
#
|
22
|
-
|
23
|
-
## Server actions
|
24
|
-
|
48
|
+
##
|
49
|
+
# Flushes cache for +domain+.
|
25
50
|
def cache(domain)
|
26
51
|
# TODO: #{url}/cache/flush?domain=:domain: PUT
|
27
52
|
end
|
28
53
|
|
54
|
+
##
|
55
|
+
# Searches through the server's log with +search_term+.
|
29
56
|
def search_log(search_term)
|
30
57
|
# TODO: /servers/:server_id/search-log?q=:search_term: GET
|
31
58
|
end
|
32
59
|
|
60
|
+
##
|
61
|
+
# Gets the statistics for the server.
|
33
62
|
def statistics
|
34
63
|
# TODO: /servers/:server_id/statistics: GET
|
35
64
|
end
|
36
65
|
|
66
|
+
##
|
67
|
+
# Manipulates the query tracing log.
|
37
68
|
def trace
|
38
69
|
# TODO: /servers/:server_id/trace: GET, PUT
|
39
70
|
end
|
40
71
|
|
72
|
+
##
|
73
|
+
# Manipulates failure logging.
|
41
74
|
def failures
|
42
75
|
# TODO: /servers/:server_id/failures: GET, PUT
|
43
76
|
end
|
44
77
|
|
45
|
-
##
|
46
|
-
|
47
|
-
#
|
78
|
+
##
|
79
|
+
# Returns existing configuration or creates a +Config+ object.
|
80
|
+
#
|
81
|
+
# If +name+ is not set the current configuration is returned in a hash.
|
82
|
+
#
|
83
|
+
# If +name+ is set a +Config+ object is returned using the provided +name+.
|
84
|
+
# If +value+ is set as well, a complete config object is returned.
|
48
85
|
def config(name = nil, value = nil)
|
49
|
-
return Config.new(@http, self, name, value)
|
86
|
+
return Config.new(@http, self, name, value) unless name.nil? || value.nil?
|
50
87
|
return Config.new(@http, self, name) unless name.nil?
|
51
88
|
|
52
89
|
# Get all current configuration
|
@@ -54,7 +91,13 @@ module PDNS
|
|
54
91
|
config.map { |c| [c[:name], c[:value]] }.to_h
|
55
92
|
end
|
56
93
|
|
57
|
-
|
94
|
+
##
|
95
|
+
# Returns existing or creates an +Override+ object.
|
96
|
+
#
|
97
|
+
# If +id+ is not set the current servers are returned in a hash
|
98
|
+
# containing +Override+ objects.
|
99
|
+
#
|
100
|
+
# If +id+ is set an +Override+ object with the provided ID is returned.
|
58
101
|
def overrides(id = nil)
|
59
102
|
return Override.new(@http, self, id) unless id.nil?
|
60
103
|
|
@@ -62,9 +105,15 @@ module PDNS
|
|
62
105
|
overrides.map { |o| [o[:id], Override.new(@http, self, o[:id], o)] }.to_h
|
63
106
|
end
|
64
107
|
|
65
|
-
|
66
|
-
|
67
|
-
|
108
|
+
##
|
109
|
+
# Returns existing or creates a +Zone+ object.
|
110
|
+
#
|
111
|
+
# If +id+ is not set the current servers are returned in a hash
|
112
|
+
# containing +Zone+ objects.
|
113
|
+
#
|
114
|
+
# If +id+ is set a +Server+ object with the provided ID is returned.
|
115
|
+
def zones(id = nil)
|
116
|
+
return Zone.new(@http, self, id) unless id.nil?
|
68
117
|
|
69
118
|
zones = @http.get("#{@url}/zones")
|
70
119
|
zones.map { |z| [z[:id], Zone.new(@http, self, z[:id], z)] }.to_h
|
data/lib/pdns_api/version.rb
CHANGED
@@ -1,4 +1,24 @@
|
|
1
|
-
#
|
1
|
+
# Copyright 2016 - Silke Hofstra
|
2
|
+
#
|
3
|
+
# Licensed under the EUPL, Version 1.1 or -- as soon they will be approved by
|
4
|
+
# the European Commission -- subsequent versions of the EUPL (the "Licence");
|
5
|
+
# You may not use this work except in compliance with the Licence.
|
6
|
+
# You may obtain a copy of the Licence at:
|
7
|
+
#
|
8
|
+
# https://joinup.ec.europa.eu/software/page/eupl
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the Licence is distributed on an "AS IS" basis,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
13
|
+
# express or implied.
|
14
|
+
# See the Licence for the specific language governing
|
15
|
+
# permissions and limitations under the Licence.
|
16
|
+
#
|
17
|
+
|
18
|
+
##
|
19
|
+
#
|
2
20
|
module PDNS
|
3
|
-
|
21
|
+
##
|
22
|
+
# The version of +pdns_api+.
|
23
|
+
VERSION = '0.1.0'.freeze
|
4
24
|
end
|
data/lib/pdns_api/zone.rb
CHANGED
@@ -1,12 +1,40 @@
|
|
1
|
-
#
|
1
|
+
# Copyright 2016 - Silke Hofstra
|
2
|
+
#
|
3
|
+
# Licensed under the EUPL, Version 1.1 or -- as soon they will be approved by
|
4
|
+
# the European Commission -- subsequent versions of the EUPL (the "Licence");
|
5
|
+
# You may not use this work except in compliance with the Licence.
|
6
|
+
# You may obtain a copy of the Licence at:
|
7
|
+
#
|
8
|
+
# https://joinup.ec.europa.eu/software/page/eupl
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the Licence is distributed on an "AS IS" basis,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
13
|
+
# express or implied.
|
14
|
+
# See the Licence for the specific language governing
|
15
|
+
# permissions and limitations under the Licence.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'pdns_api/metadata'
|
19
|
+
require 'pdns_api/cryptokey'
|
20
|
+
|
21
|
+
##
|
22
|
+
#
|
2
23
|
module PDNS
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
# Zone
|
24
|
+
##
|
25
|
+
# Zone on a server.
|
7
26
|
class Zone < API
|
27
|
+
##
|
28
|
+
# The ID of the zone.
|
8
29
|
attr_reader :id
|
9
30
|
|
31
|
+
##
|
32
|
+
# Creates a Zone object.
|
33
|
+
#
|
34
|
+
# - +http+: An HTTP object for interaction with the PowerDNS server.
|
35
|
+
# - +parent+: This object's parent.
|
36
|
+
# - +id+: ID of the zone.
|
37
|
+
# - +info+: Optional information of the zone.
|
10
38
|
def initialize(http, parent, id, info = {})
|
11
39
|
@class = :zones
|
12
40
|
@http = http
|
@@ -16,47 +44,113 @@ module PDNS
|
|
16
44
|
@url = "#{parent.url}/#{@class}/#{id}"
|
17
45
|
end
|
18
46
|
|
19
|
-
##
|
20
|
-
|
21
|
-
#
|
47
|
+
##
|
48
|
+
# Modifies information (records) of a zone.
|
49
|
+
# Also formats records to match the API requirements.
|
22
50
|
def modify(rrsets)
|
23
|
-
rrsets.map!
|
51
|
+
rrsets.map! do |rrset|
|
52
|
+
rrset = format_records(rrset) if rrset.key?(:records)
|
53
|
+
rrset
|
54
|
+
end
|
24
55
|
|
25
56
|
@http.patch(@url, rrsets: rrsets)
|
26
57
|
end
|
27
58
|
|
59
|
+
##
|
28
60
|
# Modifies basic zone data (metadata).
|
61
|
+
# +rrset+ is used as changeset for the update.
|
29
62
|
def change(rrsets)
|
30
63
|
@http.put(@url, rrsets)
|
31
64
|
end
|
32
65
|
|
33
|
-
##
|
34
|
-
|
35
|
-
#
|
66
|
+
##
|
67
|
+
# Notifies slaves for a zone.
|
68
|
+
# Only works for domains for which the server is a master.
|
69
|
+
# Returns the result of the notification.
|
36
70
|
def notify
|
37
71
|
@http.put "#{@url}/notify"
|
38
72
|
end
|
39
73
|
|
40
|
-
|
74
|
+
##
|
75
|
+
# Retrieves the data for a zone.
|
76
|
+
# Only works for domains for which the server is a slave.
|
77
|
+
# Returns the result of the retrieval.
|
41
78
|
def axfr_retrieve
|
42
79
|
@http.put "#{@url}/axfr-retrieve"
|
43
80
|
end
|
44
81
|
|
45
|
-
|
82
|
+
##
|
83
|
+
# Exports the zone as a bind zone file.
|
84
|
+
# Returns a hash containing the zone in +:result+.
|
46
85
|
def export
|
47
|
-
@http.get "#{@url}/export"
|
86
|
+
data = @http.get "#{@url}/export"
|
87
|
+
data.delete(:error) if data[:error] == 'Non-JSON response'
|
88
|
+
data
|
48
89
|
end
|
49
90
|
|
50
|
-
|
91
|
+
##
|
92
|
+
# Checks the zone for errors.
|
93
|
+
# Returns the result of the check.
|
51
94
|
def check
|
52
95
|
@http.get "#{@url}/check"
|
53
96
|
end
|
54
97
|
|
55
|
-
##
|
98
|
+
##
|
99
|
+
# Adds records to the ones already existing in the zone.
|
100
|
+
#
|
101
|
+
# The existing records are retrieved and merged with the ones given in +rrsets+.
|
102
|
+
def add(*rrsets)
|
103
|
+
# Get current zone data
|
104
|
+
data = get
|
105
|
+
|
106
|
+
# Return any errors
|
107
|
+
return data if data.key?(:error)
|
108
|
+
|
109
|
+
# Add these records to the rrset
|
110
|
+
rrsets.map! do |rrset|
|
111
|
+
# Get current data from rrset
|
112
|
+
current = current_records(rrset, data)
|
113
|
+
|
114
|
+
# Merge data
|
115
|
+
rrset[:records] = current + ensure_array(rrset[:records])
|
116
|
+
rrset[:changetype] = 'REPLACE'
|
117
|
+
rrset
|
118
|
+
end
|
119
|
+
modify(rrsets)
|
120
|
+
end
|
121
|
+
|
122
|
+
##
|
123
|
+
# Updates (replaces) records for a name/type combination in the zone.
|
124
|
+
def update(*rrsets)
|
125
|
+
# Set type and format records
|
126
|
+
rrsets.map! do |rrset|
|
127
|
+
rrset[:changetype] = 'REPLACE'
|
128
|
+
rrset[:records] = ensure_array(rrset[:records])
|
129
|
+
rrset
|
130
|
+
end
|
131
|
+
modify(rrsets)
|
132
|
+
end
|
133
|
+
|
134
|
+
##
|
135
|
+
# Removes all records for a name/type combination from the zone.
|
136
|
+
def remove(*rrsets)
|
137
|
+
# Set type and format records
|
138
|
+
rrsets.map! do |rrset|
|
139
|
+
rrset[:changetype] = 'DELETE'
|
140
|
+
rrset
|
141
|
+
end
|
142
|
+
modify(rrsets)
|
143
|
+
end
|
56
144
|
|
57
|
-
|
145
|
+
##
|
146
|
+
# Returns existing metadata or creates a +Metadata+ object.
|
147
|
+
#
|
148
|
+
# If +kind+ is not set the current metadata is returned in a hash.
|
149
|
+
#
|
150
|
+
# If +kind+ is set a +Metadata+ object is returned using the provided +kind+.
|
151
|
+
# If +value+ is set as well, a complete Metadata object is returned.
|
58
152
|
def metadata(kind = nil, value = nil)
|
59
|
-
return Metadata.new(@http, self, kind, value)
|
153
|
+
return Metadata.new(@http, self, kind, value) unless kind.nil? || value.nil?
|
60
154
|
return Metadata.new(@http, self, kind) unless kind.nil?
|
61
155
|
|
62
156
|
# Get all current metadata
|
@@ -66,10 +160,16 @@ module PDNS
|
|
66
160
|
return metadata if metadata.is_a?(Hash) && metadata.key?(:error)
|
67
161
|
|
68
162
|
# Convert metadata to hash
|
69
|
-
metadata.map
|
163
|
+
metadata.map { |c| [c[:kind], c[:metadata]] }.to_h
|
70
164
|
end
|
71
165
|
|
72
|
-
|
166
|
+
##
|
167
|
+
# Returns existing or creates a +CryptoKey+ object.
|
168
|
+
#
|
169
|
+
# If +id+ is not set the current servers are returned in a hash
|
170
|
+
# containing +CryptoKey+ objects.
|
171
|
+
#
|
172
|
+
# If +id+ is set a +CryptoKey+ object with the provided ID is returned.
|
73
173
|
def cryptokeys(id = nil)
|
74
174
|
return CryptoKey.new(@http, self, id) unless id.nil?
|
75
175
|
|
@@ -77,11 +177,13 @@ module PDNS
|
|
77
177
|
cryptokeys = @http.get("#{@url}/cryptokeys")
|
78
178
|
|
79
179
|
# Convert cryptokeys to hash
|
80
|
-
cryptokeys.map
|
180
|
+
cryptokeys.map { |c| [c[:id], CryptoKey.new(@http, self, c[:id], c)] }.to_h
|
81
181
|
end
|
82
182
|
|
83
|
-
|
183
|
+
private
|
84
184
|
|
185
|
+
##
|
186
|
+
# Formats a single record to match what is required by the API.
|
85
187
|
def format_single_record(record)
|
86
188
|
# Ensure content
|
87
189
|
record = { content: record } if record.is_a? String
|
@@ -95,11 +197,9 @@ module PDNS
|
|
95
197
|
record
|
96
198
|
end
|
97
199
|
|
98
|
-
|
200
|
+
##
|
201
|
+
# Format the records in an RRset te match what is required by the API.
|
99
202
|
def format_records(rrset)
|
100
|
-
# Abort if rrset is something else than an array
|
101
|
-
abort('Error: records needs to be array') unless rrset[:records].is_a? Array
|
102
|
-
|
103
203
|
# Ensure existence of required keys
|
104
204
|
rrset[:records].map! do |record|
|
105
205
|
# Format the record content
|
@@ -117,69 +217,26 @@ module PDNS
|
|
117
217
|
rrset
|
118
218
|
end
|
119
219
|
|
120
|
-
|
121
|
-
#
|
122
|
-
|
123
|
-
|
124
|
-
data
|
220
|
+
##
|
221
|
+
# Returns the records matching the ones in +rrset+ from +data+.
|
222
|
+
# +data+ should be the result from +get+.
|
223
|
+
def current_records(rrset, data)
|
224
|
+
# Get the records from the data, `records` is v0, `rrset` is v1
|
225
|
+
records = data[:records] || data[:rrset]
|
125
226
|
|
126
|
-
#
|
127
|
-
|
128
|
-
|
129
|
-
# Run v0 version
|
130
|
-
return add_v0(rrsets, data) if @http.version == 0
|
227
|
+
# Select records matching type/name
|
228
|
+
current = records.select { |r| r[:name] == rrset[:name] && r[:type] == rrset[:type] }
|
131
229
|
|
132
|
-
#
|
133
|
-
|
134
|
-
|
135
|
-
current = data[:rrsets].select { |r| r[:name] == rrset[:name] && r[:type] == rrset[:type] }
|
136
|
-
|
137
|
-
# Merge data
|
138
|
-
rrset[:records] = current.first[:records] + ensure_array(rrset[:records])
|
139
|
-
rrset[:changetype] = 'REPLACE'
|
140
|
-
rrset
|
230
|
+
# Get only content/disabled for API v0
|
231
|
+
if @http.version == 0
|
232
|
+
current.map! { |record| { content: record[:content], disabled: record[:disabled] } }
|
141
233
|
end
|
142
|
-
modify(rrsets)
|
143
|
-
end
|
144
234
|
|
145
|
-
|
146
|
-
|
147
|
-
def add_v0(rrsets, data)
|
148
|
-
# Add these records to the rrset
|
149
|
-
rrsets.map! do |rrset|
|
150
|
-
current = data[:records].select do |r|
|
151
|
-
r[:name] == rrset[:name] && r[:type] == rrset[:type]
|
152
|
-
end
|
153
|
-
current.map! do |record|
|
154
|
-
{
|
155
|
-
content: record[:content],
|
156
|
-
disabled: record[:disabled]
|
157
|
-
}
|
158
|
-
end
|
159
|
-
rrset[:records] = current + ensure_array(rrset[:records])
|
160
|
-
rrset[:changetype] = 'REPLACE'
|
161
|
-
rrset
|
162
|
-
end
|
163
|
-
modify(rrsets)
|
164
|
-
end
|
165
|
-
|
166
|
-
def update(*rrsets)
|
167
|
-
# Set type and format records
|
168
|
-
rrsets.map! do |rrset|
|
169
|
-
rrset[:changetype] = 'REPLACE'
|
170
|
-
rrset[:records] = ensure_array(rrset[:records])
|
171
|
-
rrset
|
172
|
-
end
|
173
|
-
modify(rrsets)
|
174
|
-
end
|
235
|
+
# For API v1 there is only one element containing all records
|
236
|
+
current = current.first[:records] unless @http.version == 0
|
175
237
|
|
176
|
-
|
177
|
-
|
178
|
-
rrsets.map! do |rrset|
|
179
|
-
rrset[:changetype] = 'DELETE'
|
180
|
-
rrset
|
181
|
-
end
|
182
|
-
modify(rrsets)
|
238
|
+
# Return the records
|
239
|
+
current
|
183
240
|
end
|
184
241
|
end
|
185
242
|
end
|
data/lib/pdns_api.rb
CHANGED
@@ -1,11 +1,33 @@
|
|
1
|
+
# Copyright 2016 - Silke Hofstra
|
2
|
+
#
|
3
|
+
# Licensed under the EUPL, Version 1.1 or -- as soon they will be approved by
|
4
|
+
# the European Commission -- subsequent versions of the EUPL (the "Licence");
|
5
|
+
# You may not use this work except in compliance with the Licence.
|
6
|
+
# You may obtain a copy of the Licence at:
|
7
|
+
#
|
8
|
+
# https://joinup.ec.europa.eu/software/page/eupl
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the Licence is distributed on an "AS IS" basis,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
13
|
+
# express or implied.
|
14
|
+
# See the Licence for the specific language governing
|
15
|
+
# permissions and limitations under the Licence.
|
16
|
+
#
|
17
|
+
|
1
18
|
require 'json'
|
2
19
|
require 'net/http'
|
3
20
|
|
4
|
-
|
21
|
+
##
|
22
|
+
# Module for interaction with the PowerDNS HTTP API.
|
5
23
|
module PDNS
|
6
24
|
require_relative 'pdns_api/client'
|
7
25
|
|
26
|
+
##
|
27
|
+
# Class for creation of PDNS objects.
|
8
28
|
class << self
|
29
|
+
##
|
30
|
+
# Create a PDNS::Client object.
|
9
31
|
def new(args)
|
10
32
|
Client.new(args)
|
11
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdns_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Silke Hofstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A gem for manipulation of DNS through the PowerDNS API
|
14
14
|
email: silke@slxh.eu
|
@@ -29,7 +29,7 @@ files:
|
|
29
29
|
- lib/pdns_api/zone.rb
|
30
30
|
homepage: https://github.com/silkeh/ruby-pdns_api
|
31
31
|
licenses:
|
32
|
-
-
|
32
|
+
- EUPL
|
33
33
|
metadata: {}
|
34
34
|
post_install_message:
|
35
35
|
rdoc_options: []
|