fog-powerdns 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +24 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/CONTRIBUTORS.md +2 -1
  6. data/Gemfile +2 -0
  7. data/LICENSE.txt +1 -1
  8. data/README.md +1 -1
  9. data/Rakefile +10 -8
  10. data/bin/console +4 -3
  11. data/fog-powerdns.gemspec +20 -18
  12. data/lib/fog/bin/powerdns.rb +14 -10
  13. data/lib/fog/{powerdns/dns.rb → dns/powerdns.rb} +17 -24
  14. data/lib/fog/{powerdns/models/dns → dns/powerdns/models}/record.rb +6 -3
  15. data/lib/fog/{powerdns/models/dns → dns/powerdns/models}/records.rb +4 -4
  16. data/lib/fog/{powerdns/models/dns → dns/powerdns/models}/zone.rb +7 -9
  17. data/lib/fog/{powerdns/models/dns → dns/powerdns/models}/zones.rb +4 -3
  18. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/create_zone.rb +12 -10
  19. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/delete_zone.rb +6 -4
  20. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/get_cryptokey.rb +6 -5
  21. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/get_server.rb +6 -5
  22. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/get_server_config.rb +6 -5
  23. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/get_server_stats.rb +6 -5
  24. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/get_zone.rb +6 -5
  25. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/list_cryptokeys.rb +6 -5
  26. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/list_server_configs.rb +6 -5
  27. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/list_servers.rb +6 -5
  28. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/list_zones.rb +6 -5
  29. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/notify_zone.rb +6 -5
  30. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/retrieve_zone.rb +6 -5
  31. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/search_log.rb +6 -5
  32. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/update_rrsets.rb +12 -9
  33. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/update_server_config.rb +7 -6
  34. data/lib/fog/{powerdns/requests/dns → dns/powerdns/requests}/update_zone.rb +11 -8
  35. data/lib/fog/powerdns.rb +7 -0
  36. data/lib/fog/powerdns/version.rb +3 -1
  37. metadata +62 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 91a444b61f67185b3a81f955f9a958f3bee039b9
4
- data.tar.gz: 16092e8e59509562558551ce7c62d8d2c6467e09
2
+ SHA256:
3
+ metadata.gz: f3542f046a50912aaba8abb321cf535810f592f0c17949f625bf424ae12eff0b
4
+ data.tar.gz: f6bfa3755a71da7f240fd8ef58d6a75eeea9becea46856a8fe7f417635fd9814
5
5
  SHA512:
6
- metadata.gz: e8c6e2f0aa47fed1d244ba1384866666d8f21263bff187e517fe837172d1297ec2ce1768317ce232fa5ad13255f8c6308789fb51f1d4f40d7147cc66c4c64669
7
- data.tar.gz: e2c7deb6a38eb04760b9a66fbe4ea513bb4cb2ed8135ac9ed46f36e211540ee9bc2f6984ac5296f40f89d4b0642756166343e2450f4ad6014e93a53cbb9c6a28
6
+ metadata.gz: 43983bba7e5de84f3fe32dde3cda1648ea7011b6df129987ca4cfb856e0d25706b1dd3c8e837b9efc9f8810a76cc4f0564e0c8f1a3b602f56c78febd7b65ee05
7
+ data.tar.gz: ee1beaa6f9bd9efdf8260a1caa834ff8365e563465b09c92b017f51bccc3b71cb8db54a517c0894fb3d2af384d5088b57e7a9d6ffd58b8b76b3b4159c852b925
@@ -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
@@ -0,0 +1 @@
1
+ fog-powerdns
@@ -0,0 +1 @@
1
+ 2.4
@@ -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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in fog-dns.gemspec
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 TODO: Write your name
3
+ Copyright (c) 2015 Christopher Luo
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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/[my-github-username]/fog-powerdns/fork )
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
- require "bundler/gem_tasks"
1
+ # frozen_string_literal: true
2
2
 
3
- def name
4
- @name ||= Dir['*.gemspec'].first.split('.').first
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 "Open an irb session preloaded with this library"
8
- task :console do
9
- puts "#{name}"
10
- sh "irb -rubygems -r ./lib/fog/powerdns.rb"
11
- end
12
+ desc 'Default Task'
13
+ task default: [:test]
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "fog/powerdns"
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 "irb"
14
+ require 'irb'
14
15
  IRB.start
@@ -1,28 +1,30 @@
1
- # coding: utf-8
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 = "fog-powerdns"
8
- spec.version = Fog::PowerDNS::VERSION
9
- spec.authors = ["Chris Luo"]
10
- spec.email = ["luo_christopher@bah.com"]
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 = %q{Module for the 'fog' gem to support PowerDNS DNS services.}
13
- spec.description = %q{This library can be used as a module for 'fog' or as a standalone provider to use PowerDNS DNS services in applications.}
14
- spec.homepage = "http://github.com/cluobah/fog-powerdns"
15
- spec.license = "MIT"
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 = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
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 "bundler", "~> 1.8"
23
- spec.add_development_dependency "rake", "~> 10.0"
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', '~> 1.27'
26
- spec.add_dependency 'fog-json', '~>1.0'
27
- spec.add_dependency 'fog-xml', '~>0.1'
27
+ spec.add_dependency 'fog-core'
28
+ spec.add_dependency 'fog-json'
29
+ spec.add_dependency 'fog-xml'
28
30
  end
@@ -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
- when :dns
7
- Fog::DNS::PowerDNS
8
- else
9
- raise ArgumentError, "Unsupported #{self} service: #{key}"
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
- when :dns
16
- Fog::Logger.warning("PowerDNS[:dns] is not recommended, use DNS[:powerdns] for portability")
17
- Fog::DNS.new(:provider => :powerdns)
18
- else
19
- raise ArgumentError, "Unrecognized service: #{key.inspect}"
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,4 +1,4 @@
1
- require 'fog/powerdns'
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/dns'
10
- model :zone
11
- collection :zones
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/dns'
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 = options[:host] || "127.0.0.1"
42
- @persistent = options[:persistent]|| false
43
- @port = options[:port] || 8081
44
- @scheme = options[:scheme] || 'http'
45
- puts @api_key
46
- puts @persistent
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].merge!("X-API-key" => "#{@pdns_api_key}")
55
+ params[:headers]['X-API-key'] = @pdns_api_key.to_s
61
56
  params[:headers].merge!(
62
- "Accept" => "application/json",
63
- "Content-Type" => "application/json"
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
@@ -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
- require 'fog/rage4/models/dns/record'
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, :aliases => 'name'
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
- :zone => self,
24
- :service => service
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["zone"]
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/dns/zone'
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
- "name" => name,
42
- "nameservers" => nameservers
43
+ 'name' => name,
44
+ 'nameservers' => nameservers
43
45
  }
44
46
 
45
- options.each { |option, value|
46
- body[option] = value;
47
- }
47
+ options.each do |option, value|
48
+ body[option] = value
49
+ end
48
50
 
49
51
  request(
50
- :body => Fog::JSON.encode(body),
51
- :expects => 201,
52
- :method => 'POST',
53
- :path => "/servers/#{server}/zones"
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
- :expects => 204,
22
- :method => 'DELETE',
23
- :path => "/servers/#{server}/zones/#{zone}"
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
- :expects => 200,
29
- :method => 'GET',
30
- :path => "/servers/#{server}/zones/#{zone}/cryptokeys/#{cryptokey}"
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
- :expects => 200,
25
- :method => 'GET',
26
- :path => "/servers/#{server}"
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
- :expects => 200,
23
- :method => 'GET',
24
- :path => "/servers/#{server}/config/#{config}"
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
- :expects => 200,
22
- :method => 'GET',
23
- :path => "/servers/#{server}/statistics"
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
- :expects => 200,
38
- :method => 'GET',
39
- :path => "/servers/#{server}/zones/#{zone}"
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
- :expects => 200,
28
- :method => 'GET',
29
- :path => "/servers/#{server}/zones/#{zone}/cryptokeys"
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
- :expects => 200,
22
- :method => 'GET',
23
- :path => "/servers/#{server}/config"
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
- :expects => 200,
26
- :method => 'GET',
27
- :path => "/servers"
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
- :expects => 200,
39
- :method => 'GET',
40
- :path => "/servers/#{server}/zones"
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
- :expects => 200,
42
- :method => 'PUT',
43
- :path => "/servers/#{server}/zones/#{zone}/notify"
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
- :expects => 200,
42
- :method => 'PUT',
43
- :path => "/servers/#{server}/zones/#{zone}/axfr-retrieve"
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
- :expects => 200,
20
- :method => 'GET',
21
- :path => "/servers/#{server}/search-log?q=#{term}"
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
- options.each { |option, value|
34
- body[option] = value;
35
- }
34
+ body = {}
35
+
36
+ options.each do |option, value|
37
+ body[option] = value
38
+ end
36
39
 
37
40
  request(
38
- :body => Fog::JSON.encode(body),
39
- :expects => 200,
40
- :method => 'PATCH',
41
- :path => "/servers/#{server}/zones/#{zone}/"
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
- :body => body,
24
- :expects => 200,
25
- :method => 'PUT',
26
- :path => "/servers/#{server}/config/#{config}"
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 { |option, value|
41
- body[option] = value;
42
- }
43
+ options.each do |option, value|
44
+ body[option] = value
45
+ end
43
46
 
44
47
  request(
45
- :body => Fog::JSON.encode(body),
46
- :expects => 200,
47
- :method => 'PUT',
48
- :path => "/servers/#{server}/zones/#{zone}"
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,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')
11
+ end
12
+
6
13
  module PowerDNS
7
14
  extend Fog::Provider
8
15
 
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fog
2
4
  module PowerDNS
3
- VERSION = "0.1.1"
5
+ VERSION = '0.2.0'
4
6
  end
5
7
  end
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.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Luo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-03-16 00:00:00.000000000 Z
11
+ date: 2018-06-22 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: '1.8'
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: '1.8'
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: '10.0'
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: '10.0'
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: '1.27'
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: '1.27'
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: '1.0'
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: '1.0'
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.1'
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.1'
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,29 +115,29 @@ 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:
@@ -142,9 +159,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
159
  version: '0'
143
160
  requirements: []
144
161
  rubyforge_project:
145
- rubygems_version: 2.4.5
162
+ rubygems_version: 2.7.7
146
163
  signing_key:
147
164
  specification_version: 4
148
165
  summary: Module for the 'fog' gem to support PowerDNS DNS services.
149
166
  test_files: []
150
- has_rdoc: