google-cloud-dns 0.34.0 → 0.35.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/CONTRIBUTING.md +1 -1
- data/lib/google/cloud/dns/change.rb +1 -1
- data/lib/google/cloud/dns/change/list.rb +4 -4
- data/lib/google/cloud/dns/credentials.rb +12 -14
- data/lib/google/cloud/dns/importer.rb +3 -3
- data/lib/google/cloud/dns/project.rb +6 -6
- data/lib/google/cloud/dns/record/list.rb +4 -4
- data/lib/google/cloud/dns/version.rb +1 -1
- data/lib/google/cloud/dns/zone.rb +8 -8
- data/lib/google/cloud/dns/zone/list.rb +4 -4
- data/lib/google/cloud/dns/zone/transaction.rb +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 697c4c37fec5ebcde48f127d92630d4ffe3921d2ac3e319ce2f0642778c4d5af
|
4
|
+
data.tar.gz: 41782ce61019a4a5ae4888db7a547609c6018cb69ce6d6a209aef82e47830646
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d990f8b29bc5d7ac84a9f1b9e96aa48ab24af1c70b73ec15fdb395027abe41b5fa8b5f56d7ad5ce47e4e2735088d8c193e3d2c43c837126a0e581454464a4fb9
|
7
|
+
data.tar.gz: 3556c5a65e31579aafe4d909013c77b3e616f3cb64ae5f7e1a62f5c60781f9bc83dffd48f748fbcd088f0ec17481bd706ecc044adb2f5afbebe3cfc6a60a6d78
|
data/CHANGELOG.md
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -24,7 +24,7 @@ be able to accept your pull requests.
|
|
24
24
|
In order to use the google-cloud-dns console and run the project's tests,
|
25
25
|
there is a small amount of setup:
|
26
26
|
|
27
|
-
1. Install Ruby. google-cloud-dns requires Ruby 2.
|
27
|
+
1. Install Ruby. google-cloud-dns requires Ruby 2.5+. You may choose to
|
28
28
|
manage your Ruby and gem installations with [RVM](https://rvm.io/),
|
29
29
|
[rbenv](https://github.com/rbenv/rbenv), or
|
30
30
|
[chruby](https://github.com/postmodern/chruby).
|
@@ -150,7 +150,7 @@ module Google
|
|
150
150
|
##
|
151
151
|
# Raise an error unless an active service is available.
|
152
152
|
def ensure_service!
|
153
|
-
raise "Must have active connection" unless zone
|
153
|
+
raise "Must have active connection" unless zone&.service
|
154
154
|
end
|
155
155
|
end
|
156
156
|
end
|
@@ -127,17 +127,17 @@ module Google
|
|
127
127
|
# puts change.id
|
128
128
|
# end
|
129
129
|
#
|
130
|
-
def all request_limit: nil
|
130
|
+
def all request_limit: nil, &block
|
131
131
|
request_limit = request_limit.to_i if request_limit
|
132
132
|
unless block_given?
|
133
|
-
return enum_for
|
133
|
+
return enum_for :all, request_limit: request_limit
|
134
134
|
end
|
135
135
|
results = self
|
136
136
|
loop do
|
137
|
-
results.each
|
137
|
+
results.each(&block)
|
138
138
|
if request_limit
|
139
139
|
request_limit -= 1
|
140
|
-
break if request_limit
|
140
|
+
break if request_limit.negative?
|
141
141
|
end
|
142
142
|
break unless results.next?
|
143
143
|
results = results.next
|
@@ -38,20 +38,18 @@ module Google
|
|
38
38
|
# dns.project_id #=> "my-project"
|
39
39
|
#
|
40
40
|
class Credentials < Google::Auth::Credentials
|
41
|
-
SCOPE =
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
DEFAULT_PATHS = \
|
54
|
-
["~/.config/gcloud/application_default_credentials.json"].freeze
|
41
|
+
SCOPE = ["https://www.googleapis.com/auth/ndev.clouddns.readwrite"].freeze
|
42
|
+
PATH_ENV_VARS = ["DNS_CREDENTIALS",
|
43
|
+
"DNS_KEYFILE",
|
44
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
45
|
+
"GOOGLE_CLOUD_KEYFILE",
|
46
|
+
"GCLOUD_KEYFILE"].freeze
|
47
|
+
JSON_ENV_VARS = ["DNS_CREDENTIALS_JSON",
|
48
|
+
"DNS_KEYFILE_JSON",
|
49
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
50
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
51
|
+
"GCLOUD_KEYFILE_JSON"].freeze
|
52
|
+
DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"].freeze
|
55
53
|
end
|
56
54
|
end
|
57
55
|
end
|
@@ -84,7 +84,7 @@ module Google
|
|
84
84
|
type = r.first
|
85
85
|
type = :aaaa if type == :a4
|
86
86
|
r.last.each do |zf_record|
|
87
|
-
name = Service.fqdn
|
87
|
+
name = Service.fqdn zf_record[:name], @zonefile.origin
|
88
88
|
key = [name, type]
|
89
89
|
(@merged_zf_records[key] ||= []) << zf_record
|
90
90
|
end
|
@@ -99,7 +99,7 @@ module Google
|
|
99
99
|
@records = @merged_zf_records.map do |key, zf_records|
|
100
100
|
ttl = ttl_from_zonefile_records zf_records
|
101
101
|
data = zf_records.map do |zf_record|
|
102
|
-
data_from_zonefile_record
|
102
|
+
data_from_zonefile_record key[1], zf_record
|
103
103
|
end
|
104
104
|
@zone.record key[0], key[1], ttl, data
|
105
105
|
end
|
@@ -116,7 +116,7 @@ module Google
|
|
116
116
|
# From a collection of records, take the lowest ttl
|
117
117
|
def ttl_from_zonefile_records zf_records
|
118
118
|
ttls = zf_records.map do |zf_record|
|
119
|
-
ttl_to_i
|
119
|
+
ttl_to_i zf_record[:ttl]
|
120
120
|
end
|
121
121
|
min_ttl = ttls.compact.min
|
122
122
|
min_ttl || ttl_to_i(@zonefile.ttl)
|
@@ -86,42 +86,42 @@ module Google
|
|
86
86
|
# Maximum allowed number of zones in the project.
|
87
87
|
def zones_quota
|
88
88
|
reload! if @gapi.nil?
|
89
|
-
@gapi.quota
|
89
|
+
@gapi.quota&.managed_zones
|
90
90
|
end
|
91
91
|
|
92
92
|
##
|
93
93
|
# Maximum allowed number of data entries per record.
|
94
94
|
def data_per_record
|
95
95
|
reload! if @gapi.nil?
|
96
|
-
@gapi.quota
|
96
|
+
@gapi.quota&.resource_records_per_rrset
|
97
97
|
end
|
98
98
|
|
99
99
|
##
|
100
100
|
# Maximum allowed number of records to add per change.
|
101
101
|
def additions_per_change
|
102
102
|
reload! if @gapi.nil?
|
103
|
-
@gapi.quota
|
103
|
+
@gapi.quota&.rrset_additions_per_change
|
104
104
|
end
|
105
105
|
|
106
106
|
##
|
107
107
|
# Maximum allowed number of records to delete per change.
|
108
108
|
def deletions_per_change
|
109
109
|
reload! if @gapi.nil?
|
110
|
-
@gapi.quota
|
110
|
+
@gapi.quota&.rrset_deletions_per_change
|
111
111
|
end
|
112
112
|
|
113
113
|
##
|
114
114
|
# Maximum allowed number of records per zone in the project.
|
115
115
|
def records_per_zone
|
116
116
|
reload! if @gapi.nil?
|
117
|
-
@gapi.quota
|
117
|
+
@gapi.quota&.rrsets_per_managed_zone
|
118
118
|
end
|
119
119
|
|
120
120
|
##
|
121
121
|
# Maximum allowed total bytes size for all the data in one change.
|
122
122
|
def total_data_per_change
|
123
123
|
reload! if @gapi.nil?
|
124
|
-
@gapi.quota
|
124
|
+
@gapi.quota&.total_rrdata_size_per_change
|
125
125
|
end
|
126
126
|
|
127
127
|
##
|
@@ -127,17 +127,17 @@ module Google
|
|
127
127
|
# puts record.name
|
128
128
|
# end
|
129
129
|
#
|
130
|
-
def all request_limit: nil
|
130
|
+
def all request_limit: nil, &block
|
131
131
|
request_limit = request_limit.to_i if request_limit
|
132
132
|
unless block_given?
|
133
|
-
return enum_for
|
133
|
+
return enum_for :all, request_limit: request_limit
|
134
134
|
end
|
135
135
|
results = self
|
136
136
|
loop do
|
137
|
-
results.each
|
137
|
+
results.each(&block)
|
138
138
|
if request_limit
|
139
139
|
request_limit -= 1
|
140
|
-
break if request_limit
|
140
|
+
break if request_limit.negative?
|
141
141
|
end
|
142
142
|
break unless results.next?
|
143
143
|
results = results.next
|
@@ -159,9 +159,9 @@ module Google
|
|
159
159
|
# zone.clear!
|
160
160
|
#
|
161
161
|
def clear!
|
162
|
-
non_essential = records.all.reject { |r|
|
162
|
+
non_essential = records.all.reject { |r| ["SOA", "NS"].include? r.type }
|
163
163
|
change = update [], non_essential
|
164
|
-
change
|
164
|
+
change&.wait_until_done!
|
165
165
|
end
|
166
166
|
|
167
167
|
##
|
@@ -297,7 +297,7 @@ module Google
|
|
297
297
|
def records name = nil, type = nil, token: nil, max: nil
|
298
298
|
ensure_service!
|
299
299
|
|
300
|
-
name = fqdn
|
300
|
+
name = fqdn name if name
|
301
301
|
|
302
302
|
gapi = service.list_records id, name, type, token: token, max: max
|
303
303
|
Record::List.from_gapi gapi, self, name, type, max
|
@@ -368,7 +368,7 @@ module Google
|
|
368
368
|
#
|
369
369
|
# The Google Cloud DNS service requires that record names and data use
|
370
370
|
# fully-qualified addresses. The @ symbol is not accepted, nor are
|
371
|
-
# unqualified subdomain addresses like www
|
371
|
+
# unqualified subdomain addresses like `www`. If your zone file contains
|
372
372
|
# such values, you may need to pre-process it in order for the import
|
373
373
|
# operation to succeed.
|
374
374
|
#
|
@@ -396,7 +396,7 @@ module Google
|
|
396
396
|
#
|
397
397
|
def import path_or_io, only: nil, except: nil,
|
398
398
|
skip_soa: nil, soa_serial: nil
|
399
|
-
except = (Array(except).map(&:to_s).map(&:upcase) +
|
399
|
+
except = (Array(except).map(&:to_s).map(&:upcase) + ["SOA", "NS"]).uniq
|
400
400
|
importer = Google::Cloud::Dns::Importer.new self, path_or_io
|
401
401
|
additions = importer.records only: only, except: except
|
402
402
|
update additions, [], skip_soa: skip_soa, soa_serial: soa_serial
|
@@ -650,10 +650,10 @@ module Google
|
|
650
650
|
# mx.ttl = 3600 # change only the TTL
|
651
651
|
# end
|
652
652
|
#
|
653
|
-
def modify name, type, skip_soa: nil, soa_serial: nil
|
653
|
+
def modify name, type, skip_soa: nil, soa_serial: nil, &block
|
654
654
|
existing = records(name, type).all.to_a
|
655
655
|
updated = existing.map(&:dup)
|
656
|
-
updated.each
|
656
|
+
updated.each(&block)
|
657
657
|
update updated, existing, skip_soa: skip_soa, soa_serial: soa_serial
|
658
658
|
end
|
659
659
|
|
@@ -721,7 +721,7 @@ module Google
|
|
721
721
|
end
|
722
722
|
|
723
723
|
def replace_soa_serial soa_data, soa_serial
|
724
|
-
soa_data = soa_data.split
|
724
|
+
soa_data = soa_data.split
|
725
725
|
current_serial = soa_data[2].to_i
|
726
726
|
soa_data[2] = if soa_serial && soa_serial.respond_to?(:call)
|
727
727
|
soa_serial.call current_serial
|
@@ -122,17 +122,17 @@ module Google
|
|
122
122
|
# puts zone.name
|
123
123
|
# end
|
124
124
|
#
|
125
|
-
def all request_limit: nil
|
125
|
+
def all request_limit: nil, &block
|
126
126
|
request_limit = request_limit.to_i if request_limit
|
127
127
|
unless block_given?
|
128
|
-
return enum_for
|
128
|
+
return enum_for :all, request_limit: request_limit
|
129
129
|
end
|
130
130
|
results = self
|
131
131
|
loop do
|
132
|
-
results.each
|
132
|
+
results.each(&block)
|
133
133
|
if request_limit
|
134
134
|
request_limit -= 1
|
135
|
-
break if request_limit
|
135
|
+
break if request_limit.negative?
|
136
136
|
end
|
137
137
|
break unless results.next?
|
138
138
|
results = results.next
|
@@ -162,10 +162,10 @@ module Google
|
|
162
162
|
# end
|
163
163
|
# end
|
164
164
|
#
|
165
|
-
def modify name, type
|
165
|
+
def modify name, type, &block
|
166
166
|
existing = @zone.records(name, type).all.to_a
|
167
167
|
updated = existing.map(&:dup)
|
168
|
-
updated.each
|
168
|
+
updated.each(&block)
|
169
169
|
@additions += updated
|
170
170
|
@deletions += existing
|
171
171
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-dns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.35.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-03-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -73,14 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: 1.
|
76
|
+
version: 1.25.1
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 1.
|
83
|
+
version: 1.25.1
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: minitest
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -250,14 +250,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
250
250
|
requirements:
|
251
251
|
- - ">="
|
252
252
|
- !ruby/object:Gem::Version
|
253
|
-
version: '2.
|
253
|
+
version: '2.5'
|
254
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
255
255
|
requirements:
|
256
256
|
- - ">="
|
257
257
|
- !ruby/object:Gem::Version
|
258
258
|
version: '0'
|
259
259
|
requirements: []
|
260
|
-
rubygems_version: 3.
|
260
|
+
rubygems_version: 3.2.13
|
261
261
|
signing_key:
|
262
262
|
specification_version: 4
|
263
263
|
summary: API Client library for Google Cloud DNS
|