google-cloud-spanner 2.12.1 → 2.15.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 542daf50ed73132fb41ef599e01527b0f90ea9c345c0a67325eb9fd6fc2a3d0b
4
- data.tar.gz: 1768835bfc4a7f9c0ed168d9b56c09247e3bab6da4b53cad6e896378520cca7c
3
+ metadata.gz: be9bac8912ff335f9d1bd4c18268b3796ad4bf521259559ccfd33bdc7aebd5b9
4
+ data.tar.gz: 5fe33da63dbe3ad1f733cc79c8a136a69f15ee013eda284a4d6c22e759728c33
5
5
  SHA512:
6
- metadata.gz: 69cd1d9cdca59e2878b96476245b2395912afc68c9a94cae437e050dd7abe3b11a6d5bd8677822e7846c7cb3644a0cfc303d5d86e79b73b4a36fa8b9f823581b
7
- data.tar.gz: b135eb58d7ca1f2673f6504e8e6fca8eb8e8ebb9ca85fd94bfa19ff75e6af1127ab9da6cbf6798a060d1ee2faab05cc91a75355b0e45e060308901311ebd354d
6
+ metadata.gz: 0c0939a408406551ade36f1bf01a43b2d9ced1a9556bfca9bb4642e348383da2ff3aa1e2285fa5acb1ed144dcdf6bf0e437419e9e07d1468bcc001203ed7c017
7
+ data.tar.gz: dc6d64fe998cd22ea0023516bb2429ea539c9e8230435800b4f19419b002a2313669880560a91297ff2a61c05b343b0de7f37aeaf15f6e093e8383813b153a63
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Release History
2
2
 
3
+ ### 2.15.0 (2022-09-07)
4
+
5
+ #### Features
6
+
7
+ * Support fine grained access control ([#19067](https://github.com/googleapis/google-cloud-ruby/issues/19067))
8
+
9
+ ### 2.14.0 (2022-07-08)
10
+
11
+ #### Features
12
+
13
+ * Updated minimum Ruby version to 2.6 ([#18454](https://github.com/googleapis/google-cloud-ruby/issues/18454))
14
+
15
+ ### 2.13.0 / 2022-04-01
16
+
17
+ #### Features
18
+
19
+ * add spangres support ([#17661](https://www.github.com/googleapis/google-cloud-ruby/issues/17661))
20
+ * add pg_numeric and tests
21
+ * skip test for emulator
22
+ * add rubocop for acceptance
23
+
3
24
  ### 2.12.1 / 2022-02-16
4
25
 
5
26
  #### Bug Fixes
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  Apache License
2
2
  Version 2.0, January 2004
3
- https://www.apache.org/licenses/
3
+ http://www.apache.org/licenses/
4
4
 
5
5
  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
6
 
@@ -192,7 +192,7 @@
192
192
  you may not use this file except in compliance with the License.
193
193
  You may obtain a copy of the License at
194
194
 
195
- https://www.apache.org/licenses/LICENSE-2.0
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
196
 
197
197
  Unless required by applicable law or agreed to in writing, software
198
198
  distributed under the License is distributed on an "AS IS" BASIS,
@@ -52,10 +52,11 @@ module Google
52
52
  ##
53
53
  # @private Creates a new Spanner Client instance.
54
54
  def initialize project, instance_id, database_id, session_labels: nil,
55
- pool_opts: {}, query_options: nil
55
+ pool_opts: {}, query_options: nil, database_role: nil
56
56
  @project = project
57
57
  @instance_id = instance_id
58
58
  @database_id = database_id
59
+ @database_role = database_role
59
60
  @session_labels = session_labels
60
61
  @pool = Pool.new self, **pool_opts
61
62
  @query_options = query_options
@@ -97,6 +98,12 @@ module Google
97
98
  @project.database instance_id, database_id
98
99
  end
99
100
 
101
+ # The Spanner session creator role.
102
+ # @return [String]
103
+ def database_role
104
+ @database_role
105
+ end
106
+
100
107
  # A hash of values to specify the custom query options for executing
101
108
  # SQL query.
102
109
  # @return [Hash]
@@ -2115,7 +2122,8 @@ module Google
2115
2122
  Admin::Database::V1::DatabaseAdmin::Paths.database_path(
2116
2123
  project: project_id, instance: instance_id, database: database_id
2117
2124
  ),
2118
- labels: @session_labels
2125
+ labels: @session_labels,
2126
+ database_role: @database_role
2119
2127
  Session.from_grpc grpc, @project.service, query_options: @query_options
2120
2128
  end
2121
2129
 
@@ -2144,7 +2152,8 @@ module Google
2144
2152
  project: project_id, instance: instance_id, database: database_id
2145
2153
  ),
2146
2154
  session_count,
2147
- labels: @session_labels
2155
+ labels: @session_labels,
2156
+ database_role: @database_role
2148
2157
  resp.session.map { |grpc| Session.from_grpc grpc, @project.service, query_options: @query_options }
2149
2158
  end
2150
2159
 
@@ -174,11 +174,14 @@ module Google
174
174
  def grpc_type_for_field field
175
175
  return field.to_grpc_type if field.respond_to? :to_grpc_type
176
176
 
177
- if Array === field
177
+ case field
178
+ when Array
178
179
  V1::Type.new(
179
180
  code: :ARRAY,
180
181
  array_element_type: grpc_type_for_field(field.first)
181
182
  )
183
+ when :PG_NUMERIC
184
+ V1::Type.new(code: :NUMERIC, type_annotation: :PG_NUMERIC)
182
185
  else
183
186
  V1::Type.new(code: field)
184
187
  end
@@ -172,7 +172,7 @@ module Google
172
172
  def to_h skip_dup_check: nil
173
173
  raise DuplicateNameError if !skip_dup_check && fields.duplicate_names?
174
174
 
175
- Hash[keys.zip to_a(skip_dup_check: skip_dup_check)]
175
+ keys.zip(to_a(skip_dup_check: skip_dup_check)).to_h
176
176
  end
177
177
 
178
178
  # @private
@@ -288,12 +288,9 @@ module Google
288
288
 
289
289
  # @private
290
290
  DATBASE_OPERATION_METADAT_FILTER_TEMPLATE = [
291
- "(metadata.@type:CreateDatabaseMetadata AND " \
292
- "metadata.database:%<database_id>s)",
293
- "(metadata.@type:RestoreDatabaseMetadata AND "\
294
- "metadata.name:%<database_id>s)",
295
- "(metadata.@type:UpdateDatabaseDdl AND "\
296
- "metadata.database:%<database_id>s)"
291
+ "(metadata.@type:CreateDatabaseMetadata AND metadata.database:%<database_id>s)",
292
+ "(metadata.@type:RestoreDatabaseMetadata AND metadata.name:%<database_id>s)",
293
+ "(metadata.@type:UpdateDatabaseDdl AND metadata.database:%<database_id>s)"
297
294
  ].join(" OR ")
298
295
 
299
296
  ##
@@ -331,7 +331,7 @@ module Google
331
331
  #
332
332
  def to_h
333
333
  raise DuplicateNameError if duplicate_names?
334
- Hash[pairs]
334
+ pairs.to_h
335
335
  end
336
336
 
337
337
  # @private
@@ -216,7 +216,7 @@ module Google
216
216
  def labels= labels
217
217
  @grpc.labels = Google::Protobuf::Map.new(
218
218
  :string, :string,
219
- Hash[labels.map { |k, v| [String(k), String(v)] }]
219
+ labels.to_h { |k, v| [String(k), String(v)] }
220
220
  )
221
221
  end
222
222
 
@@ -277,8 +277,7 @@ module Google
277
277
  end
278
278
 
279
279
  def create_keepalive_task!
280
- @keepalive_task = Concurrent::TimerTask.new(execution_interval: 300,
281
- timeout_interval: 60) do
280
+ @keepalive_task = Concurrent::TimerTask.new execution_interval: 300 do
282
281
  keepalive_or_release!
283
282
  end
284
283
  @keepalive_task.execute
@@ -259,7 +259,7 @@ module Google
259
259
  config = config.path if config.respond_to? :path
260
260
 
261
261
  # Convert from possible Google::Protobuf::Map
262
- labels = Hash[labels.map { |k, v| [String(k), String(v)] }] if labels
262
+ labels = labels.to_h { |k, v| [String(k), String(v)] } if labels
263
263
  grpc = service.create_instance \
264
264
  instance_id, name: name, config: config, nodes: nodes,
265
265
  processing_units: processing_units, labels: labels
@@ -569,9 +569,9 @@ module Google
569
569
  # end
570
570
  #
571
571
  def client instance_id, database_id, pool: {}, labels: nil,
572
- query_options: nil
572
+ query_options: nil, database_role: nil
573
573
  # Convert from possible Google::Protobuf::Map
574
- labels = Hash[labels.map { |k, v| [String(k), String(v)] }] if labels
574
+ labels = labels.to_h { |k, v| [String(k), String(v)] } if labels
575
575
  # Configs set by environment variables take over client-level configs.
576
576
  if query_options.nil?
577
577
  query_options = @query_options
@@ -581,7 +581,8 @@ module Google
581
581
  Client.new self, instance_id, database_id,
582
582
  session_labels: labels,
583
583
  pool_opts: valid_session_pool_options(pool),
584
- query_options: query_options
584
+ query_options: query_options,
585
+ database_role: database_role
585
586
  end
586
587
 
587
588
  ##
@@ -647,7 +648,7 @@ module Google
647
648
  def batch_client instance_id, database_id, labels: nil,
648
649
  query_options: nil
649
650
  # Convert from possible Google::Protobuf::Map
650
- labels = Hash[labels.map { |k, v| [String(k), String(v)] }] if labels
651
+ labels = labels.to_h { |k, v| [String(k), String(v)] } if labels
651
652
  BatchClient.new self, instance_id, database_id, session_labels: labels,
652
653
  query_options: query_options
653
654
  end
@@ -135,7 +135,7 @@ module Google
135
135
  processing_units: nil, labels: nil,
136
136
  call_options: nil
137
137
  opts = default_options call_options: call_options
138
- labels = Hash[labels.map { |k, v| [String(k), String(v)] }] if labels
138
+ labels = labels.to_h { |k, v| [String(k), String(v)] } if labels
139
139
 
140
140
  create_obj = Admin::Instance::V1::Instance.new({
141
141
  display_name: name, config: instance_config_path(config),
@@ -293,20 +293,20 @@ module Google
293
293
  end
294
294
 
295
295
  def create_session database_name, labels: nil,
296
- call_options: nil
296
+ call_options: nil, database_role: nil
297
297
  opts = default_options session_name: database_name,
298
298
  call_options: call_options
299
- session = V1::Session.new labels: labels if labels
299
+ session = V1::Session.new labels: labels, creator_role: database_role if labels || database_role
300
300
  service.create_session(
301
301
  { database: database_name, session: session }, opts
302
302
  )
303
303
  end
304
304
 
305
305
  def batch_create_sessions database_name, session_count, labels: nil,
306
- call_options: nil
306
+ call_options: nil, database_role: nil
307
307
  opts = default_options session_name: database_name,
308
308
  call_options: call_options
309
- session = V1::Session.new labels: labels if labels
309
+ session = V1::Session.new labels: labels, creator_role: database_role if labels || database_role
310
310
  # The response may have fewer sessions than requested in the RPC.
311
311
  request = {
312
312
  database: database_name,
@@ -604,7 +604,7 @@ module Google
604
604
  opts[:timeout] = call_options[:timeout] if call_options[:timeout]
605
605
  opts[:retry_policy] = call_options[:retry_policy] if call_options[:retry_policy]
606
606
  end
607
- return opts unless opts.empty?
607
+ ::Gapic::CallOptions.new(**opts)
608
608
  end
609
609
 
610
610
  def partition_options partition_size_bytes, max_partitions
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Spanner
19
- VERSION = "2.12.1".freeze
19
+ VERSION = "2.15.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-spanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.1
4
+ version: 2.15.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: 2022-02-16 00:00:00.000000000 Z
12
+ date: 2022-09-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -81,34 +81,48 @@ dependencies:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: '1.0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: gapic-common
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: 0.11.0
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: 0.11.0
84
98
  - !ruby/object:Gem::Dependency
85
99
  name: google-style
86
100
  requirement: !ruby/object:Gem::Requirement
87
101
  requirements:
88
102
  - - "~>"
89
103
  - !ruby/object:Gem::Version
90
- version: 1.25.1
104
+ version: 1.26.1
91
105
  type: :development
92
106
  prerelease: false
93
107
  version_requirements: !ruby/object:Gem::Requirement
94
108
  requirements:
95
109
  - - "~>"
96
110
  - !ruby/object:Gem::Version
97
- version: 1.25.1
111
+ version: 1.26.1
98
112
  - !ruby/object:Gem::Dependency
99
113
  name: minitest
100
114
  requirement: !ruby/object:Gem::Requirement
101
115
  requirements:
102
116
  - - "~>"
103
117
  - !ruby/object:Gem::Version
104
- version: '5.14'
118
+ version: '5.16'
105
119
  type: :development
106
120
  prerelease: false
107
121
  version_requirements: !ruby/object:Gem::Requirement
108
122
  requirements:
109
123
  - - "~>"
110
124
  - !ruby/object:Gem::Version
111
- version: '5.14'
125
+ version: '5.16'
112
126
  - !ruby/object:Gem::Dependency
113
127
  name: minitest-autotest
114
128
  requirement: !ruby/object:Gem::Requirement
@@ -326,14 +340,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
326
340
  requirements:
327
341
  - - ">="
328
342
  - !ruby/object:Gem::Version
329
- version: '2.5'
343
+ version: '2.6'
330
344
  required_rubygems_version: !ruby/object:Gem::Requirement
331
345
  requirements:
332
346
  - - ">="
333
347
  - !ruby/object:Gem::Version
334
348
  version: '0'
335
349
  requirements: []
336
- rubygems_version: 3.3.5
350
+ rubygems_version: 3.3.14
337
351
  signing_key:
338
352
  specification_version: 4
339
353
  summary: API Client library for Google Cloud Spanner API