google-cloud-dns 0.34.0 → 0.36.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 479a5747afb3dcf0773e2aed9ee0c34082de7ca7321efaa943c295522b670a12
4
- data.tar.gz: 25ec7fa5e1fbfd9e165b8d96f5909475c730e3ca41a116bdb5ba892a9228f213
3
+ metadata.gz: 05fb93bb46a7c01959ef771e9d993267d6f1bd58423ee573306b810e522bdb3c
4
+ data.tar.gz: e9c9f2c4e5d84f3066fad5964437811d1c2dd367e1f4be24becd2d09a5a9bbf5
5
5
  SHA512:
6
- metadata.gz: 6576c0e8566f4e8f70a129fac30c0bef6991a9eb539a9a6c9e22f61952bf48941be2daf6719e5dabc12ca9e0d7e9fc95516c04508ef7ad7983674a44f8e46492
7
- data.tar.gz: f316aaef3760f5950782468a14bdb1e1b0fb55c64aff178ac3654b9c5b90872ea7426c1d69a4b88584b5d0ee436596fc5e9796af33e2fe39f8c323395a7a67ef
6
+ metadata.gz: ab7fa8bd57cfb2497992368284c033db56c1ac2e09476ac8c44cc80479e7f7b405f4620129401dbd5eeb9ba6509c666f9a74bba6f55fc65699b8995e3fa409c0
7
+ data.tar.gz: 60d1aff4fc612b57757b125d6e0ec6cb317220613a12c4de9796f68235ec378cbcff13d29ec98bb5345f59cbbe3af416ad807b87d6028cf2ec4e750ba0523edf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Release History
2
2
 
3
+ ### 0.36.0 (2022-07-28)
4
+
5
+ #### Features
6
+
7
+ * Update minimum Ruby version to 2.6 ([#18869](https://github.com/googleapis/google-cloud-ruby/issues/18869))
8
+
9
+ ### 0.35.1 / 2021-06-17
10
+
11
+ #### Bug Fixes
12
+
13
+ * Expand googleauth dependency to support future 1.x versions
14
+
15
+ ### 0.35.0 / 2021-03-10
16
+
17
+ #### Features
18
+
19
+ * Drop support for Ruby 2.4 and add support for Ruby 3.0
20
+
3
21
  ### 0.34.0 / 2021-01-13
4
22
 
5
23
  #### Features
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.4+. You may choose to
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).
@@ -126,8 +126,7 @@ entire acceptance test suite. However, please ensure that you do successfully
126
126
  run acceptance tests for any code areas covered by your pull request.
127
127
 
128
128
  To run the acceptance tests, first create and configure a project in the Google
129
- Developers Console, as described in the {file:AUTHENTICATION.md Authentication
130
- guide}. Be sure to download the JSON KEY file. Make note of the PROJECT_ID and
129
+ Developers Console, as described in the {file:AUTHENTICATION.md Authentication Guide}. Be sure to download the JSON KEY file. Make note of the PROJECT_ID and
131
130
  the KEYFILE location on your system.
132
131
 
133
132
  Before you can run the DNS acceptance tests, you must first create indexes
data/OVERVIEW.md CHANGED
@@ -250,5 +250,4 @@ dns = Google::Cloud::Dns.new retries: 10, timeout: 120
250
250
 
251
251
  ## Additional information
252
252
 
253
- Google Cloud DNS can be configured to use logging. To learn more, see the
254
- {file:LOGGING.md Logging guide}.
253
+ Google Cloud DNS can be configured to use logging. To learn more, see the {file:LOGGING.md Logging guide}.
@@ -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(:all, request_limit: request_limit)
133
+ return enum_for :all, request_limit: request_limit
134
134
  end
135
135
  results = self
136
136
  loop do
137
- results.each { |r| yield r }
137
+ results.each(&block)
138
138
  if request_limit
139
139
  request_limit -= 1
140
- break if request_limit < 0
140
+ break if request_limit.negative?
141
141
  end
142
142
  break unless results.next?
143
143
  results = results.next
@@ -127,7 +127,7 @@ module Google
127
127
  # change.done? #=> true
128
128
  #
129
129
  def wait_until_done!
130
- backoff = ->(retries) { sleep 2 * retries + 5 }
130
+ backoff = ->(retries) { sleep((2 * retries) + 5) }
131
131
  retries = 0
132
132
  until done?
133
133
  backoff.call retries
@@ -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 && zone.service
153
+ raise "Must have active connection" unless zone&.service
154
154
  end
155
155
  end
156
156
  end
@@ -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
- ["https://www.googleapis.com/auth/ndev.clouddns.readwrite"].freeze
43
- PATH_ENV_VARS = %w[DNS_CREDENTIALS
44
- DNS_KEYFILE
45
- GOOGLE_CLOUD_CREDENTIALS
46
- GOOGLE_CLOUD_KEYFILE
47
- GCLOUD_KEYFILE].freeze
48
- JSON_ENV_VARS = %w[DNS_CREDENTIALS_JSON
49
- DNS_KEYFILE_JSON
50
- GOOGLE_CLOUD_CREDENTIALS_JSON
51
- GOOGLE_CLOUD_KEYFILE_JSON
52
- GCLOUD_KEYFILE_JSON].freeze
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(zf_record[:name], @zonefile.origin)
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(key[1], zf_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(zf_record[:ttl])
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.managed_zones if @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.resource_records_per_rrset if @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.rrset_additions_per_change if @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.rrset_deletions_per_change if @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.rrsets_per_managed_zone if @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.total_rrdata_size_per_change if @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(:all, request_limit: request_limit)
133
+ return enum_for :all, request_limit: request_limit
134
134
  end
135
135
  results = self
136
136
  loop do
137
- results.each { |r| yield r }
137
+ results.each(&block)
138
138
  if request_limit
139
139
  request_limit -= 1
140
- break if request_limit < 0
140
+ break if request_limit.negative?
141
141
  end
142
142
  break unless results.next?
143
143
  results = results.next
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Dns
19
- VERSION = "0.34.0".freeze
19
+ VERSION = "0.36.0".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -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(:all, request_limit: request_limit)
128
+ return enum_for :all, request_limit: request_limit
129
129
  end
130
130
  results = self
131
131
  loop do
132
- results.each { |r| yield r }
132
+ results.each(&block)
133
133
  if request_limit
134
134
  request_limit -= 1
135
- break if request_limit < 0
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 { |r| yield r }
168
+ updated.each(&block)
169
169
  @additions += updated
170
170
  @deletions += existing
171
171
  end
@@ -159,9 +159,9 @@ module Google
159
159
  # zone.clear!
160
160
  #
161
161
  def clear!
162
- non_essential = records.all.reject { |r| %w[SOA NS].include?(r.type) }
162
+ non_essential = records.all.reject { |r| ["SOA", "NS"].include? r.type }
163
163
  change = update [], non_essential
164
- change.wait_until_done! unless change.nil?
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(name) if name
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
@@ -341,9 +341,7 @@ module Google
341
341
  # zone.export "path/to/db.example.com"
342
342
  #
343
343
  def export path
344
- File.open path, "w" do |f|
345
- f.write to_zonefile
346
- end
344
+ File.write path, to_zonefile
347
345
  end
348
346
 
349
347
  ##
@@ -368,7 +366,7 @@ module Google
368
366
  #
369
367
  # The Google Cloud DNS service requires that record names and data use
370
368
  # fully-qualified addresses. The @ symbol is not accepted, nor are
371
- # unqualified subdomain addresses like www. If your zone file contains
369
+ # unqualified subdomain addresses like `www`. If your zone file contains
372
370
  # such values, you may need to pre-process it in order for the import
373
371
  # operation to succeed.
374
372
  #
@@ -396,7 +394,7 @@ module Google
396
394
  #
397
395
  def import path_or_io, only: nil, except: nil,
398
396
  skip_soa: nil, soa_serial: nil
399
- except = (Array(except).map(&:to_s).map(&:upcase) + %w[SOA NS]).uniq
397
+ except = (Array(except).map(&:to_s).map(&:upcase) + ["SOA", "NS"]).uniq
400
398
  importer = Google::Cloud::Dns::Importer.new self, path_or_io
401
399
  additions = importer.records only: only, except: except
402
400
  update additions, [], skip_soa: skip_soa, soa_serial: soa_serial
@@ -650,10 +648,10 @@ module Google
650
648
  # mx.ttl = 3600 # change only the TTL
651
649
  # end
652
650
  #
653
- def modify name, type, skip_soa: nil, soa_serial: nil
651
+ def modify name, type, skip_soa: nil, soa_serial: nil, &block
654
652
  existing = records(name, type).all.to_a
655
653
  updated = existing.map(&:dup)
656
- updated.each { |r| yield r }
654
+ updated.each(&block)
657
655
  update updated, existing, skip_soa: skip_soa, soa_serial: soa_serial
658
656
  end
659
657
 
@@ -721,7 +719,7 @@ module Google
721
719
  end
722
720
 
723
721
  def replace_soa_serial soa_data, soa_serial
724
- soa_data = soa_data.split " "
722
+ soa_data = soa_data.split
725
723
  current_serial = soa_data[2].to_i
726
724
  soa_data[2] = if soa_serial && soa_serial.respond_to?(:call)
727
725
  soa_serial.call current_serial
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.34.0
4
+ version: 0.36.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-01-13 00:00:00.000000000 Z
12
+ date: 2022-07-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.2'
20
+ version: '1.6'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.2'
27
+ version: '1.6'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: google-apis-dns_v1
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -43,16 +43,22 @@ dependencies:
43
43
  name: googleauth
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '0.9'
48
+ version: 0.16.2
49
+ - - "<"
50
+ - !ruby/object:Gem::Version
51
+ version: 2.a
49
52
  type: :runtime
50
53
  prerelease: false
51
54
  version_requirements: !ruby/object:Gem::Requirement
52
55
  requirements:
53
- - - "~>"
56
+ - - ">="
54
57
  - !ruby/object:Gem::Version
55
- version: '0.9'
58
+ version: 0.16.2
59
+ - - "<"
60
+ - !ruby/object:Gem::Version
61
+ version: 2.a
56
62
  - !ruby/object:Gem::Dependency
57
63
  name: zonefile
58
64
  requirement: !ruby/object:Gem::Requirement
@@ -73,28 +79,28 @@ dependencies:
73
79
  requirements:
74
80
  - - "~>"
75
81
  - !ruby/object:Gem::Version
76
- version: 1.24.0
82
+ version: 1.26.1
77
83
  type: :development
78
84
  prerelease: false
79
85
  version_requirements: !ruby/object:Gem::Requirement
80
86
  requirements:
81
87
  - - "~>"
82
88
  - !ruby/object:Gem::Version
83
- version: 1.24.0
89
+ version: 1.26.1
84
90
  - !ruby/object:Gem::Dependency
85
91
  name: minitest
86
92
  requirement: !ruby/object:Gem::Requirement
87
93
  requirements:
88
94
  - - "~>"
89
95
  - !ruby/object:Gem::Version
90
- version: '5.14'
96
+ version: '5.16'
91
97
  type: :development
92
98
  prerelease: false
93
99
  version_requirements: !ruby/object:Gem::Requirement
94
100
  requirements:
95
101
  - - "~>"
96
102
  - !ruby/object:Gem::Version
97
- version: '5.14'
103
+ version: '5.16'
98
104
  - !ruby/object:Gem::Dependency
99
105
  name: minitest-autotest
100
106
  requirement: !ruby/object:Gem::Requirement
@@ -250,14 +256,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
250
256
  requirements:
251
257
  - - ">="
252
258
  - !ruby/object:Gem::Version
253
- version: '2.4'
259
+ version: '2.6'
254
260
  required_rubygems_version: !ruby/object:Gem::Requirement
255
261
  requirements:
256
262
  - - ">="
257
263
  - !ruby/object:Gem::Version
258
264
  version: '0'
259
265
  requirements: []
260
- rubygems_version: 3.1.4
266
+ rubygems_version: 3.3.14
261
267
  signing_key:
262
268
  specification_version: 4
263
269
  summary: API Client library for Google Cloud DNS