google-cloud-spanner 1.12.2 → 1.13.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/CHANGELOG.md +6 -0
- data/lib/google-cloud-spanner.rb +4 -0
- data/lib/google/cloud/spanner.rb +22 -6
- data/lib/google/cloud/spanner/version.rb +1 -1
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eba832c0a32045d9ae260e11fe32ef991974465d9bf7dac3b49d6ea4a977d95f
|
4
|
+
data.tar.gz: 8c818d7beef38f54a3de61eed3f42c918b68bd0cdf5a89c83973b5b32d142ac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4405ca2cb9c051ecadbc3b2dcdfb3880620f59fbc511a04ad1fe097db418cbf93c452bdc907ee8e9fe9b9bdb54d640c539ceca703f892a5ccf0888524e4f36f5
|
7
|
+
data.tar.gz: 9e72b1fa85cbdc8c89fb0713ecf7fc965736b552e7d53e688dcc214491e35ba158c45ef73b596b74105b2afd6839a7d0fb435f68256432e3e1fe9ffdb5efd7e9
|
data/CHANGELOG.md
CHANGED
data/lib/google-cloud-spanner.rb
CHANGED
@@ -122,6 +122,9 @@ Google::Cloud.configure.add_config! :spanner do |config|
|
|
122
122
|
"SPANNER_KEYFILE", "SPANNER_KEYFILE_JSON"
|
123
123
|
)
|
124
124
|
end
|
125
|
+
default_emulator = Google::Cloud::Config.deferred do
|
126
|
+
ENV["SPANNER_EMULATOR_HOST"]
|
127
|
+
end
|
125
128
|
|
126
129
|
config.add_field! :project_id, default_project, match: String, allow_nil: true
|
127
130
|
config.add_alias! :project, :project_id
|
@@ -133,4 +136,5 @@ Google::Cloud.configure.add_config! :spanner do |config|
|
|
133
136
|
config.add_field! :timeout, nil, match: Integer
|
134
137
|
config.add_field! :client_config, nil, match: Hash
|
135
138
|
config.add_field! :endpoint, nil, match: String
|
139
|
+
config.add_field! :emulator_host, default_emulator, match: String, allow_nil: true
|
136
140
|
end
|
data/lib/google/cloud/spanner.rb
CHANGED
@@ -34,6 +34,8 @@ module Google
|
|
34
34
|
# See {file:OVERVIEW.md Spanner Overview}.
|
35
35
|
#
|
36
36
|
module Spanner
|
37
|
+
# rubocop:disable Metrics/MethodLength
|
38
|
+
|
37
39
|
##
|
38
40
|
# Creates a new object for connecting to the Spanner service.
|
39
41
|
# Each call creates a new connection.
|
@@ -64,6 +66,8 @@ module Google
|
|
64
66
|
# @param [String] project Alias for the `project_id` argument. Deprecated.
|
65
67
|
# @param [String] keyfile Alias for the `credentials` argument.
|
66
68
|
# Deprecated.
|
69
|
+
# @param [String] emulator_host Spanner emulator host. Optional.
|
70
|
+
# If the param is nil, uses the value of the `emulator_host` config.
|
67
71
|
#
|
68
72
|
# @return [Google::Cloud::Spanner::Project]
|
69
73
|
#
|
@@ -73,21 +77,29 @@ module Google
|
|
73
77
|
# spanner = Google::Cloud::Spanner.new
|
74
78
|
#
|
75
79
|
def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil,
|
76
|
-
client_config: nil, endpoint: nil, project: nil, keyfile: nil
|
80
|
+
client_config: nil, endpoint: nil, project: nil, keyfile: nil,
|
81
|
+
emulator_host: nil
|
77
82
|
project_id ||= (project || default_project_id)
|
78
83
|
scope ||= configure.scope
|
79
84
|
timeout ||= configure.timeout
|
80
85
|
client_config ||= configure.client_config
|
81
86
|
endpoint ||= configure.endpoint
|
82
87
|
credentials ||= (keyfile || default_credentials(scope: scope))
|
88
|
+
emulator_host ||= configure.emulator_host
|
83
89
|
|
84
|
-
|
85
|
-
credentials =
|
86
|
-
|
90
|
+
if emulator_host
|
91
|
+
credentials = :this_channel_is_insecure
|
92
|
+
endpoint = emulator_host
|
93
|
+
else
|
94
|
+
unless credentials.is_a? Google::Auth::Credentials
|
95
|
+
credentials = Spanner::Credentials.new credentials, scope: scope
|
96
|
+
end
|
87
97
|
|
88
|
-
|
89
|
-
|
98
|
+
if credentials.respond_to? :project_id
|
99
|
+
project_id ||= credentials.project_id
|
100
|
+
end
|
90
101
|
end
|
102
|
+
|
91
103
|
project_id = project_id.to_s # Always cast to a string
|
92
104
|
raise ArgumentError, "project_id is missing" if project_id.empty?
|
93
105
|
|
@@ -99,6 +111,8 @@ module Google
|
|
99
111
|
)
|
100
112
|
end
|
101
113
|
|
114
|
+
# rubocop:enable Metrics/MethodLength
|
115
|
+
|
102
116
|
##
|
103
117
|
# Configure the Google Cloud Spanner library.
|
104
118
|
#
|
@@ -117,6 +131,8 @@ module Google
|
|
117
131
|
# behavior of the API client.
|
118
132
|
# * `endpoint` - (String) Override of the endpoint host name, or `nil`
|
119
133
|
# to use the default endpoint.
|
134
|
+
# * `emulator_host` - (String) Host name of the emulator. Defaults to
|
135
|
+
# `ENV["SPANNER_EMULATOR_HOST"]`.
|
120
136
|
#
|
121
137
|
# @return [Google::Cloud::Config] The configuration object the
|
122
138
|
# Google::Cloud::Spanner library uses.
|
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: 1.
|
4
|
+
version: 1.13.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:
|
12
|
+
date: 2020-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -247,6 +247,34 @@ dependencies:
|
|
247
247
|
- - "~>"
|
248
248
|
- !ruby/object:Gem::Version
|
249
249
|
version: 0.1.13
|
250
|
+
- !ruby/object:Gem::Dependency
|
251
|
+
name: grpc
|
252
|
+
requirement: !ruby/object:Gem::Requirement
|
253
|
+
requirements:
|
254
|
+
- - "~>"
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: 1.26.0
|
257
|
+
type: :development
|
258
|
+
prerelease: false
|
259
|
+
version_requirements: !ruby/object:Gem::Requirement
|
260
|
+
requirements:
|
261
|
+
- - "~>"
|
262
|
+
- !ruby/object:Gem::Version
|
263
|
+
version: 1.26.0
|
264
|
+
- !ruby/object:Gem::Dependency
|
265
|
+
name: grpc-tools
|
266
|
+
requirement: !ruby/object:Gem::Requirement
|
267
|
+
requirements:
|
268
|
+
- - "~>"
|
269
|
+
- !ruby/object:Gem::Version
|
270
|
+
version: 1.26.0
|
271
|
+
type: :development
|
272
|
+
prerelease: false
|
273
|
+
version_requirements: !ruby/object:Gem::Requirement
|
274
|
+
requirements:
|
275
|
+
- - "~>"
|
276
|
+
- !ruby/object:Gem::Version
|
277
|
+
version: 1.26.0
|
250
278
|
description: google-cloud-spanner is the official library for Google Cloud Spanner
|
251
279
|
API.
|
252
280
|
email:
|