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,66 +0,0 @@
|
|
1
|
-
require 'fog/core/model'
|
2
|
-
|
3
|
-
module Fog
|
4
|
-
module DNS
|
5
|
-
class Dynect
|
6
|
-
|
7
|
-
class Record < Fog::Model
|
8
|
-
extend Fog::Deprecation
|
9
|
-
|
10
|
-
identity :id
|
11
|
-
attribute :name, :aliases => [:fqdn, 'fqdn']
|
12
|
-
attribute :rdata
|
13
|
-
attribute :serial_style
|
14
|
-
attribute :ttl
|
15
|
-
attribute :type, :aliases => 'record_type'
|
16
|
-
|
17
|
-
def destroy
|
18
|
-
requires :identity, :name, :type, :zone
|
19
|
-
service.delete_record(type, zone.identity, name, identity)
|
20
|
-
true
|
21
|
-
end
|
22
|
-
|
23
|
-
def save
|
24
|
-
requires :name, :type, :rdata, :zone
|
25
|
-
|
26
|
-
options = {
|
27
|
-
:ttl => ttl
|
28
|
-
}
|
29
|
-
options.delete_if {|key, value| value.nil?}
|
30
|
-
|
31
|
-
data = service.post_record(type, zone.identity, name, rdata, options).body['data']
|
32
|
-
# avoid overwriting zone object with zone string
|
33
|
-
data = data.reject {|key, value| key == 'zone'}
|
34
|
-
merge_attributes(data)
|
35
|
-
|
36
|
-
zone.publish
|
37
|
-
records = service.get_record(type, zone.identity, name).body['data']
|
38
|
-
# data in format ['/REST/xRecord/domain/fqdn/identity]
|
39
|
-
records.map! do |record|
|
40
|
-
tokens = record.split('/')
|
41
|
-
{
|
42
|
-
:identity => tokens.last,
|
43
|
-
:type => tokens[2][0...-6] # everything before 'Record'
|
44
|
-
}
|
45
|
-
end
|
46
|
-
record = records.detect {|record| record[:type] == type}
|
47
|
-
merge_attributes(record)
|
48
|
-
|
49
|
-
true
|
50
|
-
end
|
51
|
-
|
52
|
-
def zone
|
53
|
-
@zone
|
54
|
-
end
|
55
|
-
|
56
|
-
private
|
57
|
-
|
58
|
-
def zone=(new_zone)
|
59
|
-
@zone = new_zone
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'fog/core/model'
|
2
|
-
require 'fog/ext/dynect/models/dns/records'
|
3
|
-
|
4
|
-
module Fog
|
5
|
-
module DNS
|
6
|
-
class Dynect
|
7
|
-
|
8
|
-
class Zone < Fog::Model
|
9
|
-
|
10
|
-
identity :domain
|
11
|
-
|
12
|
-
attribute :domain, :aliases => 'zone'
|
13
|
-
attribute :email, :aliases => 'rname'
|
14
|
-
attribute :serial
|
15
|
-
attribute :serial_style
|
16
|
-
attribute :ttl
|
17
|
-
attribute :type, :aliases => 'zone_type'
|
18
|
-
|
19
|
-
def initialize(attributes={})
|
20
|
-
super
|
21
|
-
end
|
22
|
-
|
23
|
-
def destroy
|
24
|
-
requires :domain
|
25
|
-
service.delete_zone(domain)
|
26
|
-
true
|
27
|
-
end
|
28
|
-
|
29
|
-
undef_method :domain=
|
30
|
-
def domain=(new_domain)
|
31
|
-
attributes[:domain] = new_domain.split('/').last
|
32
|
-
end
|
33
|
-
|
34
|
-
def publish
|
35
|
-
requires :identity
|
36
|
-
data = service.put_zone(identity, 'publish' => true)
|
37
|
-
true
|
38
|
-
end
|
39
|
-
|
40
|
-
def records
|
41
|
-
@records ||= Fog::DNS::Dynect::Records.new(:zone => self, :service => service)
|
42
|
-
end
|
43
|
-
|
44
|
-
def nameservers
|
45
|
-
raise 'nameservers Not Implemented'
|
46
|
-
end
|
47
|
-
|
48
|
-
def save
|
49
|
-
self.ttl ||= 3600
|
50
|
-
requires :domain, :email, :ttl
|
51
|
-
data = service.post_zone(email, ttl, domain).body['data']
|
52
|
-
merge_attributes(data)
|
53
|
-
true
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/ext/dynect/models/dns/zone'
|
3
|
-
|
4
|
-
module Fog
|
5
|
-
module DNS
|
6
|
-
class Dynect
|
7
|
-
|
8
|
-
class Zones < Fog::Collection
|
9
|
-
|
10
|
-
model Fog::DNS::Dynect::Zone
|
11
|
-
|
12
|
-
def all
|
13
|
-
data = service.get_zone.body['data'].map do |zone|
|
14
|
-
{ :domain => zone }
|
15
|
-
end
|
16
|
-
load(data)
|
17
|
-
end
|
18
|
-
|
19
|
-
def get(zone_id)
|
20
|
-
new(service.get_zone('zone' => zone_id).body['data'])
|
21
|
-
rescue Excon::Errors::NotFound
|
22
|
-
nil
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module DNS
|
3
|
-
class Dynect
|
4
|
-
class Real
|
5
|
-
|
6
|
-
# Delete a record
|
7
|
-
#
|
8
|
-
# ==== Parameters
|
9
|
-
# * type<~String> - type of record in ['AAAA', 'ANY', 'A', 'CNAME', 'DHCID', 'DNAME', 'DNSKEY', 'DS', 'KEY', 'LOC', 'MX', 'NSA', 'NS', 'PTR', 'PX', 'RP', 'SOA', 'SPF', 'SRV', 'SSHFP', 'TXT']
|
10
|
-
# * zone<~String> - zone of record
|
11
|
-
# * fqdn<~String> - fqdn of record
|
12
|
-
# * record_id<~String> - id of record
|
13
|
-
|
14
|
-
def delete_record(type, zone, fqdn, record_id)
|
15
|
-
request(
|
16
|
-
:expects => 200,
|
17
|
-
:idempotent => true,
|
18
|
-
:method => :delete,
|
19
|
-
:path => ["#{type.to_s.upcase}Record", zone, fqdn, record_id].join('/')
|
20
|
-
)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
class Mock
|
25
|
-
def delete_record(type, zone, fqdn, record_id)
|
26
|
-
raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][zone]
|
27
|
-
|
28
|
-
raise Fog::DNS::Dynect::NotFound unless zone[:records][type].find { |record| record[:fqdn] == fqdn && record[:record_id] == record_id.to_i }
|
29
|
-
|
30
|
-
zone[:records_to_delete] << {
|
31
|
-
:type => type,
|
32
|
-
:fqdn => fqdn,
|
33
|
-
:record_id => record_id.to_i
|
34
|
-
}
|
35
|
-
|
36
|
-
response = Excon::Response.new
|
37
|
-
response.status = 200
|
38
|
-
|
39
|
-
response.body = {
|
40
|
-
"status" => "success",
|
41
|
-
"data" => {},
|
42
|
-
"job_id" => Fog::Dynect::Mock.job_id,
|
43
|
-
"msgs" => [{
|
44
|
-
"INFO" => "delete: Record will be deleted on zone publish",
|
45
|
-
"SOURCE" => "BLL",
|
46
|
-
"ERR_CD" => nil,
|
47
|
-
"LVL" => "INFO"
|
48
|
-
}]
|
49
|
-
}
|
50
|
-
|
51
|
-
response
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module DNS
|
3
|
-
class Dynect
|
4
|
-
class Real
|
5
|
-
|
6
|
-
# Delete a zone
|
7
|
-
#
|
8
|
-
# ==== Parameters
|
9
|
-
# * zone<~String> - zone to host
|
10
|
-
|
11
|
-
def delete_zone(zone)
|
12
|
-
request(
|
13
|
-
:expects => 200,
|
14
|
-
:method => :delete,
|
15
|
-
:path => "Zone/#{zone}"
|
16
|
-
)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class Mock
|
21
|
-
def delete_zone(zone)
|
22
|
-
self.data[:zones].delete(zone)
|
23
|
-
|
24
|
-
response = Excon::Response.new
|
25
|
-
response.status = 200
|
26
|
-
response.body = {
|
27
|
-
"status" => "success",
|
28
|
-
"data" => {},
|
29
|
-
"job_id" => Fog::Dynect::Mock.job_id,
|
30
|
-
"msgs" => [{
|
31
|
-
"ERR_CD" => '',
|
32
|
-
"INFO" => '',
|
33
|
-
"LVL" => '',
|
34
|
-
"SOURCE" => ''
|
35
|
-
}]
|
36
|
-
}
|
37
|
-
response
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module DNS
|
3
|
-
class Dynect
|
4
|
-
class Real
|
5
|
-
|
6
|
-
# Get one or more node lists
|
7
|
-
#
|
8
|
-
# ==== Parameters
|
9
|
-
# * zone<~String> - zone to lookup node lists for
|
10
|
-
# * options<~Hash>
|
11
|
-
# * fqdn<~String> - fully qualified domain name of node to lookup
|
12
|
-
|
13
|
-
def get_all_records(zone, options = {})
|
14
|
-
requested_fqdn = options['fqdn'] || options[:fqdn]
|
15
|
-
request(
|
16
|
-
:expects => 200,
|
17
|
-
:idempotent => true,
|
18
|
-
:method => :get,
|
19
|
-
:path => ['AllRecord', zone, requested_fqdn].compact.join('/')
|
20
|
-
)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
class Mock
|
25
|
-
def get_all_records(zone, options = {})
|
26
|
-
raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][zone]
|
27
|
-
|
28
|
-
response = Excon::Response.new
|
29
|
-
response.status = 200
|
30
|
-
|
31
|
-
data = [zone[:zone]]
|
32
|
-
|
33
|
-
if fqdn = options[:fqdn]
|
34
|
-
data = data | zone[:records].collect { |type, records| records.select { |record| record[:fqdn] == fqdn } }.flatten.compact
|
35
|
-
else
|
36
|
-
data = data | zone[:records].collect { |type, records| records.collect { |record| record[:fqdn] } }.flatten
|
37
|
-
end
|
38
|
-
|
39
|
-
response.body = {
|
40
|
-
"status" => "success",
|
41
|
-
"data" => data,
|
42
|
-
"job_id" => Fog::Dynect::Mock.job_id,
|
43
|
-
"msgs" => [{
|
44
|
-
"INFO" => "get_tree: Here is your zone tree",
|
45
|
-
"SOURCE" => "BLL",
|
46
|
-
"ERR_CD" => nil,
|
47
|
-
"LVL" => "INFO"
|
48
|
-
}]
|
49
|
-
}
|
50
|
-
|
51
|
-
response
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module DNS
|
3
|
-
class Dynect
|
4
|
-
class Real
|
5
|
-
|
6
|
-
# Get one or more node lists
|
7
|
-
#
|
8
|
-
# ==== Parameters
|
9
|
-
# * zone<~String> - zone to lookup node lists for
|
10
|
-
# * options<~Hash>
|
11
|
-
# * fqdn<~String> - fully qualified domain name of node to lookup
|
12
|
-
|
13
|
-
def get_node_list(zone, options = {})
|
14
|
-
requested_fqdn = options['fqdn'] || options[:fqdn]
|
15
|
-
request(
|
16
|
-
:expects => 200,
|
17
|
-
:idempotent => true,
|
18
|
-
:method => :get,
|
19
|
-
:path => ['AllRecord', zone, requested_fqdn].compact.join('/')
|
20
|
-
)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
class Mock
|
25
|
-
def get_node_list(zone, options = {})
|
26
|
-
raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][zone]
|
27
|
-
|
28
|
-
response = Excon::Response.new
|
29
|
-
response.status = 200
|
30
|
-
|
31
|
-
data = [zone[:zone]]
|
32
|
-
|
33
|
-
if fqdn = options[:fqdn]
|
34
|
-
data = data | zone[:records].collect { |type, records| records.select { |record| record[:fqdn] == fqdn } }.flatten.compact
|
35
|
-
else
|
36
|
-
data = data | zone[:records].collect { |type, records| records.collect { |record| record[:fqdn] } }.flatten
|
37
|
-
end
|
38
|
-
|
39
|
-
response.body = {
|
40
|
-
"status" => "success",
|
41
|
-
"data" => data,
|
42
|
-
"job_id" => Fog::Dynect::Mock.job_id,
|
43
|
-
"msgs" => [{
|
44
|
-
"INFO" => "get_tree: Here is your zone tree",
|
45
|
-
"SOURCE" => "BLL",
|
46
|
-
"ERR_CD" => nil,
|
47
|
-
"LVL" => "INFO"
|
48
|
-
}]
|
49
|
-
}
|
50
|
-
|
51
|
-
response
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,85 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module DNS
|
3
|
-
class Dynect
|
4
|
-
class Real
|
5
|
-
|
6
|
-
# List records of a given type
|
7
|
-
#
|
8
|
-
# ==== Parameters
|
9
|
-
# * type<~String> - type of record in ['AAAA', 'ANY', 'A', 'CNAME', 'DHCID', 'DNAME', 'DNSKEY', 'DS', 'KEY', 'LOC', 'MX', 'NSA', 'NS', 'PTR', 'PX', 'RP', 'SOA', 'SPF', 'SRV', 'SSHFP', 'TXT']
|
10
|
-
# * zone<~String> - name of zone to lookup
|
11
|
-
# * fqdn<~String> - name of fqdn to lookup
|
12
|
-
# * options<~Hash>:
|
13
|
-
# * record_id<~String> - id of record
|
14
|
-
|
15
|
-
def get_record(type, zone, fqdn, options = {})
|
16
|
-
path = ["#{type.to_s.upcase}Record", zone, fqdn, options['record_id']].compact.join('/')
|
17
|
-
request(
|
18
|
-
:expects => 200,
|
19
|
-
:idempotent => true,
|
20
|
-
:method => :get,
|
21
|
-
:path => path
|
22
|
-
)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
class Mock
|
27
|
-
def get_record(type, zone, fqdn, options = {})
|
28
|
-
raise ArgumentError unless [
|
29
|
-
'AAAA', 'ANY', 'A', 'CNAME',
|
30
|
-
'DHCID', 'DNAME', 'DNSKEY',
|
31
|
-
'DS', 'KEY', 'LOC', 'MX',
|
32
|
-
'NSA', 'NS', 'PTR', 'PX',
|
33
|
-
'RP', 'SOA', 'SPF', 'SRV',
|
34
|
-
'SSHFP', 'TXT'
|
35
|
-
].include? type
|
36
|
-
raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][zone]
|
37
|
-
|
38
|
-
response = Excon::Response.new
|
39
|
-
response.status = 200
|
40
|
-
|
41
|
-
if record_id = options['record_id']
|
42
|
-
raise Fog::DNS::Dynect::NotFound unless record = zone[:records][type].find { |record| record[:record_id] == record_id.to_i }
|
43
|
-
response.body = {
|
44
|
-
"status" => "success",
|
45
|
-
"data" => {
|
46
|
-
"zone" => record[:zone][:zone],
|
47
|
-
"ttl" => record[:ttl],
|
48
|
-
"fqdn" => record[:fqdn],
|
49
|
-
"record_type" => type,
|
50
|
-
"rdata" => record[:rdata],
|
51
|
-
"record_id" => record[:record_id]
|
52
|
-
},
|
53
|
-
"job_id" => Fog::Dynect::Mock.job_id,
|
54
|
-
"msgs" => [{
|
55
|
-
"INFO" => "get: Found the record",
|
56
|
-
"SOURCE" => "API-B",
|
57
|
-
"ERR_CD" => nil,
|
58
|
-
"LVL" => "INFO"
|
59
|
-
}]
|
60
|
-
}
|
61
|
-
else
|
62
|
-
records = if type == "ANY"
|
63
|
-
zone[:records].values.flatten.select { |record| record[:fqdn] == fqdn }
|
64
|
-
else
|
65
|
-
zone[:records][type].select { |record| record[:fqdn] == fqdn }
|
66
|
-
end
|
67
|
-
response.body = {
|
68
|
-
"status" => "success",
|
69
|
-
"data" => records.collect { |record| "/REST/#{record[:type]}Record/#{record[:zone][:zone]}/#{record[:fqdn]}/#{record[:record_id]}" },
|
70
|
-
"job_id" => Fog::Dynect::Mock.job_id,
|
71
|
-
"msgs" => [{
|
72
|
-
"INFO" => "detail: Found #{records.size} record",
|
73
|
-
"SOURCE" => "BLL",
|
74
|
-
"ERR_CD" => nil,
|
75
|
-
"LVL" => "INFO"
|
76
|
-
}]
|
77
|
-
}
|
78
|
-
end
|
79
|
-
|
80
|
-
response
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module DNS
|
3
|
-
class Dynect
|
4
|
-
class Real
|
5
|
-
|
6
|
-
# Get one or more zones
|
7
|
-
#
|
8
|
-
# ==== Parameters
|
9
|
-
# * options<~Hash>:
|
10
|
-
# * zone<~String> - name of zone to lookup, or omit to return list of zones
|
11
|
-
|
12
|
-
def get_zone(options = {})
|
13
|
-
request(
|
14
|
-
:expects => 200,
|
15
|
-
:idempotent => true,
|
16
|
-
:method => :get,
|
17
|
-
:path => ['Zone', options['zone']].compact.join('/')
|
18
|
-
)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
class Mock
|
23
|
-
def get_zone(options = {})
|
24
|
-
if options['zone']
|
25
|
-
raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][options['zone']]
|
26
|
-
data = {
|
27
|
-
"zone_type" => zone[:zone_type],
|
28
|
-
"serial_style" => zone[:serial_style],
|
29
|
-
"serial" => zone[:serial],
|
30
|
-
"zone" => zone[:zone]
|
31
|
-
}
|
32
|
-
info = "get: Your zone, #{zone[:zone]}"
|
33
|
-
else
|
34
|
-
data = self.data[:zones].collect { |zone, data| "/REST/Zone/#{zone}/" }
|
35
|
-
info = "get: Your #{data.size} zones"
|
36
|
-
end
|
37
|
-
|
38
|
-
response = Excon::Response.new
|
39
|
-
response.status = 200
|
40
|
-
|
41
|
-
response.body = {
|
42
|
-
"status" => "success",
|
43
|
-
"data" => data,
|
44
|
-
"job_id" => Fog::Dynect::Mock.job_id,
|
45
|
-
"msgs" => [{
|
46
|
-
"INFO" => info,
|
47
|
-
"SOURCE" => "BLL",
|
48
|
-
"ERR_CD" => nil,
|
49
|
-
"LVL" => "INFO"
|
50
|
-
}]
|
51
|
-
}
|
52
|
-
|
53
|
-
response
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module DNS
|
3
|
-
class Dynect
|
4
|
-
class Real
|
5
|
-
|
6
|
-
# Create a record
|
7
|
-
#
|
8
|
-
# ==== Parameters
|
9
|
-
# * type<~String> - type of record in ['AAAA', 'ANY', 'A', 'CNAME', 'DHCID', 'DNAME', 'DNSKEY', 'DS', 'KEY', 'LOC', 'MX', 'NSA', 'NS', 'PTR', 'PX', 'RP', 'SOA', 'SPF', 'SRV', 'SSHFP', 'TXT']
|
10
|
-
# * zone<~String> - zone of record
|
11
|
-
# * rdata<~Hash> - rdata for record
|
12
|
-
# * options<~Hash>: (options vary by type, listing below includes common parameters)
|
13
|
-
# * ttl<~Integer> - ttl for the record, defaults to zone ttl
|
14
|
-
|
15
|
-
def post_record(type, zone, fqdn, rdata, options = {})
|
16
|
-
options.merge!('rdata' => rdata)
|
17
|
-
request(
|
18
|
-
:body => Fog::JSON.encode(options),
|
19
|
-
:expects => 200,
|
20
|
-
:method => :post,
|
21
|
-
:path => ["#{type.to_s.upcase}Record", zone, fqdn].join('/')
|
22
|
-
)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
class Mock
|
27
|
-
def post_record(type, zone, fqdn, rdata, options = {})
|
28
|
-
raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][zone]
|
29
|
-
|
30
|
-
records = zone[:records]
|
31
|
-
record_id = zone[:next_record_id]
|
32
|
-
zone[:next_record_id] += 1
|
33
|
-
|
34
|
-
record = {
|
35
|
-
:type => type,
|
36
|
-
:zone => zone,
|
37
|
-
:fqdn => fqdn,
|
38
|
-
:rdata => rdata,
|
39
|
-
:ttl => options[:ttl] || zone[:ttl],
|
40
|
-
:record_id => record_id
|
41
|
-
}
|
42
|
-
|
43
|
-
records[type] << record
|
44
|
-
|
45
|
-
response = Excon::Response.new
|
46
|
-
response.status = 200
|
47
|
-
|
48
|
-
response.body = {
|
49
|
-
"status" => "success",
|
50
|
-
"data" => {
|
51
|
-
"zone" => record[:zone][:zone],
|
52
|
-
"ttl" => record[:ttl],
|
53
|
-
"fqdn" => record[:fqdn],
|
54
|
-
"record_type" => record[:type],
|
55
|
-
"rdata" => record[:rdata],
|
56
|
-
"record_id" => record[:record_id]
|
57
|
-
},
|
58
|
-
"job_id" => Fog::Dynect::Mock.job_id,
|
59
|
-
"msgs" => [{
|
60
|
-
"INFO"=>"add: Record added",
|
61
|
-
"SOURCE"=>"BLL",
|
62
|
-
"ERR_CD"=>nil,
|
63
|
-
"LVL"=>"INFO"
|
64
|
-
}]
|
65
|
-
}
|
66
|
-
|
67
|
-
response
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module DNS
|
3
|
-
class Dynect
|
4
|
-
class Real
|
5
|
-
|
6
|
-
def post_session
|
7
|
-
request(
|
8
|
-
:expects => 200,
|
9
|
-
:idempotent => true,
|
10
|
-
:method => :post,
|
11
|
-
:path => "Session",
|
12
|
-
:body => Fog::JSON.encode({
|
13
|
-
:customer_name => @dynect_customer,
|
14
|
-
:user_name => @dynect_username,
|
15
|
-
:password => @dynect_password
|
16
|
-
})
|
17
|
-
)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
class Mock
|
22
|
-
def post_session
|
23
|
-
response = Excon::Response.new
|
24
|
-
response.status = 200
|
25
|
-
response.body = {
|
26
|
-
"status" => "success",
|
27
|
-
"data" => {
|
28
|
-
"token" => auth_token,
|
29
|
-
"version" => Fog::Dynect::Mock.version
|
30
|
-
},
|
31
|
-
"job_id" => Fog::Dynect::Mock.job_id,
|
32
|
-
"msgs"=>[{
|
33
|
-
"INFO"=>"login: Login successful",
|
34
|
-
"SOURCE"=>"BLL",
|
35
|
-
"ERR_CD"=>nil,
|
36
|
-
"LVL"=>"INFO"
|
37
|
-
}]
|
38
|
-
}
|
39
|
-
response
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|