google-cloud-bigtable 0.5.0 → 0.6.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: 75dda3fa2c76316a47a331878fc5b634c5bd5f471ec3c89ece5db2e8ce60c388
4
- data.tar.gz: dfceb7dabcb83f54c3f2bf1e30d85e3ddf13e6f490260e1dd966e52c2675b05b
3
+ metadata.gz: 9eddd8059079440d6581a1e6342310ad31127c8f27f9f34a3e18d975a6a5d699
4
+ data.tar.gz: 637a977333b83097dc2a37bf70bf08b014305ed6409c258aeae3dba74ccb5602
5
5
  SHA512:
6
- metadata.gz: 88626715dc50760d929db8819cdf6333a7faffe67153222a81dcd2d941ced9cc471912f33ed74fa04a0c629f4d351386f9ae6ca098f4d083eb24100b5120b82d
7
- data.tar.gz: 3c5c577ae655453c155fab31735312933c834984b2d2091a7950fddbec9532f71b8d395d41a3c768d4ed6bec016f07f5384c11ac547075e1cfb67ed0abaf7b51
6
+ metadata.gz: 0551601ee5fda48a466492e92a8c4c714f6fe06dde7a8cbe14c3ea6f25c8847df7afac42389cef51e414f239034dce1e93cf724087e0500ed25fb7663b0105a9
7
+ data.tar.gz: 85614a616934df1c135d279e5ed0136d2a382ce538535db1519e712e5d30942e3c75c5d69ac67918aab9568d183e74393b46652995f85568f4c602067d543c5d
@@ -1,5 +1,15 @@
1
1
  # Release History
2
2
 
3
+ ### 0.6.0 / 2019-08-23
4
+
5
+ #### Features
6
+
7
+ * Support overriding of the service endpoint
8
+
9
+ #### Documentation
10
+
11
+ * Update documentation
12
+
3
13
  ### 0.5.0 / 2019-08-05
4
14
 
5
15
  * Accept nil gc_rule arguments for column_family create/update
@@ -170,4 +170,5 @@ Google::Cloud.configure.add_config! :bigtable do |config|
170
170
  config.add_field! :client_config, nil, match: Hash
171
171
  config.add_field! :emulator_host, default_emulator,
172
172
  match: String, allow_nil: true
173
+ config.add_field! :endpoint, nil, match: String
173
174
  end
@@ -46,6 +46,8 @@ module Google
46
46
  # should already be composed with a `GRPC::Core::CallCredentials` object.
47
47
  # `Proc` will be used as an updater_proc for the gRPC channel. The proc transforms the
48
48
  # metadata for requests, generally, to give OAuth credentials.
49
+ # @param [String] endpoint Override of the endpoint host name. Optional.
50
+ # If the param is nil, uses the default endpoint.
49
51
  # @param [String] emulator_host Bigtable emulator host. Optional.
50
52
  # If the parameter is nil, uses the value of the `emulator_host` config.
51
53
  # @param scope [Array<String>]
@@ -67,49 +69,34 @@ module Google
67
69
  # require "google/cloud/bigtable"
68
70
  #
69
71
  # client = Google::Cloud::Bigtable.new
70
-
72
+ #
71
73
  def self.new \
72
74
  project_id: nil,
73
75
  credentials: nil,
74
76
  emulator_host: nil,
75
77
  scope: nil,
76
78
  client_config: nil,
79
+ endpoint: nil,
77
80
  timeout: nil
78
81
  project_id ||= default_project_id
79
82
  scope ||= configure.scope
80
83
  timeout ||= configure.timeout
81
84
  client_config ||= configure.client_config
82
85
  emulator_host ||= configure.emulator_host
86
+ endpoint ||= configure.endpoint
83
87
 
84
88
  if emulator_host
85
- project_id = project_id.to_s # Always cast to a string
86
- raise ArgumentError, "project_id is missing" if project_id.empty?
87
-
88
- return Bigtable::Project.new(
89
- Bigtable::Service.new(
90
- project_id, :this_channel_is_insecure,
91
- host: emulator_host, timeout: timeout,
92
- client_config: client_config
93
- )
94
- )
95
- end
96
-
97
- credentials ||= default_credentials(scope: scope)
98
- unless credentials.is_a? Google::Auth::Credentials
99
- credentials = Bigtable::Credentials.new credentials, scope: scope
89
+ return new_with_emulator project_id, emulator_host, timeout,
90
+ client_config
100
91
  end
101
92
 
102
- if credentials.respond_to? :project_id
103
- project_id ||= credentials.project_id
104
- end
105
- project_id = project_id.to_s # Always cast to a string
93
+ credentials = resolve_credentials credentials, scope
94
+ project_id = resolve_project_id project_id, credentials
106
95
  raise ArgumentError, "project_id is missing" if project_id.empty?
107
96
 
108
97
  service = Bigtable::Service.new(
109
- project_id,
110
- credentials,
111
- timeout: timeout,
112
- client_config: client_config
98
+ project_id, credentials,
99
+ host: endpoint, timeout: timeout, client_config: client_config
113
100
  )
114
101
  Bigtable::Project.new(service)
115
102
  end
@@ -130,59 +117,74 @@ module Google
130
117
  # * `timeout` - (Integer) Default timeout to use in requests.
131
118
  # * `client_config` - (Hash) A hash of values to override the default
132
119
  # behavior of the API client.
120
+ # * `endpoint` - (String) Override of the endpoint host name, or `nil`
121
+ # to use the default endpoint.
133
122
  #
134
123
  # @return [Google::Cloud::Config] The configuration object the
135
124
  # Google::Cloud::Bigtable library uses.
136
-
125
+ #
137
126
  def self.configure
138
127
  yield Google::Cloud.configure.bigtable if block_given?
139
128
 
140
129
  Google::Cloud.configure.bigtable
141
130
  end
142
131
 
143
- # Configure the Google Cloud Bigtable library.
144
- #
145
- # The following Bigtable configuration parameters are supported:
146
- #
147
- # * `project_id` - (String) Identifier for a Bigtable project. (The
148
- # parameter `project` is considered deprecated, but may also be used.)
149
- # * `credentials` - (String, Hash, Google::Auth::Credentials,
150
- # GRPC::Core::Channel, GRPC::Core::ChannelCredentials) The path to
151
- # the keyfile as a String, the contents of the keyfile as a Hash, or a
152
- # Google::Auth::Credentials object. (See {Bigtable::Credentials}) (The
153
- # parameter `keyfile` is considered deprecated, but may also be used.)
154
- # * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
155
- # the set of resources and operations that the connection can access.
156
- # * `timeout` - (Integer) Default timeout to use in requests.
157
- # * `client_config` - (Hash) A hash of values to override the default
158
- # behavior of the API client.
132
+ # @private
133
+ # New client given an emulator host.
159
134
  #
160
- # @return [Google::Cloud::Config] The configuration object the
161
- # Google::Cloud::Bigtable library uses.
162
-
163
- def self.configure
164
- yield Google::Cloud.configure.bigtable if block_given?
135
+ def self.new_with_emulator project_id, emulator_host, timeout,
136
+ client_config
137
+ project_id = project_id.to_s # Always cast to a string
138
+ raise ArgumentError, "project_id is missing" if project_id.empty?
165
139
 
166
- Google::Cloud.configure.bigtable
140
+ Bigtable::Project.new(
141
+ Bigtable::Service.new(
142
+ project_id, :this_channel_is_insecure,
143
+ host: emulator_host, timeout: timeout,
144
+ client_config: client_config
145
+ )
146
+ )
167
147
  end
168
148
 
169
- # @private
170
- # Default project.
149
+ # @private
150
+ # Resolve credentials
151
+ #
152
+ def self.resolve_credentials given_credentials, scope
153
+ credentials = given_credentials || default_credentials(scope: scope)
154
+ unless credentials.is_a? Google::Auth::Credentials
155
+ credentials = Bigtable::Credentials.new credentials, scope: scope
156
+ end
157
+ credentials
158
+ end
171
159
 
172
- def self.default_project_id
173
- Google::Cloud.configure.bigtable.project_id ||
174
- Google::Cloud.configure.project_id ||
175
- Google::Cloud.env.project_id
176
- end
160
+ # @private
161
+ # Resolve project.
162
+ #
163
+ def self.resolve_project_id given_project_id, credentials
164
+ project_id = given_project_id || default_project_id
165
+ if credentials.respond_to? :project_id
166
+ project_id ||= credentials.project_id
167
+ end
168
+ project_id.to_s # Always cast to a string
169
+ end
177
170
 
178
- # @private
179
- # Default credentials.
171
+ # @private
172
+ # Default project.
173
+ #
174
+ def self.default_project_id
175
+ Google::Cloud.configure.bigtable.project_id ||
176
+ Google::Cloud.configure.project_id ||
177
+ Google::Cloud.env.project_id
178
+ end
180
179
 
181
- def self.default_credentials scope: nil
182
- Google::Cloud.configure.bigtable.credentials ||
183
- Google::Cloud.configure.credentials ||
184
- Bigtable::Credentials.default(scope: scope)
185
- end
180
+ # @private
181
+ # Default credentials.
182
+ #
183
+ def self.default_credentials scope: nil
184
+ Google::Cloud.configure.bigtable.credentials ||
185
+ Google::Cloud.configure.credentials ||
186
+ Bigtable::Credentials.default(scope: scope)
187
+ end
186
188
  end
187
189
  end
188
190
  end
@@ -79,7 +79,7 @@ module Google
79
79
  # ensure that their change will be applied to the same version of the policy.
80
80
  #
81
81
  # If no `etag` is provided in the call to `setIamPolicy`, then the existing
82
- # policy is overwritten blindly.
82
+ # policy is overwritten.
83
83
  class Policy; end
84
84
 
85
85
  # Associates `members` with a `role`.
@@ -99,7 +99,7 @@ module Google
99
99
  # who is authenticated with a Google account or a service account.
100
100
  #
101
101
  # * `user:{emailid}`: An email address that represents a specific Google
102
- # account. For example, `alice@gmail.com` .
102
+ # account. For example, `alice@example.com` .
103
103
  #
104
104
  #
105
105
  # * `serviceAccount:{emailid}`: An email address that represents a service
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigtable
19
- VERSION = "0.5.0".freeze
19
+ VERSION = "0.6.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-bigtable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-05 00:00:00.000000000 Z
11
+ date: 2019-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-gax