record_store 4.0.7 → 5.0.0
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 +4 -4
- data/Gemfile +3 -0
- data/Gemfile.lock +70 -1
- data/lib/record_store.rb +1 -0
- data/lib/record_store/changeset.rb +0 -1
- data/lib/record_store/cli.rb +2 -2
- data/lib/record_store/provider.rb +4 -2
- data/lib/record_store/provider/dnsimple.rb +9 -11
- data/lib/record_store/provider/dynect.rb +2 -2
- data/lib/record_store/provider/google_cloud_dns.rb +121 -0
- data/lib/record_store/record.rb +13 -0
- data/lib/record_store/record/a.rb +5 -5
- data/lib/record_store/record/aaaa.rb +5 -5
- data/lib/record_store/record/alias.rb +2 -2
- data/lib/record_store/record/cname.rb +2 -2
- data/lib/record_store/record/mx.rb +3 -3
- data/lib/record_store/record/ns.rb +2 -2
- data/lib/record_store/record/spf.rb +5 -1
- data/lib/record_store/record/srv.rb +3 -4
- data/lib/record_store/record/txt.rb +5 -1
- data/lib/record_store/version.rb +1 -1
- data/template/secrets.json +13 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b7441e669b753089b80477c648aeb7eed36e6044
|
|
4
|
+
data.tar.gz: 67c570fbf7975638b488d38926ea570506a8e622
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 648f8eeb88a0cc3a0493e724065758fffda49518a913c35353f0898bd2bff0a6363d2bf8b49e872bcea820a7d06b92ddf42e8eeb56fc08c93b69bbdfd5cb60bc
|
|
7
|
+
data.tar.gz: 8cafafb749bf746dafab7105ac21d8f598c6fcb7bee387f4f58b30aa2a33ab93737dcc371cfe663c42f0f882aae683b82dd4b7f9869010a5521423d5c198feab
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -10,10 +10,18 @@ GEM
|
|
|
10
10
|
minitest (~> 5.1)
|
|
11
11
|
thread_safe (~> 0.3, >= 0.3.4)
|
|
12
12
|
tzinfo (~> 1.1)
|
|
13
|
+
addressable (2.5.2)
|
|
14
|
+
public_suffix (>= 2.0.2, < 4.0)
|
|
13
15
|
builder (3.2.3)
|
|
14
16
|
coderay (1.1.1)
|
|
17
|
+
crack (0.4.3)
|
|
18
|
+
safe_yaml (~> 1.0.0)
|
|
19
|
+
declarative (0.0.10)
|
|
20
|
+
declarative-option (0.1.0)
|
|
15
21
|
ejson (1.0.2)
|
|
16
22
|
excon (0.57.0)
|
|
23
|
+
faraday (0.13.1)
|
|
24
|
+
multipart-post (>= 1.2, < 3)
|
|
17
25
|
fission (0.5.0)
|
|
18
26
|
CFPropertyList (~> 2.2)
|
|
19
27
|
fog (1.33.0)
|
|
@@ -56,6 +64,9 @@ GEM
|
|
|
56
64
|
builder
|
|
57
65
|
excon (~> 0.49)
|
|
58
66
|
formatador (~> 0.2)
|
|
67
|
+
fog-dnsimple (2.0.0)
|
|
68
|
+
fog-core (>= 1.38, < 3)
|
|
69
|
+
fog-json (~> 1.0)
|
|
59
70
|
fog-dynect (0.2.0)
|
|
60
71
|
fog-core
|
|
61
72
|
fog-json
|
|
@@ -112,29 +123,84 @@ GEM
|
|
|
112
123
|
fog-core
|
|
113
124
|
nokogiri (>= 1.5.11, < 2.0.0)
|
|
114
125
|
formatador (0.2.5)
|
|
126
|
+
google-api-client (0.17.4)
|
|
127
|
+
addressable (~> 2.5, >= 2.5.1)
|
|
128
|
+
googleauth (>= 0.5, < 0.7.0)
|
|
129
|
+
httpclient (>= 2.8.1, < 3.0)
|
|
130
|
+
mime-types (~> 3.0)
|
|
131
|
+
representable (~> 3.0)
|
|
132
|
+
retriable (>= 2.0, < 4.0)
|
|
133
|
+
google-cloud-core (1.1.0)
|
|
134
|
+
google-cloud-env (~> 1.0)
|
|
135
|
+
google-cloud-dns (0.27.0)
|
|
136
|
+
google-api-client (~> 0.17.0)
|
|
137
|
+
google-cloud-core (~> 1.1)
|
|
138
|
+
googleauth (~> 0.6.2)
|
|
139
|
+
zonefile (~> 1.04)
|
|
140
|
+
google-cloud-env (1.0.1)
|
|
141
|
+
faraday (~> 0.11)
|
|
142
|
+
googleauth (0.6.2)
|
|
143
|
+
faraday (~> 0.12)
|
|
144
|
+
jwt (>= 1.4, < 3.0)
|
|
145
|
+
logging (~> 2.0)
|
|
146
|
+
memoist (~> 0.12)
|
|
147
|
+
multi_json (~> 1.11)
|
|
148
|
+
os (~> 0.9)
|
|
149
|
+
signet (~> 0.7)
|
|
150
|
+
hashdiff (0.3.7)
|
|
151
|
+
httpclient (2.8.3)
|
|
115
152
|
i18n (0.8.4)
|
|
116
153
|
inflecto (0.0.2)
|
|
117
154
|
ipaddress (0.8.3)
|
|
155
|
+
jwt (2.1.0)
|
|
156
|
+
little-plugger (1.1.4)
|
|
157
|
+
logging (2.2.2)
|
|
158
|
+
little-plugger (~> 1.1)
|
|
159
|
+
multi_json (~> 1.10)
|
|
160
|
+
memoist (0.16.0)
|
|
118
161
|
metaclass (0.0.4)
|
|
119
162
|
method_source (0.8.2)
|
|
163
|
+
mime-types (3.1)
|
|
164
|
+
mime-types-data (~> 3.2015)
|
|
165
|
+
mime-types-data (3.2016.0521)
|
|
120
166
|
mini_portile2 (2.3.0)
|
|
121
167
|
minitest (5.10.2)
|
|
122
168
|
mocha (1.2.1)
|
|
123
169
|
metaclass (~> 0.0.1)
|
|
124
170
|
multi_json (1.12.1)
|
|
171
|
+
multipart-post (2.0.0)
|
|
125
172
|
nokogiri (1.8.1)
|
|
126
173
|
mini_portile2 (~> 2.3.0)
|
|
174
|
+
os (0.9.6)
|
|
127
175
|
pry (0.10.4)
|
|
128
176
|
coderay (~> 1.1.0)
|
|
129
177
|
method_source (~> 0.8.1)
|
|
130
178
|
slop (~> 3.4)
|
|
179
|
+
public_suffix (3.0.1)
|
|
131
180
|
rake (12.0.0)
|
|
181
|
+
representable (3.0.4)
|
|
182
|
+
declarative (< 0.1.0)
|
|
183
|
+
declarative-option (< 0.2.0)
|
|
184
|
+
uber (< 0.2.0)
|
|
185
|
+
retriable (3.1.1)
|
|
186
|
+
safe_yaml (1.0.4)
|
|
187
|
+
signet (0.8.1)
|
|
188
|
+
addressable (~> 2.3)
|
|
189
|
+
faraday (~> 0.9)
|
|
190
|
+
jwt (>= 1.5, < 3.0)
|
|
191
|
+
multi_json (~> 1.10)
|
|
132
192
|
slop (3.6.0)
|
|
133
193
|
thor (0.19.4)
|
|
134
194
|
thread_safe (0.3.6)
|
|
135
195
|
tzinfo (1.2.3)
|
|
136
196
|
thread_safe (~> 0.1)
|
|
137
|
-
|
|
197
|
+
uber (0.1.0)
|
|
198
|
+
vcr (4.0.0)
|
|
199
|
+
webmock (3.2.1)
|
|
200
|
+
addressable (>= 2.3.6)
|
|
201
|
+
crack (>= 0.3.2)
|
|
202
|
+
hashdiff
|
|
203
|
+
zonefile (1.06)
|
|
138
204
|
|
|
139
205
|
PLATFORMS
|
|
140
206
|
ruby
|
|
@@ -144,14 +210,17 @@ DEPENDENCIES
|
|
|
144
210
|
activesupport (~> 4.2)
|
|
145
211
|
ejson
|
|
146
212
|
fog
|
|
213
|
+
fog-dnsimple (~> 2.0.0)
|
|
147
214
|
fog-dynect (~> 0.2.0)
|
|
148
215
|
fog-json
|
|
149
216
|
fog-xml
|
|
217
|
+
google-cloud-dns
|
|
150
218
|
mocha
|
|
151
219
|
pry
|
|
152
220
|
rake
|
|
153
221
|
thor
|
|
154
222
|
vcr
|
|
223
|
+
webmock
|
|
155
224
|
|
|
156
225
|
BUNDLED WITH
|
|
157
226
|
1.16.0
|
data/lib/record_store.rb
CHANGED
data/lib/record_store/cli.rb
CHANGED
|
@@ -120,7 +120,7 @@ module RecordStore
|
|
|
120
120
|
def download
|
|
121
121
|
name = options.fetch('name')
|
|
122
122
|
abort 'Please omit the period at the end of the zone' if name.ends_with?('.')
|
|
123
|
-
abort 'Zone with this name already exists in zones/' if File.
|
|
123
|
+
abort 'Zone with this name already exists in zones/' if File.exist?("#{RecordStore.zones_path}/#{name}.yml")
|
|
124
124
|
|
|
125
125
|
provider = options.fetch('provider', Provider.provider_for(name))
|
|
126
126
|
if provider.nil?
|
|
@@ -239,7 +239,7 @@ module RecordStore
|
|
|
239
239
|
assert_empty_diff
|
|
240
240
|
puts "Deploy will cause no changes, no need to validate initial state"
|
|
241
241
|
rescue SystemExit
|
|
242
|
-
if File.
|
|
242
|
+
if File.exist?(File.expand_path(SKIP_CHECKS, Dir.pwd))
|
|
243
243
|
puts "Found '#{SKIP_CHECKS}', skipping predeploy validations"
|
|
244
244
|
else
|
|
245
245
|
puts "Checkout git SHA #{ENV['LAST_DEPLOYED_SHA']}"
|
|
@@ -8,7 +8,7 @@ module RecordStore
|
|
|
8
8
|
|
|
9
9
|
begin
|
|
10
10
|
ns_server = dns.getresource(zone_name, Resolv::DNS::Resource::IN::SOA).mname.to_s
|
|
11
|
-
rescue Resolv::ResolvError
|
|
11
|
+
rescue Resolv::ResolvError
|
|
12
12
|
abort "Domain doesn't exist"
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -17,6 +17,8 @@ module RecordStore
|
|
|
17
17
|
'DNSimple'
|
|
18
18
|
when /dynect\.net\z/
|
|
19
19
|
'DynECT'
|
|
20
|
+
when /googledomains\.com\z/
|
|
21
|
+
'GoogleCloudDNS'
|
|
20
22
|
else
|
|
21
23
|
nil
|
|
22
24
|
end
|
|
@@ -96,7 +98,7 @@ module RecordStore
|
|
|
96
98
|
end
|
|
97
99
|
|
|
98
100
|
def secrets
|
|
99
|
-
@secrets ||= if File.
|
|
101
|
+
@secrets ||= if File.exist?(RecordStore.secrets_path)
|
|
100
102
|
JSON.parse(File.read(RecordStore.secrets_path))
|
|
101
103
|
else
|
|
102
104
|
raise "You don't have a secrets.json file set up!"
|
|
@@ -15,7 +15,7 @@ module RecordStore
|
|
|
15
15
|
record.type,
|
|
16
16
|
record_hash.fetch(:content),
|
|
17
17
|
ttl: record_hash.fetch(:ttl),
|
|
18
|
-
priority: record_hash.fetch(:
|
|
18
|
+
priority: record_hash.fetch(:priority, nil)
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
if record.type == 'ALIAS'
|
|
@@ -38,16 +38,14 @@ module RecordStore
|
|
|
38
38
|
|
|
39
39
|
# returns an array of Record objects that match the records which exist in the provider
|
|
40
40
|
def retrieve_current_records(zone:, stdout: $stdout)
|
|
41
|
-
session.list_records(zone).body.map do |
|
|
42
|
-
record_body = record.fetch('record')
|
|
43
|
-
|
|
41
|
+
session.list_records(zone).body["data"].map do |record_body|
|
|
44
42
|
begin
|
|
45
43
|
build_from_api(record_body, zone)
|
|
46
44
|
rescue StandardError
|
|
47
45
|
stdout.puts "Cannot build record: #{record_body}"
|
|
48
46
|
raise
|
|
49
47
|
end
|
|
50
|
-
end.
|
|
48
|
+
end.compact
|
|
51
49
|
end
|
|
52
50
|
|
|
53
51
|
# Returns an array of the zones managed by provider as strings
|
|
@@ -64,8 +62,8 @@ module RecordStore
|
|
|
64
62
|
def session_params
|
|
65
63
|
{
|
|
66
64
|
provider: 'DNSimple',
|
|
67
|
-
dnsimple_email: secrets.fetch('email'),
|
|
68
65
|
dnsimple_token: secrets.fetch('api_token'),
|
|
66
|
+
dnsimple_account: secrets.fetch('account_id'),
|
|
69
67
|
}
|
|
70
68
|
end
|
|
71
69
|
|
|
@@ -74,7 +72,7 @@ module RecordStore
|
|
|
74
72
|
end
|
|
75
73
|
|
|
76
74
|
def build_from_api(api_record, zone)
|
|
77
|
-
record_type = api_record.fetch('
|
|
75
|
+
record_type = api_record.fetch('type')
|
|
78
76
|
record = {
|
|
79
77
|
record_id: api_record.fetch('id'),
|
|
80
78
|
ttl: api_record.fetch('ttl'),
|
|
@@ -91,7 +89,7 @@ module RecordStore
|
|
|
91
89
|
when 'CNAME'
|
|
92
90
|
record.merge!(cname: api_record.fetch('content'))
|
|
93
91
|
when 'MX'
|
|
94
|
-
record.merge!(preference: api_record.fetch('
|
|
92
|
+
record.merge!(preference: api_record.fetch('priority'), exchange: api_record.fetch('content'))
|
|
95
93
|
when 'NS'
|
|
96
94
|
record.merge!(nsdname: api_record.fetch('content'))
|
|
97
95
|
when 'SPF', 'TXT'
|
|
@@ -100,7 +98,7 @@ module RecordStore
|
|
|
100
98
|
weight, port, host = api_record.fetch('content').split(' ')
|
|
101
99
|
|
|
102
100
|
record.merge!(
|
|
103
|
-
priority: api_record.fetch('
|
|
101
|
+
priority: api_record.fetch('priority').to_i,
|
|
104
102
|
weight: weight.to_i,
|
|
105
103
|
port: port.to_i,
|
|
106
104
|
target: Record.ensure_ends_with_dot(host),
|
|
@@ -129,7 +127,7 @@ module RecordStore
|
|
|
129
127
|
when 'CNAME'
|
|
130
128
|
record_hash[:content] = record.cname.chomp('.')
|
|
131
129
|
when 'MX'
|
|
132
|
-
record_hash[:
|
|
130
|
+
record_hash[:priority] = record.preference
|
|
133
131
|
record_hash[:content] = record.exchange.chomp('.')
|
|
134
132
|
when 'NS'
|
|
135
133
|
record_hash[:content] = record.nsdname.chomp('.')
|
|
@@ -137,7 +135,7 @@ module RecordStore
|
|
|
137
135
|
record_hash[:content] = record.txtdata.gsub('\;', ';')
|
|
138
136
|
when 'SRV'
|
|
139
137
|
record_hash[:content] = "#{record.weight} #{record.port} #{record.target.chomp('.')}"
|
|
140
|
-
record_hash[:
|
|
138
|
+
record_hash[:priority] = record.priority
|
|
141
139
|
end
|
|
142
140
|
|
|
143
141
|
record_hash
|
|
@@ -48,11 +48,11 @@ module RecordStore
|
|
|
48
48
|
records.map do |record_body|
|
|
49
49
|
begin
|
|
50
50
|
build_from_api(record_body)
|
|
51
|
-
rescue StandardError
|
|
51
|
+
rescue StandardError
|
|
52
52
|
stdout.puts "Cannot build record: #{record_body}"
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
|
-
end.
|
|
55
|
+
end.compact
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
# Returns an array of the zones managed by provider as strings
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
require 'google/cloud/dns'
|
|
2
|
+
|
|
3
|
+
module RecordStore
|
|
4
|
+
class Provider::GoogleCloudDNS < Provider
|
|
5
|
+
class << self
|
|
6
|
+
def apply_changeset(changeset, stdout = $stdout)
|
|
7
|
+
zone = session.zone(convert_to_name(changeset.zone))
|
|
8
|
+
|
|
9
|
+
deletions = convert_records_to_gcloud_record_sets(zone, changeset.current_records)
|
|
10
|
+
additions = convert_records_to_gcloud_record_sets(zone, changeset.desired_records)
|
|
11
|
+
|
|
12
|
+
# The Google API library will handle applying the changeset transactioanlly
|
|
13
|
+
zone.update(additions, deletions)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# returns an array of Record objects that match the records which exist in the provider
|
|
17
|
+
def retrieve_current_records(zone:, stdout: $stdout)
|
|
18
|
+
gcloud_record_sets = session.zone(convert_to_name(zone)).records
|
|
19
|
+
|
|
20
|
+
records = gcloud_record_sets.map do |record_set|
|
|
21
|
+
next if record_set.type == 'SOA'
|
|
22
|
+
|
|
23
|
+
# Unroll each record set into multiple records
|
|
24
|
+
record_set.data.map do |record|
|
|
25
|
+
begin
|
|
26
|
+
record_set_member = record_set.dup
|
|
27
|
+
record_set_member.data = [record]
|
|
28
|
+
build_from_api(record_set_member)
|
|
29
|
+
rescue StandardError
|
|
30
|
+
stdout.puts "Cannot build record: #{record}"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# We need to filter out for nil records (i.e. since skip the SOA record)
|
|
36
|
+
records.flatten.compact
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Returns an array of the zones managed by provider as strings
|
|
40
|
+
def zones
|
|
41
|
+
session.zones.map { |zone| zone.gapi.dns_name }
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def session
|
|
47
|
+
@dns ||= begin
|
|
48
|
+
Google::Cloud::Dns.new({
|
|
49
|
+
project_id: secrets.fetch('project_id'),
|
|
50
|
+
credentials: Google::Cloud::Dns::Credentials.new(secrets),
|
|
51
|
+
})
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def secrets
|
|
56
|
+
super.fetch('google_cloud_dns')
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def convert_to_name(zone)
|
|
60
|
+
zone.gsub('.', '-')
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Google's API operates on resource record sets instead of individual
|
|
64
|
+
# records. A resource record set is a single object that has the rdata
|
|
65
|
+
# for all resource records with the same fully qualified domain name and
|
|
66
|
+
# record type. See https://cloud.google.com/dns/api/v1/resourceRecordSets
|
|
67
|
+
#
|
|
68
|
+
# This methods takes an array of records and builds Google API
|
|
69
|
+
# ResourceRecordSets objects.
|
|
70
|
+
def convert_records_to_gcloud_record_sets(zone, records)
|
|
71
|
+
record_sets = records.group_by do |record|
|
|
72
|
+
[record.type, record.fqdn]
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
record_sets.map do |(rr_type, rr_fqdn), records_for_set|
|
|
77
|
+
zone.record(rr_fqdn, rr_type, records_for_set[0].ttl, records_for_set.map(&:rdata_txt))
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def build_from_api(record)
|
|
82
|
+
record_params = {
|
|
83
|
+
id: record.object_id,
|
|
84
|
+
ttl: record.ttl,
|
|
85
|
+
fqdn: record.name,
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return if record.type == 'SOA'
|
|
89
|
+
|
|
90
|
+
case record.type
|
|
91
|
+
when 'A', 'AAAA'
|
|
92
|
+
record_params.merge!(address: record.data[0])
|
|
93
|
+
when 'CNAME'
|
|
94
|
+
record_params.merge!(cname: record.data[0])
|
|
95
|
+
when 'MX'
|
|
96
|
+
preference, exchange = record.data[0].split(' ')
|
|
97
|
+
record_params.merge!(preference: preference, exchange: exchange)
|
|
98
|
+
when 'NS'
|
|
99
|
+
record_params.merge!(nsdname: record.data[0])
|
|
100
|
+
when 'SPF', 'TXT'
|
|
101
|
+
record_params.merge!(txtdata: record.data[0].gsub(';', '\;'))
|
|
102
|
+
when 'SRV'
|
|
103
|
+
priority, weight, port, target = record.data[0].split(' ')
|
|
104
|
+
|
|
105
|
+
record_params.merge!(
|
|
106
|
+
priority: priority.to_i,
|
|
107
|
+
weight: weight.to_i,
|
|
108
|
+
port: port.to_i,
|
|
109
|
+
target: target,
|
|
110
|
+
)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
unless record_params.fetch(:fqdn).ends_with?('.')
|
|
114
|
+
record_params[:fqdn] += '.'
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
Record.const_get(record.type).new(record_params)
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
data/lib/record_store/record.rb
CHANGED
|
@@ -56,6 +56,19 @@ module RecordStore
|
|
|
56
56
|
"#{type},#{fqdn}"
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
+
def rdata
|
|
60
|
+
raise NotImplementedError
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def rdata_txt
|
|
64
|
+
raise NotImplementedError
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def to_s
|
|
68
|
+
rr_type = self.class.name.demodulize
|
|
69
|
+
"[#{rr_type}Record] #{fqdn} #{ttl} IN #{rr_type} #{rdata_txt}"
|
|
70
|
+
end
|
|
71
|
+
|
|
59
72
|
protected
|
|
60
73
|
|
|
61
74
|
def validate_label_length
|
|
@@ -10,21 +10,21 @@ module RecordStore
|
|
|
10
10
|
@address = record.fetch(:address)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
def to_s
|
|
14
|
-
"[ARecord] #{fqdn} #{ttl} IN A #{address}"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
13
|
def rdata
|
|
18
14
|
{ address: address }
|
|
19
15
|
end
|
|
20
16
|
|
|
17
|
+
def rdata_txt
|
|
18
|
+
address
|
|
19
|
+
end
|
|
20
|
+
|
|
21
21
|
private
|
|
22
22
|
|
|
23
23
|
def valid_address?
|
|
24
24
|
begin
|
|
25
25
|
ip = IPAddr.new(address)
|
|
26
26
|
errors.add(:address, 'is not an IPv4 address') unless ip.ipv4?
|
|
27
|
-
rescue IPAddr::InvalidAddressError
|
|
27
|
+
rescue IPAddr::InvalidAddressError
|
|
28
28
|
errors.add(:address, 'is invalid')
|
|
29
29
|
end
|
|
30
30
|
end
|
|
@@ -10,21 +10,21 @@ module RecordStore
|
|
|
10
10
|
@address = record.fetch(:address)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
def to_s
|
|
14
|
-
"[AAAARecord] #{fqdn} #{ttl} IN AAAA #{address}"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
13
|
def rdata
|
|
18
14
|
{ address: address }
|
|
19
15
|
end
|
|
20
16
|
|
|
17
|
+
def rdata_txt
|
|
18
|
+
address
|
|
19
|
+
end
|
|
20
|
+
|
|
21
21
|
private
|
|
22
22
|
|
|
23
23
|
def valid_address?
|
|
24
24
|
begin
|
|
25
25
|
ip = IPAddr.new(address)
|
|
26
26
|
errors.add(:address, 'is not an IPv6 address') unless ip.ipv6?
|
|
27
|
-
rescue IPAddr::InvalidAddressError
|
|
27
|
+
rescue IPAddr::InvalidAddressError
|
|
28
28
|
errors.add(:address, 'is invalid')
|
|
29
29
|
end
|
|
30
30
|
end
|
|
@@ -8,7 +8,7 @@ module RecordStore
|
|
|
8
8
|
def initialize(record)
|
|
9
9
|
super
|
|
10
10
|
@exchange = Record.ensure_ends_with_dot(record.fetch(:exchange))
|
|
11
|
-
@preference = record.fetch(:preference)
|
|
11
|
+
@preference = Integer(record.fetch(:preference))
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def rdata
|
|
@@ -18,8 +18,8 @@ module RecordStore
|
|
|
18
18
|
}
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def
|
|
22
|
-
"
|
|
21
|
+
def rdata_txt
|
|
22
|
+
"#{preference} #{exchange}"
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
end
|
|
@@ -10,11 +10,15 @@ module RecordStore
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def to_s
|
|
13
|
-
"[SPFRecord] #{fqdn} #{ttl} IN SPF \"#{
|
|
13
|
+
"[SPFRecord] #{fqdn} #{ttl} IN SPF \"#{rdata_txt}\""
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def rdata
|
|
17
17
|
{ txtdata: txtdata }
|
|
18
18
|
end
|
|
19
|
+
|
|
20
|
+
def rdata_txt
|
|
21
|
+
txtdata
|
|
22
|
+
end
|
|
19
23
|
end
|
|
20
24
|
end
|
|
@@ -15,13 +15,12 @@ module RecordStore
|
|
|
15
15
|
@target = record.fetch(:target)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def to_s
|
|
19
|
-
"[SRVRecord] #{fqdn} #{ttl} IN SRV #{priority} #{weight} #{port} #{target}"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
18
|
def rdata
|
|
23
19
|
{ priority: priority, port: port, weight: weight, target: target }
|
|
24
20
|
end
|
|
25
21
|
|
|
22
|
+
def rdata_txt
|
|
23
|
+
"#{priority} #{weight} #{port} #{target}"
|
|
24
|
+
end
|
|
26
25
|
end
|
|
27
26
|
end
|
|
@@ -11,13 +11,17 @@ module RecordStore
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def to_s
|
|
14
|
-
"[TXTRecord] #{fqdn} #{ttl} IN TXT \"#{
|
|
14
|
+
"[TXTRecord] #{fqdn} #{ttl} IN TXT \"#{rdata_txt}\""
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def rdata
|
|
18
18
|
{ txtdata: txtdata }
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
def rdata_txt
|
|
22
|
+
txtdata
|
|
23
|
+
end
|
|
24
|
+
|
|
21
25
|
private
|
|
22
26
|
|
|
23
27
|
def escaped_semicolons
|
data/lib/record_store/version.rb
CHANGED
data/template/secrets.json
CHANGED
|
@@ -5,7 +5,19 @@
|
|
|
5
5
|
"password": "dynect_password"
|
|
6
6
|
},
|
|
7
7
|
"dnsimple": {
|
|
8
|
-
"
|
|
8
|
+
"account_id": "dnsimple_email",
|
|
9
9
|
"api_token": "dnsimple_api_token"
|
|
10
|
+
},
|
|
11
|
+
"google_cloud_dns": {
|
|
12
|
+
"type": "type",
|
|
13
|
+
"project_id": "project_id",
|
|
14
|
+
"private_key_id": "private_key_id",
|
|
15
|
+
"private_key": "-----BEGIN RSA PRIVATE KEY-----\nMIICWgIBAAKBgGsd4RrLAgGKI3cRmywv1FXoAzNG3pgh1X/xjeDu5Fnjr8bvDGog\nctx9iyr5p7NbazgAQxaBWXAgr9p0jjkWzSaTCNskSuk/jJwwn4VQbfXKkyNNaIuc\nk2xn++JJ7Dv4+ODJupP3+A1QUH/uzsGi7xGGNzkC1ojSZlT40OxDrP1VAgMBAAEC\ngYA0xQ2Gg4hDdegu2m+VfyKeB6S7+CfkzpY9Z6S7sTSxy+dmm5GEHuQ3F2oeC8vA\nIkNZ3VcvmR2UjaXUeyMtoLwDpmboRPm3SEtITReSBQGLTeeFymJwIPks0VXckOTh\nrhbyK7StiJ/0jWNtted0vBPEjEAuP6tyURpbVGIBQ1V+aQJBALv6sWWZOKVVThNc\nOGpnBAzTWGQMgp9nD+7rwbAbzRD3hvW5ln6O94a0XPWg9WD++gHDVr9OU7Ooe63O\n/0qw3EcCQQCR4IyjUqYzBZWyD+EKugNtc8VAOrJsYIE+gkajiikjV4nbj8CVg/CO\nunLrkDGAHTgzfY2tTyI6gQt2ctbfFRODAkB8Kl5tBqVVCCDXRu340mzpb9yN0Xmi\ngvgST+WTRvnQQEAEJX9Tv2mer5pLoPMUC7fl3Dp7iOhe3mY7a2RT2LjXAkAVNUg9\nFm8DS/SPhq95F8IXz5UF2YLHLuCbbeVHMXb5pGhue1/MXPpERecfSD9qGNVq5v4K\nDE81oj1AY0HJ/Q5xAkAYOrEnGeJSjLhvJYfMJOAjf39pJs0Kh/2C7HySaILNWt3f\nK590FbFkwBw+bmylpnOxa2jJpzt7F3gGIast6on3\n-----END RSA PRIVATE KEY-----",
|
|
16
|
+
"client_email": "client_email",
|
|
17
|
+
"client_id": "client_id",
|
|
18
|
+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
|
19
|
+
"token_uri": "https://accounts.google.com/o/oauth2/token",
|
|
20
|
+
"auth_provider_x509_cert_url": "auth_provider_x509_cert_url",
|
|
21
|
+
"client_x509_cert_url": "client_x509_cert_url"
|
|
10
22
|
}
|
|
11
23
|
}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: record_store
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 5.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Willem van Bergen
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2018-01-
|
|
12
|
+
date: 2018-01-26 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: thor
|
|
@@ -221,6 +221,7 @@ files:
|
|
|
221
221
|
- lib/record_store/provider.rb
|
|
222
222
|
- lib/record_store/provider/dnsimple.rb
|
|
223
223
|
- lib/record_store/provider/dynect.rb
|
|
224
|
+
- lib/record_store/provider/google_cloud_dns.rb
|
|
224
225
|
- lib/record_store/record.rb
|
|
225
226
|
- lib/record_store/record/a.rb
|
|
226
227
|
- lib/record_store/record/aaaa.rb
|