mystro-common 0.3.0 → 0.3.1.alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/.crackin.yml +12 -0
- data/CHANGELOG.md +31 -13
- data/Gemfile +1 -0
- data/lib/fog/ext/dynect/models/dns/records.rb +0 -57
- data/lib/mystro/cloud/connect/dynect/record.rb +0 -1
- data/lib/mystro/cloud/connect/dynect.rb +1 -1
- data/lib/mystro/common/version.rb +3 -3
- data/mystro-common.gemspec +13 -12
- data/spec/support/record.rb +34 -14
- metadata +24 -46
- data/lib/fog/ext/dynect/dns.rb +0 -140
- data/lib/fog/ext/dynect/models/dns/record.rb +0 -66
- data/lib/fog/ext/dynect/models/dns/zone.rb +0 -60
- data/lib/fog/ext/dynect/models/dns/zones.rb +0 -29
- data/lib/fog/ext/dynect/requests/dns/delete_record.rb +0 -56
- data/lib/fog/ext/dynect/requests/dns/delete_zone.rb +0 -42
- data/lib/fog/ext/dynect/requests/dns/get_all_records.rb +0 -56
- data/lib/fog/ext/dynect/requests/dns/get_node_list.rb +0 -56
- data/lib/fog/ext/dynect/requests/dns/get_record.rb +0 -85
- data/lib/fog/ext/dynect/requests/dns/get_zone.rb +0 -58
- data/lib/fog/ext/dynect/requests/dns/post_record.rb +0 -72
- data/lib/fog/ext/dynect/requests/dns/post_session.rb +0 -44
- data/lib/fog/ext/dynect/requests/dns/post_zone.rb +0 -71
- data/lib/fog/ext/dynect/requests/dns/put_zone.rb +0 -76
- data/lib/fog/ext/dynect.rb +0 -26
@@ -1,71 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module DNS
|
3
|
-
class Dynect
|
4
|
-
class Real
|
5
|
-
|
6
|
-
# Create a zone
|
7
|
-
#
|
8
|
-
# ==== Parameters
|
9
|
-
# * rname<~String> - administrative contact
|
10
|
-
# * ttl<~Integer> - time to live (in seconds) for records in this zone
|
11
|
-
# * zone<~String> - name of zone to host
|
12
|
-
# * options<~Hash>:
|
13
|
-
# * serial_style<~String> - style of serial number, in ['day', 'epoch', 'increment', 'minute']. Defaults to increment
|
14
|
-
|
15
|
-
def post_zone(rname, ttl, zone, options = {})
|
16
|
-
body = Fog::JSON.encode({
|
17
|
-
:rname => rname,
|
18
|
-
:token => auth_token,
|
19
|
-
:ttl => ttl
|
20
|
-
}.merge!(options))
|
21
|
-
|
22
|
-
request(
|
23
|
-
:body => body,
|
24
|
-
:expects => 200,
|
25
|
-
:method => :post,
|
26
|
-
:path => 'Zone/' << zone
|
27
|
-
)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class Mock
|
32
|
-
def post_zone(rname, ttl, zone, options = {})
|
33
|
-
new_zone = self.data[:zones][zone] = {
|
34
|
-
:next_record_id => 0,
|
35
|
-
:records => Hash.new do |records_hash, type|
|
36
|
-
records_hash[type] = []
|
37
|
-
end,
|
38
|
-
:records_to_delete => [],
|
39
|
-
:rname => rname,
|
40
|
-
:serial_style => options[:serial_style] || "increment",
|
41
|
-
:serial => 0,
|
42
|
-
:ttl => ttl,
|
43
|
-
:zone => zone,
|
44
|
-
:zone_type => "Primary"
|
45
|
-
}
|
46
|
-
|
47
|
-
response = Excon::Response.new
|
48
|
-
response.status = 200
|
49
|
-
response.body = {
|
50
|
-
"status" => "success",
|
51
|
-
"data" => {
|
52
|
-
"zone_type" => new_zone[:zone_type],
|
53
|
-
"serial_style" => new_zone[:serial_style],
|
54
|
-
"serial" => new_zone[:serial],
|
55
|
-
"zone" => zone
|
56
|
-
},
|
57
|
-
"job_id" => Fog::Dynect::Mock.job_id,
|
58
|
-
"msgs" => [{
|
59
|
-
"INFO" => "create: New zone #{zone} created. Publish it to put it on our server.",
|
60
|
-
"SOURCE" => "BLL",
|
61
|
-
"ERR_CD" => nil,
|
62
|
-
"LVL" => "INFO"
|
63
|
-
}]
|
64
|
-
}
|
65
|
-
|
66
|
-
response
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module DNS
|
3
|
-
class Dynect
|
4
|
-
class Real
|
5
|
-
|
6
|
-
# Update a zone
|
7
|
-
#
|
8
|
-
# ==== Parameters
|
9
|
-
# * zone<~String> - name or id of zone
|
10
|
-
# * options<~Hash>:
|
11
|
-
# * freeze<~Boolean> - causes zone to become frozen
|
12
|
-
# * publish<~Boolean> - causes all pending changes to be pushed to nameservers
|
13
|
-
# * thaw<~Boolean> - causes zone to cease being frozen
|
14
|
-
|
15
|
-
def put_zone(zone, options = {})
|
16
|
-
request(
|
17
|
-
:body => Fog::JSON.encode(options),
|
18
|
-
:expects => 200,
|
19
|
-
:method => :put,
|
20
|
-
:path => 'Zone/' << zone
|
21
|
-
)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class Mock
|
26
|
-
def put_zone(zone, options = {})
|
27
|
-
raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][zone]
|
28
|
-
|
29
|
-
raise ArgumentError unless options.size == 1
|
30
|
-
|
31
|
-
response = Excon::Response.new
|
32
|
-
response.status = 200
|
33
|
-
|
34
|
-
data = {}
|
35
|
-
|
36
|
-
if options['freeze']
|
37
|
-
zone['frozen'] = true
|
38
|
-
info = "freeze: Your zone is now frozen"
|
39
|
-
elsif options['publish']
|
40
|
-
zone[:changes] = {}
|
41
|
-
zone[:records_to_delete].each do |record|
|
42
|
-
zone[:records][record[:type]].delete_if { |r| r[:fqdn] == record[:fqdn] && r[:record_id] == record[:record_id] }
|
43
|
-
end
|
44
|
-
zone[:records_to_delete] = []
|
45
|
-
data = {
|
46
|
-
"zone_type" => zone[:zone_type],
|
47
|
-
"serial_style" => zone[:serial_style],
|
48
|
-
"serial" => zone[:serial] += 1,
|
49
|
-
"zone" => zone[:zone]
|
50
|
-
}
|
51
|
-
info = "publish: #{zone[:zone]} published"
|
52
|
-
elsif options['thaw']
|
53
|
-
zone[:frozen] = false
|
54
|
-
info = "thaw: Your zone is now thawed, you may edit normally"
|
55
|
-
else
|
56
|
-
raise ArgumentError
|
57
|
-
end
|
58
|
-
|
59
|
-
response.body = {
|
60
|
-
"status" => "success",
|
61
|
-
"data" => data,
|
62
|
-
"job_id" => Fog::Dynect::Mock.job_id,
|
63
|
-
"msgs" => [{
|
64
|
-
"INFO" => info,
|
65
|
-
"SOURCE"=>"BLL",
|
66
|
-
"ERR_CD"=>nil,
|
67
|
-
"LVL"=>"INFO"
|
68
|
-
}]
|
69
|
-
}
|
70
|
-
|
71
|
-
response
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
data/lib/fog/ext/dynect.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'nokogiri'
|
2
|
-
|
3
|
-
require 'fog/core'
|
4
|
-
require 'fog/core/parser'
|
5
|
-
|
6
|
-
module Fog
|
7
|
-
module Dynect
|
8
|
-
extend Fog::Provider
|
9
|
-
|
10
|
-
service(:dns, 'ext/dynect/dns', 'DNS')
|
11
|
-
|
12
|
-
class Mock
|
13
|
-
def self.job_id
|
14
|
-
Fog::Mock.random_numbers(8).to_i
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.token
|
18
|
-
Fog::Mock.random_hex(48)
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.version
|
22
|
-
[Fog::Mock.random_numbers(1), Fog::Mock.random_numbers(1), Fog::Mock.random_numbers(1)].join('.')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|