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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 479a5747afb3dcf0773e2aed9ee0c34082de7ca7321efaa943c295522b670a12
4
- data.tar.gz: 25ec7fa5e1fbfd9e165b8d96f5909475c730e3ca41a116bdb5ba892a9228f213
3
+ metadata.gz: 697c4c37fec5ebcde48f127d92630d4ffe3921d2ac3e319ce2f0642778c4d5af
4
+ data.tar.gz: 41782ce61019a4a5ae4888db7a547609c6018cb69ce6d6a209aef82e47830646
5
5
  SHA512:
6
- metadata.gz: 6576c0e8566f4e8f70a129fac30c0bef6991a9eb539a9a6c9e22f61952bf48941be2daf6719e5dabc12ca9e0d7e9fc95516c04508ef7ad7983674a44f8e46492
7
- data.tar.gz: f316aaef3760f5950782468a14bdb1e1b0fb55c64aff178ac3654b9c5b90872ea7426c1d69a4b88584b5d0ee436596fc5e9796af33e2fe39f8c323395a7a67ef
6
+ metadata.gz: d990f8b29bc5d7ac84a9f1b9e96aa48ab24af1c70b73ec15fdb395027abe41b5fa8b5f56d7ad5ce47e4e2735088d8c193e3d2c43c837126a0e581454464a4fb9
7
+ data.tar.gz: 3556c5a65e31579aafe4d909013c77b3e616f3cb64ae5f7e1a62f5c60781f9bc83dffd48f748fbcd088f0ec17481bd706ecc044adb2f5afbebe3cfc6a60a6d78
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 0.35.0 / 2021-03-10
4
+
5
+ #### Features
6
+
7
+ * Drop support for Ruby 2.4 and add support for Ruby 3.0
8
+
3
9
  ### 0.34.0 / 2021-01-13
4
10
 
5
11
  #### 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).
@@ -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
@@ -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
@@ -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.35.0".freeze
20
20
  end
21
21
  end
22
22
  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
@@ -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. If your zone file contains
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) + %w[SOA NS]).uniq
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 { |r| yield r }
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(: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
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.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-01-13 00:00:00.000000000 Z
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.24.0
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.24.0
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.4'
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.1.4
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