fog-powerdns 0.1.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +24 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CONTRIBUTORS.md +2 -1
- data/Gemfile +2 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/Rakefile +10 -8
- data/bin/console +4 -3
- data/fog-powerdns.gemspec +20 -18
- data/lib/fog/bin/powerdns.rb +14 -10
- data/lib/fog/{powerdns/models/dns → dns/powerdns/models}/record.rb +6 -3
- data/lib/fog/{powerdns/models/dns → dns/powerdns/models}/records.rb +4 -4
- data/lib/fog/{powerdns/models/dns → dns/powerdns/models}/zone.rb +7 -9
- data/lib/fog/{powerdns/models/dns → dns/powerdns/models}/zones.rb +4 -3
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/create_zone.rb +12 -10
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/delete_zone.rb +6 -4
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/get_cryptokey.rb +6 -5
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/get_server.rb +6 -5
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/get_server_config.rb +6 -5
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/get_server_stats.rb +6 -5
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/get_zone.rb +6 -5
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/list_cryptokeys.rb +6 -5
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/list_server_configs.rb +6 -5
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/list_servers.rb +6 -5
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/list_zones.rb +6 -5
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/notify_zone.rb +6 -5
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/retrieve_zone.rb +6 -5
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/search_log.rb +6 -5
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/update_rrsets.rb +12 -9
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/update_server_config.rb +7 -6
- data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/update_zone.rb +11 -8
- data/lib/fog/{powerdns/dns.rb → dns/powerdns.rb} +17 -24
- data/lib/fog/powerdns/version.rb +3 -1
- data/lib/fog/powerdns.rb +7 -0
- metadata +65 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7a36fc2069981ac0eac56402d55746e222d6557e851ab942f6d551c60015120a
|
4
|
+
data.tar.gz: d5cfa97cd53db18cffeb6e9d4f6b29d278ddf674b15b780f9b393f94c6d424d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 064e854056023ae0d74518dbac56b6d36849139ac6aee024ca6af8bf815e6fa79acabbb337ba4a034fdc05a5257b08277e5d369c3ad56b7d2b2f6f0a0df808da
|
7
|
+
data.tar.gz: 183a8c6832f79ff4e7e104e19da39f6928f202ebf84ac7ccc957592670829cdbcd280162f43d5e80f0ba1f4ace5f166837b116e2503258648203640e355f6d04
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Style/Documentation:
|
2
|
+
Enabled: false
|
3
|
+
|
4
|
+
Metrics/MethodLength:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
Metrics/AbcSize:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Metrics/LineLength:
|
11
|
+
Max: 120
|
12
|
+
|
13
|
+
Metrics/BlockLength:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Layout/ExtraSpacing:
|
17
|
+
AllowForAlignment: false
|
18
|
+
ForceEqualSignAlignment: false
|
19
|
+
|
20
|
+
Style/ExpandPathArguments:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Metrics/CyclomaticComplexity:
|
24
|
+
Enabled: false
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
fog-powerdns
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4
|
data/CONTRIBUTORS.md
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
* Chris Luo <luo_christopher@bah.com>
|
1
|
+
* Chris Luo <luo_christopher@bah.com>
|
2
|
+
* Paulo Ribeiro <plribeiro3000@gmail.com>
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -30,7 +30,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
30
30
|
|
31
31
|
## Contributing
|
32
32
|
|
33
|
-
1. Fork it ( https://github.com/
|
33
|
+
1. Fork it ( https://github.com/fog/fog-powerdns/fork )
|
34
34
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
35
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
36
36
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/Rakefile
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rake/testtask'
|
5
|
+
|
6
|
+
Rake::TestTask.new do |t|
|
7
|
+
t.libs.push %w[spec]
|
8
|
+
t.test_files = FileList['spec/**/*_spec.rb']
|
9
|
+
t.verbose = true
|
5
10
|
end
|
6
11
|
|
7
|
-
desc
|
8
|
-
task :
|
9
|
-
puts "#{name}"
|
10
|
-
sh "irb -rubygems -r ./lib/fog/powerdns.rb"
|
11
|
-
end
|
12
|
+
desc 'Default Task'
|
13
|
+
task default: [:test]
|
data/bin/console
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'fog/powerdns'
|
5
6
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +11,5 @@ require "fog/powerdns"
|
|
10
11
|
# require "pry"
|
11
12
|
# Pry.start
|
12
13
|
|
13
|
-
require
|
14
|
+
require 'irb'
|
14
15
|
IRB.start
|
data/fog-powerdns.gemspec
CHANGED
@@ -1,28 +1,30 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'fog/powerdns/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
8
|
+
spec.name = 'fog-powerdns'
|
9
|
+
spec.version = Fog::PowerDNS::VERSION
|
10
|
+
spec.authors = ['Chris Luo']
|
11
|
+
spec.email = ['luo_christopher@bah.com']
|
11
12
|
|
12
|
-
spec.summary
|
13
|
-
spec.description
|
14
|
-
spec.homepage
|
15
|
-
spec.license
|
13
|
+
spec.summary = "Module for the 'fog' gem to support PowerDNS DNS services."
|
14
|
+
spec.description = "This library can be used as a module for 'fog' or as a standalone provider to use PowerDNS DNS services in applications."
|
15
|
+
spec.homepage = 'http://github.com/cluobah/fog-powerdns'
|
16
|
+
spec.license = 'MIT'
|
16
17
|
|
17
|
-
spec.files
|
18
|
-
spec.bindir
|
19
|
-
spec.executables
|
20
|
-
spec.require_paths = [
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
spec.bindir = 'exe'
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ['lib']
|
21
22
|
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
23
|
+
spec.add_development_dependency 'bundler'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'rubocop'
|
24
26
|
|
25
|
-
spec.add_dependency 'fog-core'
|
26
|
-
spec.add_dependency 'fog-json'
|
27
|
-
spec.add_dependency 'fog-xml'
|
27
|
+
spec.add_dependency 'fog-core'
|
28
|
+
spec.add_dependency 'fog-json'
|
29
|
+
spec.add_dependency 'fog-xml'
|
28
30
|
end
|
data/lib/fog/bin/powerdns.rb
CHANGED
@@ -1,28 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class PowerDNS < Fog::Bin
|
2
4
|
class << self
|
3
5
|
def class_for(key)
|
4
6
|
case key
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
when :dns
|
9
|
+
Fog::DNS::PowerDNS
|
10
|
+
else
|
11
|
+
raise ArgumentError, "Unsupported #{self} service: #{key}"
|
10
12
|
end
|
11
13
|
end
|
14
|
+
|
12
15
|
def [](service)
|
13
16
|
@@connections ||= Hash.new do |hash, key|
|
14
17
|
hash[key] = case key
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
when :dns
|
19
|
+
Fog::Logger.warning('PowerDNS[:dns] is not recommended, use DNS[:powerdns] for portability')
|
20
|
+
Fog::DNS.new(provider: :powerdns)
|
21
|
+
else
|
22
|
+
raise ArgumentError, "Unrecognized service: #{key.inspect}"
|
20
23
|
end
|
21
24
|
end
|
22
25
|
@@connections[service]
|
23
26
|
end
|
27
|
+
|
24
28
|
def services
|
25
29
|
Fog::PowerDNS.services
|
26
30
|
end
|
27
31
|
end
|
28
|
-
end
|
32
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fog/core/model'
|
2
4
|
|
3
5
|
module Fog
|
@@ -13,19 +15,20 @@ module Fog
|
|
13
15
|
attribute :disabled
|
14
16
|
attribute :set_ptr
|
15
17
|
|
16
|
-
def initialize(attributes={})
|
18
|
+
def initialize(attributes = {})
|
17
19
|
super
|
18
20
|
end
|
21
|
+
|
19
22
|
def domain
|
20
23
|
name
|
21
24
|
end
|
25
|
+
|
22
26
|
def destroy
|
23
27
|
# service.delete_record(id)
|
24
28
|
# TODO: maybe hack our own delete? this does nothing for now
|
25
29
|
true
|
26
30
|
end
|
27
|
-
|
28
31
|
end
|
29
32
|
end
|
30
33
|
end
|
31
|
-
end
|
34
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fog/core/collection'
|
2
|
-
|
4
|
+
|
3
5
|
module Fog
|
4
6
|
module DNS
|
5
7
|
class PowerDNS
|
@@ -13,9 +15,7 @@ module Fog
|
|
13
15
|
data = service.get_zone(zone)[:records]
|
14
16
|
load(data)
|
15
17
|
end
|
16
|
-
|
17
|
-
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
21
|
-
end
|
21
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fog/core/model'
|
2
|
-
# require 'fog/powerdns/models/dns/rrsets'
|
3
4
|
|
4
5
|
module Fog
|
5
6
|
module DNS
|
@@ -7,7 +8,7 @@ module Fog
|
|
7
8
|
class Zone < Fog::Model
|
8
9
|
identity :zone_id
|
9
10
|
|
10
|
-
attribute :zone,
|
11
|
+
attribute :zone, aliases: 'name'
|
11
12
|
attribute :server_id
|
12
13
|
|
13
14
|
def destroy
|
@@ -15,26 +16,23 @@ module Fog
|
|
15
16
|
true
|
16
17
|
end
|
17
18
|
|
18
|
-
|
19
19
|
def records
|
20
20
|
# TODO: Should rewrite this
|
21
21
|
@records ||= begin
|
22
22
|
Fog::DNS::PowerDNS::Records.new(
|
23
|
-
:
|
24
|
-
:
|
23
|
+
zone: self,
|
24
|
+
service: service
|
25
25
|
)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
29
|
def save
|
31
30
|
requires :zone
|
32
|
-
data = service.create_zone(zone).body[
|
31
|
+
data = service.create_zone(zone).body['zone']
|
33
32
|
merge_attributes(data)
|
34
33
|
true
|
35
34
|
end
|
36
|
-
|
37
35
|
end
|
38
36
|
end
|
39
37
|
end
|
40
|
-
end
|
38
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fog/core/collection'
|
2
|
-
require 'fog/powerdns/models/
|
4
|
+
require 'fog/dns/powerdns/models/zone'
|
3
5
|
|
4
6
|
module Fog
|
5
7
|
module DNS
|
@@ -22,8 +24,7 @@ module Fog
|
|
22
24
|
rescue Fog::Service::NotFound
|
23
25
|
puts 'help!'
|
24
26
|
end
|
25
|
-
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
29
|
-
end
|
30
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -38,19 +40,19 @@ module Fog
|
|
38
40
|
|
39
41
|
def create_zone(server, name, nameservers, options = {})
|
40
42
|
body = {
|
41
|
-
|
42
|
-
|
43
|
+
'name' => name,
|
44
|
+
'nameservers' => nameservers
|
43
45
|
}
|
44
46
|
|
45
|
-
options.each
|
46
|
-
body[option] = value
|
47
|
-
|
47
|
+
options.each do |option, value|
|
48
|
+
body[option] = value
|
49
|
+
end
|
48
50
|
|
49
51
|
request(
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
52
|
+
body: Fog::JSON.encode(body),
|
53
|
+
expects: 201,
|
54
|
+
method: 'POST',
|
55
|
+
path: "/api/#{@api_version}/servers/#{server}/zones"
|
54
56
|
).body
|
55
57
|
end
|
56
58
|
end
|
@@ -59,4 +61,4 @@ module Fog
|
|
59
61
|
end
|
60
62
|
end
|
61
63
|
end
|
62
|
-
end
|
64
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -18,12 +20,12 @@ module Fog
|
|
18
20
|
|
19
21
|
def delete_zone(server, zone)
|
20
22
|
request(
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
expects: 204,
|
24
|
+
method: 'DELETE',
|
25
|
+
path: "/api/#{@api_version}/servers/#{server}/zones/#{zone}"
|
24
26
|
)
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
29
|
-
end
|
31
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -25,13 +27,12 @@ module Fog
|
|
25
27
|
|
26
28
|
def get_cryptokey(server, zone, cryptokey)
|
27
29
|
request(
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
expects: 200,
|
31
|
+
method: 'GET',
|
32
|
+
path: "/api/#{@api_version}/servers/#{server}/zones/#{zone}/cryptokeys/#{cryptokey}"
|
31
33
|
).body
|
32
34
|
end
|
33
|
-
|
34
35
|
end
|
35
36
|
end
|
36
37
|
end
|
37
|
-
end
|
38
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -21,13 +23,12 @@ module Fog
|
|
21
23
|
|
22
24
|
def get_server(server)
|
23
25
|
request(
|
24
|
-
|
25
|
-
|
26
|
-
|
26
|
+
expects: 200,
|
27
|
+
method: 'GET',
|
28
|
+
path: "/api/#{@api_version}/servers/#{server}"
|
27
29
|
).body
|
28
30
|
end
|
29
|
-
|
30
31
|
end
|
31
32
|
end
|
32
33
|
end
|
33
|
-
end
|
34
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -19,13 +21,12 @@ module Fog
|
|
19
21
|
|
20
22
|
def get_server_config(server, config)
|
21
23
|
request(
|
22
|
-
|
23
|
-
|
24
|
-
|
24
|
+
expects: 200,
|
25
|
+
method: 'GET',
|
26
|
+
path: "/api/#{@api_version}/servers/#{server}/config/#{config}"
|
25
27
|
).body
|
26
28
|
end
|
27
|
-
|
28
29
|
end
|
29
30
|
end
|
30
31
|
end
|
31
|
-
end
|
32
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -18,13 +20,12 @@ module Fog
|
|
18
20
|
|
19
21
|
def get_server_stats(server)
|
20
22
|
request(
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
expects: 200,
|
24
|
+
method: 'GET',
|
25
|
+
path: "/api/#{@api_version}/servers/#{server}/statistics"
|
24
26
|
).body
|
25
27
|
end
|
26
|
-
|
27
28
|
end
|
28
29
|
end
|
29
30
|
end
|
30
|
-
end
|
31
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -34,13 +36,12 @@ module Fog
|
|
34
36
|
|
35
37
|
def get_zone(server, zone)
|
36
38
|
request(
|
37
|
-
|
38
|
-
|
39
|
-
|
39
|
+
expects: 200,
|
40
|
+
method: 'GET',
|
41
|
+
path: "/api/#{@api_version}/servers/#{server}/zones/#{zone}"
|
40
42
|
).body
|
41
43
|
end
|
42
|
-
|
43
44
|
end
|
44
45
|
end
|
45
46
|
end
|
46
|
-
end
|
47
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -24,13 +26,12 @@ module Fog
|
|
24
26
|
|
25
27
|
def list_cryptokeys(server, zone)
|
26
28
|
request(
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
expects: 200,
|
30
|
+
method: 'GET',
|
31
|
+
path: "/api/#{@api_version}/servers/#{server}/zones/#{zone}/cryptokeys"
|
30
32
|
).body
|
31
33
|
end
|
32
|
-
|
33
34
|
end
|
34
35
|
end
|
35
36
|
end
|
36
|
-
end
|
37
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -18,13 +20,12 @@ module Fog
|
|
18
20
|
|
19
21
|
def list_server_configs(server)
|
20
22
|
request(
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
expects: 200,
|
24
|
+
method: 'GET',
|
25
|
+
path: "/api/#{@api_version}/servers/#{server}/config"
|
24
26
|
).body
|
25
27
|
end
|
26
|
-
|
27
28
|
end
|
28
29
|
end
|
29
30
|
end
|
30
|
-
end
|
31
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -22,13 +24,12 @@ module Fog
|
|
22
24
|
|
23
25
|
def list_servers
|
24
26
|
request(
|
25
|
-
|
26
|
-
|
27
|
-
|
27
|
+
expects: 200,
|
28
|
+
method: 'GET',
|
29
|
+
path: "/api/#{@api_version}/servers"
|
28
30
|
).body
|
29
31
|
end
|
30
|
-
|
31
32
|
end
|
32
33
|
end
|
33
34
|
end
|
34
|
-
end
|
35
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -35,13 +37,12 @@ module Fog
|
|
35
37
|
|
36
38
|
def list_zones(server)
|
37
39
|
request(
|
38
|
-
|
39
|
-
|
40
|
-
|
40
|
+
expects: 200,
|
41
|
+
method: 'GET',
|
42
|
+
path: "/api/#{@api_version}/servers/#{server}/zones"
|
41
43
|
).body
|
42
44
|
end
|
43
|
-
|
44
45
|
end
|
45
46
|
end
|
46
47
|
end
|
47
|
-
end
|
48
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -38,13 +40,12 @@ module Fog
|
|
38
40
|
|
39
41
|
def notify_zone(server, zone)
|
40
42
|
request(
|
41
|
-
|
42
|
-
|
43
|
-
|
43
|
+
expects: 200,
|
44
|
+
method: 'PUT',
|
45
|
+
path: "/api/#{@api_version}/servers/#{server}/zones/#{zone}/notify"
|
44
46
|
)
|
45
47
|
end
|
46
|
-
|
47
48
|
end
|
48
49
|
end
|
49
50
|
end
|
50
|
-
end
|
51
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -38,13 +40,12 @@ module Fog
|
|
38
40
|
|
39
41
|
def retrieve_zone(server, zone)
|
40
42
|
request(
|
41
|
-
|
42
|
-
|
43
|
-
|
43
|
+
expects: 200,
|
44
|
+
method: 'PUT',
|
45
|
+
path: "/api/#{@api_version}/servers/#{server}/zones/#{zone}/axfr-retrieve"
|
44
46
|
)
|
45
47
|
end
|
46
|
-
|
47
48
|
end
|
48
49
|
end
|
49
50
|
end
|
50
|
-
end
|
51
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -16,13 +18,12 @@ module Fog
|
|
16
18
|
|
17
19
|
def search_log(server, term)
|
18
20
|
request(
|
19
|
-
|
20
|
-
|
21
|
-
|
21
|
+
expects: 200,
|
22
|
+
method: 'GET',
|
23
|
+
path: "/api/#{@api_version}/servers/#{server}/search-log?q=#{term}"
|
22
24
|
).body
|
23
25
|
end
|
24
|
-
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
28
|
-
end
|
29
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -28,20 +30,21 @@ module Fog
|
|
28
30
|
# * 'content': <~String>,
|
29
31
|
# * 'modfied_at': <~Integer>
|
30
32
|
|
31
|
-
|
32
33
|
def update_rrsets(server, zone, options = {})
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
body = {}
|
35
|
+
|
36
|
+
options.each do |option, value|
|
37
|
+
body[option] = value
|
38
|
+
end
|
36
39
|
|
37
40
|
request(
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
41
|
+
body: Fog::JSON.encode(body),
|
42
|
+
expects: 204,
|
43
|
+
method: 'PATCH',
|
44
|
+
path: "/api/#{@api_version}/servers/#{server}/zones/#{zone}"
|
42
45
|
)
|
43
46
|
end
|
44
47
|
end
|
45
48
|
end
|
46
49
|
end
|
47
|
-
end
|
50
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -20,17 +22,16 @@ module Fog
|
|
20
22
|
def update_server_config(server, config, body)
|
21
23
|
if config == 'allows_from'
|
22
24
|
request(
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
body: body,
|
26
|
+
expects: 200,
|
27
|
+
method: 'PUT',
|
28
|
+
path: "/api/#{@api_version}/servers/#{server}/config/#{config}"
|
27
29
|
).body
|
28
30
|
else
|
29
31
|
puts 'Only allows_from config is allowed.'
|
30
32
|
end
|
31
33
|
end
|
32
|
-
|
33
34
|
end
|
34
35
|
end
|
35
36
|
end
|
36
|
-
end
|
37
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module DNS
|
3
5
|
class PowerDNS
|
@@ -36,19 +38,20 @@ module Fog
|
|
36
38
|
# * status<~Integer> 200 when successful
|
37
39
|
|
38
40
|
def update_zone(server, zone, options = {})
|
41
|
+
body = {}
|
39
42
|
|
40
|
-
options.each
|
41
|
-
body[option] = value
|
42
|
-
|
43
|
+
options.each do |option, value|
|
44
|
+
body[option] = value
|
45
|
+
end
|
43
46
|
|
44
47
|
request(
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
body: Fog::JSON.encode(body),
|
49
|
+
expects: 200,
|
50
|
+
method: 'PUT',
|
51
|
+
path: "/api/#{@api_version}/servers/#{server}/zones/#{zone}"
|
49
52
|
).body
|
50
53
|
end
|
51
54
|
end
|
52
55
|
end
|
53
56
|
end
|
54
|
-
end
|
57
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module DNS
|
@@ -6,12 +6,12 @@ module Fog
|
|
6
6
|
requires :pdns_api_key
|
7
7
|
recognizes :host, :port, :persistent, :scheme, :timeout
|
8
8
|
|
9
|
-
model_path 'fog/powerdns/models
|
10
|
-
model
|
11
|
-
collection
|
9
|
+
model_path 'fog/dns/powerdns/models'
|
10
|
+
model :zone
|
11
|
+
collection :zones
|
12
12
|
# collection :rrsets
|
13
13
|
|
14
|
-
request_path 'fog/powerdns/requests
|
14
|
+
request_path 'fog/dns/powerdns/requests'
|
15
15
|
request :list_servers
|
16
16
|
request :get_server
|
17
17
|
request :list_server_configs
|
@@ -34,20 +34,15 @@ module Fog
|
|
34
34
|
end
|
35
35
|
|
36
36
|
class Real
|
37
|
-
def initialize(options={})
|
38
|
-
|
37
|
+
def initialize(options = {})
|
39
38
|
@pdns_api_key = options[:pdns_api_key]
|
40
39
|
@connection_options = options[:connection_options] || {}
|
41
|
-
@host
|
42
|
-
@persistent = options[:persistent]|| false
|
43
|
-
@port
|
44
|
-
@scheme
|
45
|
-
|
46
|
-
|
47
|
-
puts @connection_options
|
48
|
-
puts @scheme
|
49
|
-
puts @host
|
50
|
-
puts @port
|
40
|
+
@host = options[:host] || '127.0.0.1'
|
41
|
+
@persistent = options[:persistent] || false
|
42
|
+
@port = options[:port] || 8081
|
43
|
+
@scheme = options[:scheme] || 'http'
|
44
|
+
@api_version = options[:api_version] || 'v1'
|
45
|
+
|
51
46
|
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
52
47
|
end
|
53
48
|
|
@@ -57,20 +52,18 @@ module Fog
|
|
57
52
|
|
58
53
|
def request(params)
|
59
54
|
params[:headers] ||= {}
|
60
|
-
params[:headers]
|
55
|
+
params[:headers]['X-API-key'] = @pdns_api_key.to_s
|
61
56
|
params[:headers].merge!(
|
62
|
-
|
63
|
-
|
57
|
+
'Accept' => 'application/json',
|
58
|
+
'Content-Type' => 'application/json'
|
64
59
|
)
|
65
60
|
|
66
61
|
response = @connection.request(params)
|
67
62
|
|
68
|
-
unless response.body.empty?
|
69
|
-
response.body = Fog::JSON.decode(response.body)
|
70
|
-
end
|
63
|
+
response.body = Fog::JSON.decode(response.body) unless response.body.empty?
|
71
64
|
response
|
72
65
|
end
|
73
66
|
end
|
74
67
|
end
|
75
68
|
end
|
76
|
-
end
|
69
|
+
end
|
data/lib/fog/powerdns/version.rb
CHANGED
data/lib/fog/powerdns.rb
CHANGED
@@ -1,8 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fog/powerdns/version'
|
2
4
|
require 'fog/core'
|
3
5
|
require 'fog/xml'
|
6
|
+
require 'fog/json'
|
4
7
|
|
5
8
|
module Fog
|
9
|
+
module DNS
|
10
|
+
autoload :PowerDNS, File.expand_path('../dns/powerdns', __FILE__)
|
11
|
+
end
|
12
|
+
|
6
13
|
module PowerDNS
|
7
14
|
extend Fog::Provider
|
8
15
|
|
metadata
CHANGED
@@ -1,85 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-powerdns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Luo
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: fog-core
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '0'
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: fog-json
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '0'
|
62
76
|
type: :runtime
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - "
|
80
|
+
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: fog-xml
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0
|
89
|
+
version: '0'
|
76
90
|
type: :runtime
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0
|
96
|
+
version: '0'
|
83
97
|
description: This library can be used as a module for 'fog' or as a standalone provider
|
84
98
|
to use PowerDNS DNS services in applications.
|
85
99
|
email:
|
@@ -89,6 +103,9 @@ extensions: []
|
|
89
103
|
extra_rdoc_files: []
|
90
104
|
files:
|
91
105
|
- ".gitignore"
|
106
|
+
- ".rubocop.yml"
|
107
|
+
- ".ruby-gemset"
|
108
|
+
- ".ruby-version"
|
92
109
|
- CONTRIBUTORS.md
|
93
110
|
- Gemfile
|
94
111
|
- LICENSE.txt
|
@@ -98,35 +115,35 @@ files:
|
|
98
115
|
- bin/setup
|
99
116
|
- fog-powerdns.gemspec
|
100
117
|
- lib/fog/bin/powerdns.rb
|
118
|
+
- lib/fog/dns/powerdns.rb
|
119
|
+
- lib/fog/dns/powerdns/models/record.rb
|
120
|
+
- lib/fog/dns/powerdns/models/records.rb
|
121
|
+
- lib/fog/dns/powerdns/models/zone.rb
|
122
|
+
- lib/fog/dns/powerdns/models/zones.rb
|
123
|
+
- lib/fog/dns/powerdns/requests/create_zone.rb
|
124
|
+
- lib/fog/dns/powerdns/requests/delete_zone.rb
|
125
|
+
- lib/fog/dns/powerdns/requests/get_cryptokey.rb
|
126
|
+
- lib/fog/dns/powerdns/requests/get_server.rb
|
127
|
+
- lib/fog/dns/powerdns/requests/get_server_config.rb
|
128
|
+
- lib/fog/dns/powerdns/requests/get_server_stats.rb
|
129
|
+
- lib/fog/dns/powerdns/requests/get_zone.rb
|
130
|
+
- lib/fog/dns/powerdns/requests/list_cryptokeys.rb
|
131
|
+
- lib/fog/dns/powerdns/requests/list_server_configs.rb
|
132
|
+
- lib/fog/dns/powerdns/requests/list_servers.rb
|
133
|
+
- lib/fog/dns/powerdns/requests/list_zones.rb
|
134
|
+
- lib/fog/dns/powerdns/requests/notify_zone.rb
|
135
|
+
- lib/fog/dns/powerdns/requests/retrieve_zone.rb
|
136
|
+
- lib/fog/dns/powerdns/requests/search_log.rb
|
137
|
+
- lib/fog/dns/powerdns/requests/update_rrsets.rb
|
138
|
+
- lib/fog/dns/powerdns/requests/update_server_config.rb
|
139
|
+
- lib/fog/dns/powerdns/requests/update_zone.rb
|
101
140
|
- lib/fog/powerdns.rb
|
102
|
-
- lib/fog/powerdns/dns.rb
|
103
|
-
- lib/fog/powerdns/models/dns/record.rb
|
104
|
-
- lib/fog/powerdns/models/dns/records.rb
|
105
|
-
- lib/fog/powerdns/models/dns/zone.rb
|
106
|
-
- lib/fog/powerdns/models/dns/zones.rb
|
107
|
-
- lib/fog/powerdns/requests/dns/create_zone.rb
|
108
|
-
- lib/fog/powerdns/requests/dns/delete_zone.rb
|
109
|
-
- lib/fog/powerdns/requests/dns/get_cryptokey.rb
|
110
|
-
- lib/fog/powerdns/requests/dns/get_server.rb
|
111
|
-
- lib/fog/powerdns/requests/dns/get_server_config.rb
|
112
|
-
- lib/fog/powerdns/requests/dns/get_server_stats.rb
|
113
|
-
- lib/fog/powerdns/requests/dns/get_zone.rb
|
114
|
-
- lib/fog/powerdns/requests/dns/list_cryptokeys.rb
|
115
|
-
- lib/fog/powerdns/requests/dns/list_server_configs.rb
|
116
|
-
- lib/fog/powerdns/requests/dns/list_servers.rb
|
117
|
-
- lib/fog/powerdns/requests/dns/list_zones.rb
|
118
|
-
- lib/fog/powerdns/requests/dns/notify_zone.rb
|
119
|
-
- lib/fog/powerdns/requests/dns/retrieve_zone.rb
|
120
|
-
- lib/fog/powerdns/requests/dns/search_log.rb
|
121
|
-
- lib/fog/powerdns/requests/dns/update_rrsets.rb
|
122
|
-
- lib/fog/powerdns/requests/dns/update_server_config.rb
|
123
|
-
- lib/fog/powerdns/requests/dns/update_zone.rb
|
124
141
|
- lib/fog/powerdns/version.rb
|
125
142
|
homepage: http://github.com/cluobah/fog-powerdns
|
126
143
|
licenses:
|
127
144
|
- MIT
|
128
145
|
metadata: {}
|
129
|
-
post_install_message:
|
146
|
+
post_install_message:
|
130
147
|
rdoc_options: []
|
131
148
|
require_paths:
|
132
149
|
- lib
|
@@ -141,10 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
158
|
- !ruby/object:Gem::Version
|
142
159
|
version: '0'
|
143
160
|
requirements: []
|
144
|
-
|
145
|
-
|
146
|
-
signing_key:
|
161
|
+
rubygems_version: 3.4.22
|
162
|
+
signing_key:
|
147
163
|
specification_version: 4
|
148
164
|
summary: Module for the 'fog' gem to support PowerDNS DNS services.
|
149
165
|
test_files: []
|
150
|
-
has_rdoc:
|