google-cloud-bigquery-storage-v1 1.9.0 → 1.10.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.
@@ -0,0 +1,694 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/bigquery/storage/v1/storage_pb"
21
+ require "google/cloud/bigquery/storage/v1/big_query_read/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Bigquery
26
+ module Storage
27
+ module V1
28
+ module BigQueryRead
29
+ module Rest
30
+ ##
31
+ # REST client for the BigQueryRead service.
32
+ #
33
+ # BigQuery Read API.
34
+ #
35
+ # The Read API can be used to read data from BigQuery.
36
+ #
37
+ class Client
38
+ # @private
39
+ API_VERSION = ""
40
+
41
+ # @private
42
+ DEFAULT_ENDPOINT_TEMPLATE = "bigquerystorage.$UNIVERSE_DOMAIN$"
43
+
44
+ include Paths
45
+
46
+ # @private
47
+ attr_reader :big_query_read_stub
48
+
49
+ ##
50
+ # Configure the BigQueryRead Client class.
51
+ #
52
+ # See {::Google::Cloud::Bigquery::Storage::V1::BigQueryRead::Rest::Client::Configuration}
53
+ # for a description of the configuration fields.
54
+ #
55
+ # @example
56
+ #
57
+ # # Modify the configuration for all BigQueryRead clients
58
+ # ::Google::Cloud::Bigquery::Storage::V1::BigQueryRead::Rest::Client.configure do |config|
59
+ # config.timeout = 10.0
60
+ # end
61
+ #
62
+ # @yield [config] Configure the Client client.
63
+ # @yieldparam config [Client::Configuration]
64
+ #
65
+ # @return [Client::Configuration]
66
+ #
67
+ def self.configure
68
+ @configure ||= begin
69
+ namespace = ["Google", "Cloud", "Bigquery", "Storage", "V1"]
70
+ parent_config = while namespace.any?
71
+ parent_name = namespace.join "::"
72
+ parent_const = const_get parent_name
73
+ break parent_const.configure if parent_const.respond_to? :configure
74
+ namespace.pop
75
+ end
76
+ default_config = Client::Configuration.new parent_config
77
+
78
+ default_config.rpcs.create_read_session.timeout = 600.0
79
+ default_config.rpcs.create_read_session.retry_policy = {
80
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
81
+ }
82
+
83
+ default_config.rpcs.read_rows.timeout = 86_400.0
84
+ default_config.rpcs.read_rows.retry_policy = {
85
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
86
+ }
87
+
88
+ default_config.rpcs.split_read_stream.timeout = 600.0
89
+ default_config.rpcs.split_read_stream.retry_policy = {
90
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
91
+ }
92
+
93
+ default_config
94
+ end
95
+ yield @configure if block_given?
96
+ @configure
97
+ end
98
+
99
+ ##
100
+ # Configure the BigQueryRead Client instance.
101
+ #
102
+ # The configuration is set to the derived mode, meaning that values can be changed,
103
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
104
+ # should be made on {Client.configure}.
105
+ #
106
+ # See {::Google::Cloud::Bigquery::Storage::V1::BigQueryRead::Rest::Client::Configuration}
107
+ # for a description of the configuration fields.
108
+ #
109
+ # @yield [config] Configure the Client client.
110
+ # @yieldparam config [Client::Configuration]
111
+ #
112
+ # @return [Client::Configuration]
113
+ #
114
+ def configure
115
+ yield @config if block_given?
116
+ @config
117
+ end
118
+
119
+ ##
120
+ # The effective universe domain
121
+ #
122
+ # @return [String]
123
+ #
124
+ def universe_domain
125
+ @big_query_read_stub.universe_domain
126
+ end
127
+
128
+ ##
129
+ # Create a new BigQueryRead REST client object.
130
+ #
131
+ # @example
132
+ #
133
+ # # Create a client using the default configuration
134
+ # client = ::Google::Cloud::Bigquery::Storage::V1::BigQueryRead::Rest::Client.new
135
+ #
136
+ # # Create a client using a custom configuration
137
+ # client = ::Google::Cloud::Bigquery::Storage::V1::BigQueryRead::Rest::Client.new do |config|
138
+ # config.timeout = 10.0
139
+ # end
140
+ #
141
+ # @yield [config] Configure the BigQueryRead client.
142
+ # @yieldparam config [Client::Configuration]
143
+ #
144
+ def initialize
145
+ # Create the configuration object
146
+ @config = Configuration.new Client.configure
147
+
148
+ # Yield the configuration if needed
149
+ yield @config if block_given?
150
+
151
+ # Create credentials
152
+ credentials = @config.credentials
153
+ # Use self-signed JWT if the endpoint is unchanged from default,
154
+ # but only if the default endpoint does not have a region prefix.
155
+ enable_self_signed_jwt = @config.endpoint.nil? ||
156
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
157
+ !@config.endpoint.split(".").first.include?("-"))
158
+ credentials ||= Credentials.default scope: @config.scope,
159
+ enable_self_signed_jwt: enable_self_signed_jwt
160
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
161
+ credentials = Credentials.new credentials, scope: @config.scope
162
+ end
163
+
164
+ @quota_project_id = @config.quota_project
165
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
166
+
167
+ @big_query_read_stub = ::Google::Cloud::Bigquery::Storage::V1::BigQueryRead::Rest::ServiceStub.new(
168
+ endpoint: @config.endpoint,
169
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
170
+ universe_domain: @config.universe_domain,
171
+ credentials: credentials,
172
+ logger: @config.logger
173
+ )
174
+
175
+ @big_query_read_stub.logger(stub: true)&.info do |entry|
176
+ entry.set_system_name
177
+ entry.set_service
178
+ entry.message = "Created client for #{entry.service}"
179
+ entry.set_credentials_fields credentials
180
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
181
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
182
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
183
+ end
184
+ end
185
+
186
+ ##
187
+ # The logger used for request/response debug logging.
188
+ #
189
+ # @return [Logger]
190
+ #
191
+ def logger
192
+ @big_query_read_stub.logger
193
+ end
194
+
195
+ # Service calls
196
+
197
+ ##
198
+ # Creates a new read session. A read session divides the contents of a
199
+ # BigQuery table into one or more streams, which can then be used to read
200
+ # data from the table. The read session also specifies properties of the
201
+ # data to be read, such as a list of columns or a push-down filter describing
202
+ # the rows to be returned.
203
+ #
204
+ # A particular row can be read by at most one stream. When the caller has
205
+ # reached the end of each stream in the session, then all the data in the
206
+ # table has been read.
207
+ #
208
+ # Data is assigned to each stream such that roughly the same number of
209
+ # rows can be read from each stream. Because the server-side unit for
210
+ # assigning data is collections of rows, the API does not guarantee that
211
+ # each stream will return the same number or rows. Additionally, the
212
+ # limits are enforced based on the number of pre-filtered rows, so some
213
+ # filters can lead to lopsided assignments.
214
+ #
215
+ # Read sessions automatically expire 6 hours after they are created and do
216
+ # not require manual clean-up by the caller.
217
+ #
218
+ # @overload create_read_session(request, options = nil)
219
+ # Pass arguments to `create_read_session` via a request object, either of type
220
+ # {::Google::Cloud::Bigquery::Storage::V1::CreateReadSessionRequest} or an equivalent Hash.
221
+ #
222
+ # @param request [::Google::Cloud::Bigquery::Storage::V1::CreateReadSessionRequest, ::Hash]
223
+ # A request object representing the call parameters. Required. To specify no
224
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
225
+ # @param options [::Gapic::CallOptions, ::Hash]
226
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
227
+ #
228
+ # @overload create_read_session(parent: nil, read_session: nil, max_stream_count: nil, preferred_min_stream_count: nil)
229
+ # Pass arguments to `create_read_session` via keyword arguments. Note that at
230
+ # least one keyword argument is required. To specify no parameters, or to keep all
231
+ # the default parameter values, pass an empty Hash as a request object (see above).
232
+ #
233
+ # @param parent [::String]
234
+ # Required. The request project that owns the session, in the form of
235
+ # `projects/{project_id}`.
236
+ # @param read_session [::Google::Cloud::Bigquery::Storage::V1::ReadSession, ::Hash]
237
+ # Required. Session to be created.
238
+ # @param max_stream_count [::Integer]
239
+ # Max initial number of streams. If unset or zero, the server will
240
+ # provide a value of streams so as to produce reasonable throughput. Must be
241
+ # non-negative. The number of streams may be lower than the requested number,
242
+ # depending on the amount parallelism that is reasonable for the table.
243
+ # There is a default system max limit of 1,000.
244
+ #
245
+ # This must be greater than or equal to preferred_min_stream_count.
246
+ # Typically, clients should either leave this unset to let the system to
247
+ # determine an upper bound OR set this a size for the maximum "units of work"
248
+ # it can gracefully handle.
249
+ # @param preferred_min_stream_count [::Integer]
250
+ # The minimum preferred stream count. This parameter can be used to inform
251
+ # the service that there is a desired lower bound on the number of streams.
252
+ # This is typically a target parallelism of the client (e.g. a Spark
253
+ # cluster with N-workers would set this to a low multiple of N to ensure
254
+ # good cluster utilization).
255
+ #
256
+ # The system will make a best effort to provide at least this number of
257
+ # streams, but in some cases might provide less.
258
+ # @yield [result, operation] Access the result along with the TransportOperation object
259
+ # @yieldparam result [::Google::Cloud::Bigquery::Storage::V1::ReadSession]
260
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
261
+ #
262
+ # @return [::Google::Cloud::Bigquery::Storage::V1::ReadSession]
263
+ #
264
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
265
+ #
266
+ # @example Basic example
267
+ # require "google/cloud/bigquery/storage/v1"
268
+ #
269
+ # # Create a client object. The client can be reused for multiple calls.
270
+ # client = Google::Cloud::Bigquery::Storage::V1::BigQueryRead::Rest::Client.new
271
+ #
272
+ # # Create a request. To set request fields, pass in keyword arguments.
273
+ # request = Google::Cloud::Bigquery::Storage::V1::CreateReadSessionRequest.new
274
+ #
275
+ # # Call the create_read_session method.
276
+ # result = client.create_read_session request
277
+ #
278
+ # # The returned object is of type Google::Cloud::Bigquery::Storage::V1::ReadSession.
279
+ # p result
280
+ #
281
+ def create_read_session request, options = nil
282
+ raise ::ArgumentError, "request must be provided" if request.nil?
283
+
284
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Storage::V1::CreateReadSessionRequest
285
+
286
+ # Converts hash and nil to an options object
287
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
288
+
289
+ # Customize the options with defaults
290
+ call_metadata = @config.rpcs.create_read_session.metadata.to_h
291
+
292
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
293
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
294
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
295
+ gapic_version: ::Google::Cloud::Bigquery::Storage::V1::VERSION,
296
+ transports_version_send: [:rest]
297
+
298
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
299
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
300
+
301
+ options.apply_defaults timeout: @config.rpcs.create_read_session.timeout,
302
+ metadata: call_metadata,
303
+ retry_policy: @config.rpcs.create_read_session.retry_policy
304
+
305
+ options.apply_defaults timeout: @config.timeout,
306
+ metadata: @config.metadata,
307
+ retry_policy: @config.retry_policy
308
+
309
+ @big_query_read_stub.create_read_session request, options do |result, operation|
310
+ yield result, operation if block_given?
311
+ end
312
+ rescue ::Gapic::Rest::Error => e
313
+ raise ::Google::Cloud::Error.from_error(e)
314
+ end
315
+
316
+ ##
317
+ # Reads rows from the stream in the format prescribed by the ReadSession.
318
+ # Each response contains one or more table rows, up to a maximum of 128 MB
319
+ # per response; read requests which attempt to read individual rows larger
320
+ # than 128 MB will fail.
321
+ #
322
+ # Each request also returns a set of stream statistics reflecting the current
323
+ # state of the stream.
324
+ #
325
+ # @overload read_rows(request, options = nil)
326
+ # Pass arguments to `read_rows` via a request object, either of type
327
+ # {::Google::Cloud::Bigquery::Storage::V1::ReadRowsRequest} or an equivalent Hash.
328
+ #
329
+ # @param request [::Google::Cloud::Bigquery::Storage::V1::ReadRowsRequest, ::Hash]
330
+ # A request object representing the call parameters. Required. To specify no
331
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
332
+ # @param options [::Gapic::CallOptions, ::Hash]
333
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
334
+ #
335
+ # @overload read_rows(read_stream: nil, offset: nil, arrow_serialization_options: nil)
336
+ # Pass arguments to `read_rows` via keyword arguments. Note that at
337
+ # least one keyword argument is required. To specify no parameters, or to keep all
338
+ # the default parameter values, pass an empty Hash as a request object (see above).
339
+ #
340
+ # @param read_stream [::String]
341
+ # Required. Stream to read rows from.
342
+ # @param offset [::Integer]
343
+ # The offset requested must be less than the last row read from Read.
344
+ # Requesting a larger offset is undefined. If not specified, start reading
345
+ # from offset zero.
346
+ # @param arrow_serialization_options [::Google::Cloud::Bigquery::Storage::V1::ArrowSerializationOptions, ::Hash]
347
+ # Optional. Options specific to the Apache Arrow output format.
348
+ #
349
+ # This feature is not yet available.
350
+ # @return [::Enumerable<::Google::Cloud::Bigquery::Storage::V1::ReadRowsResponse>]
351
+ #
352
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
353
+ #
354
+ # @example Basic example
355
+ # require "google/cloud/bigquery/storage/v1"
356
+ #
357
+ # # Create a client object. The client can be reused for multiple calls.
358
+ # client = Google::Cloud::Bigquery::Storage::V1::BigQueryRead::Rest::Client.new
359
+ #
360
+ # # Create a request. To set request fields, pass in keyword arguments.
361
+ # request = Google::Cloud::Bigquery::Storage::V1::ReadRowsRequest.new
362
+ #
363
+ # # Call the read_rows method to start streaming.
364
+ # output = client.read_rows request
365
+ #
366
+ # # The returned object is a streamed enumerable yielding elements of type
367
+ # # ::Google::Cloud::Bigquery::Storage::V1::ReadRowsResponse
368
+ # output.each do |current_response|
369
+ # p current_response
370
+ # end
371
+ #
372
+ def read_rows request, options = nil
373
+ raise ::ArgumentError, "request must be provided" if request.nil?
374
+
375
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Storage::V1::ReadRowsRequest
376
+
377
+ # Converts hash and nil to an options object
378
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
379
+
380
+ # Customize the options with defaults
381
+ call_metadata = @config.rpcs.read_rows.metadata.to_h
382
+
383
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
384
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
385
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
386
+ gapic_version: ::Google::Cloud::Bigquery::Storage::V1::VERSION,
387
+ transports_version_send: [:rest]
388
+
389
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
390
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
391
+
392
+ options.apply_defaults timeout: @config.rpcs.read_rows.timeout,
393
+ metadata: call_metadata,
394
+ retry_policy: @config.rpcs.read_rows.retry_policy
395
+
396
+ options.apply_defaults timeout: @config.timeout,
397
+ metadata: @config.metadata,
398
+ retry_policy: @config.retry_policy
399
+
400
+ ::Gapic::Rest::ServerStream.new(
401
+ ::Google::Cloud::Bigquery::Storage::V1::ReadRowsResponse,
402
+ ::Gapic::Rest::ThreadedEnumerator.new do |in_q, out_q|
403
+ @big_query_read_stub.read_rows request, options do |chunk|
404
+ in_q.deq
405
+ out_q.enq chunk
406
+ end
407
+ end
408
+ )
409
+ rescue ::Gapic::Rest::Error => e
410
+ raise ::Google::Cloud::Error.from_error(e)
411
+ end
412
+
413
+ ##
414
+ # Splits a given `ReadStream` into two `ReadStream` objects. These
415
+ # `ReadStream` objects are referred to as the primary and the residual
416
+ # streams of the split. The original `ReadStream` can still be read from in
417
+ # the same manner as before. Both of the returned `ReadStream` objects can
418
+ # also be read from, and the rows returned by both child streams will be
419
+ # the same as the rows read from the original stream.
420
+ #
421
+ # Moreover, the two child streams will be allocated back-to-back in the
422
+ # original `ReadStream`. Concretely, it is guaranteed that for streams
423
+ # original, primary, and residual, that original[0-j] = primary[0-j] and
424
+ # original[j-n] = residual[0-m] once the streams have been read to
425
+ # completion.
426
+ #
427
+ # @overload split_read_stream(request, options = nil)
428
+ # Pass arguments to `split_read_stream` via a request object, either of type
429
+ # {::Google::Cloud::Bigquery::Storage::V1::SplitReadStreamRequest} or an equivalent Hash.
430
+ #
431
+ # @param request [::Google::Cloud::Bigquery::Storage::V1::SplitReadStreamRequest, ::Hash]
432
+ # A request object representing the call parameters. Required. To specify no
433
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
434
+ # @param options [::Gapic::CallOptions, ::Hash]
435
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
436
+ #
437
+ # @overload split_read_stream(name: nil, fraction: nil)
438
+ # Pass arguments to `split_read_stream` via keyword arguments. Note that at
439
+ # least one keyword argument is required. To specify no parameters, or to keep all
440
+ # the default parameter values, pass an empty Hash as a request object (see above).
441
+ #
442
+ # @param name [::String]
443
+ # Required. Name of the stream to split.
444
+ # @param fraction [::Float]
445
+ # A value in the range (0.0, 1.0) that specifies the fractional point at
446
+ # which the original stream should be split. The actual split point is
447
+ # evaluated on pre-filtered rows, so if a filter is provided, then there is
448
+ # no guarantee that the division of the rows between the new child streams
449
+ # will be proportional to this fractional value. Additionally, because the
450
+ # server-side unit for assigning data is collections of rows, this fraction
451
+ # will always map to a data storage boundary on the server side.
452
+ # @yield [result, operation] Access the result along with the TransportOperation object
453
+ # @yieldparam result [::Google::Cloud::Bigquery::Storage::V1::SplitReadStreamResponse]
454
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
455
+ #
456
+ # @return [::Google::Cloud::Bigquery::Storage::V1::SplitReadStreamResponse]
457
+ #
458
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
459
+ #
460
+ # @example Basic example
461
+ # require "google/cloud/bigquery/storage/v1"
462
+ #
463
+ # # Create a client object. The client can be reused for multiple calls.
464
+ # client = Google::Cloud::Bigquery::Storage::V1::BigQueryRead::Rest::Client.new
465
+ #
466
+ # # Create a request. To set request fields, pass in keyword arguments.
467
+ # request = Google::Cloud::Bigquery::Storage::V1::SplitReadStreamRequest.new
468
+ #
469
+ # # Call the split_read_stream method.
470
+ # result = client.split_read_stream request
471
+ #
472
+ # # The returned object is of type Google::Cloud::Bigquery::Storage::V1::SplitReadStreamResponse.
473
+ # p result
474
+ #
475
+ def split_read_stream request, options = nil
476
+ raise ::ArgumentError, "request must be provided" if request.nil?
477
+
478
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Storage::V1::SplitReadStreamRequest
479
+
480
+ # Converts hash and nil to an options object
481
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
482
+
483
+ # Customize the options with defaults
484
+ call_metadata = @config.rpcs.split_read_stream.metadata.to_h
485
+
486
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
487
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
488
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
489
+ gapic_version: ::Google::Cloud::Bigquery::Storage::V1::VERSION,
490
+ transports_version_send: [:rest]
491
+
492
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
493
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
494
+
495
+ options.apply_defaults timeout: @config.rpcs.split_read_stream.timeout,
496
+ metadata: call_metadata,
497
+ retry_policy: @config.rpcs.split_read_stream.retry_policy
498
+
499
+ options.apply_defaults timeout: @config.timeout,
500
+ metadata: @config.metadata,
501
+ retry_policy: @config.retry_policy
502
+
503
+ @big_query_read_stub.split_read_stream request, options do |result, operation|
504
+ yield result, operation if block_given?
505
+ end
506
+ rescue ::Gapic::Rest::Error => e
507
+ raise ::Google::Cloud::Error.from_error(e)
508
+ end
509
+
510
+ ##
511
+ # Configuration class for the BigQueryRead REST API.
512
+ #
513
+ # This class represents the configuration for BigQueryRead REST,
514
+ # providing control over timeouts, retry behavior, logging, transport
515
+ # parameters, and other low-level controls. Certain parameters can also be
516
+ # applied individually to specific RPCs. See
517
+ # {::Google::Cloud::Bigquery::Storage::V1::BigQueryRead::Rest::Client::Configuration::Rpcs}
518
+ # for a list of RPCs that can be configured independently.
519
+ #
520
+ # Configuration can be applied globally to all clients, or to a single client
521
+ # on construction.
522
+ #
523
+ # @example
524
+ #
525
+ # # Modify the global config, setting the timeout for
526
+ # # create_read_session to 20 seconds,
527
+ # # and all remaining timeouts to 10 seconds.
528
+ # ::Google::Cloud::Bigquery::Storage::V1::BigQueryRead::Rest::Client.configure do |config|
529
+ # config.timeout = 10.0
530
+ # config.rpcs.create_read_session.timeout = 20.0
531
+ # end
532
+ #
533
+ # # Apply the above configuration only to a new client.
534
+ # client = ::Google::Cloud::Bigquery::Storage::V1::BigQueryRead::Rest::Client.new do |config|
535
+ # config.timeout = 10.0
536
+ # config.rpcs.create_read_session.timeout = 20.0
537
+ # end
538
+ #
539
+ # @!attribute [rw] endpoint
540
+ # A custom service endpoint, as a hostname or hostname:port. The default is
541
+ # nil, indicating to use the default endpoint in the current universe domain.
542
+ # @return [::String,nil]
543
+ # @!attribute [rw] credentials
544
+ # Credentials to send with calls. You may provide any of the following types:
545
+ # * (`String`) The path to a service account key file in JSON format
546
+ # * (`Hash`) A service account key as a Hash
547
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
548
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
549
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
550
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
551
+ # * (`nil`) indicating no credentials
552
+ #
553
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
554
+ # external source for authentication to Google Cloud, you must validate it before
555
+ # providing it to a Google API client library. Providing an unvalidated credential
556
+ # configuration to Google APIs can compromise the security of your systems and data.
557
+ # For more information, refer to [Validate credential configurations from external
558
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
559
+ # @return [::Object]
560
+ # @!attribute [rw] scope
561
+ # The OAuth scopes
562
+ # @return [::Array<::String>]
563
+ # @!attribute [rw] lib_name
564
+ # The library name as recorded in instrumentation and logging
565
+ # @return [::String]
566
+ # @!attribute [rw] lib_version
567
+ # The library version as recorded in instrumentation and logging
568
+ # @return [::String]
569
+ # @!attribute [rw] timeout
570
+ # The call timeout in seconds.
571
+ # @return [::Numeric]
572
+ # @!attribute [rw] metadata
573
+ # Additional headers to be sent with the call.
574
+ # @return [::Hash{::Symbol=>::String}]
575
+ # @!attribute [rw] retry_policy
576
+ # The retry policy. The value is a hash with the following keys:
577
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
578
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
579
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
580
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
581
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
582
+ # trigger a retry.
583
+ # @return [::Hash]
584
+ # @!attribute [rw] quota_project
585
+ # A separate project against which to charge quota.
586
+ # @return [::String]
587
+ # @!attribute [rw] universe_domain
588
+ # The universe domain within which to make requests. This determines the
589
+ # default endpoint URL. The default value of nil uses the environment
590
+ # universe (usually the default "googleapis.com" universe).
591
+ # @return [::String,nil]
592
+ # @!attribute [rw] logger
593
+ # A custom logger to use for request/response debug logging, or the value
594
+ # `:default` (the default) to construct a default logger, or `nil` to
595
+ # explicitly disable logging.
596
+ # @return [::Logger,:default,nil]
597
+ #
598
+ class Configuration
599
+ extend ::Gapic::Config
600
+
601
+ # @private
602
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
603
+ DEFAULT_ENDPOINT = "bigquerystorage.googleapis.com"
604
+
605
+ config_attr :endpoint, nil, ::String, nil
606
+ config_attr :credentials, nil do |value|
607
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
608
+ allowed.any? { |klass| klass === value }
609
+ end
610
+ config_attr :scope, nil, ::String, ::Array, nil
611
+ config_attr :lib_name, nil, ::String, nil
612
+ config_attr :lib_version, nil, ::String, nil
613
+ config_attr :timeout, nil, ::Numeric, nil
614
+ config_attr :metadata, nil, ::Hash, nil
615
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
616
+ config_attr :quota_project, nil, ::String, nil
617
+ config_attr :universe_domain, nil, ::String, nil
618
+ config_attr :logger, :default, ::Logger, nil, :default
619
+
620
+ # @private
621
+ def initialize parent_config = nil
622
+ @parent_config = parent_config unless parent_config.nil?
623
+
624
+ yield self if block_given?
625
+ end
626
+
627
+ ##
628
+ # Configurations for individual RPCs
629
+ # @return [Rpcs]
630
+ #
631
+ def rpcs
632
+ @rpcs ||= begin
633
+ parent_rpcs = nil
634
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
635
+ Rpcs.new parent_rpcs
636
+ end
637
+ end
638
+
639
+ ##
640
+ # Configuration RPC class for the BigQueryRead API.
641
+ #
642
+ # Includes fields providing the configuration for each RPC in this service.
643
+ # Each configuration object is of type `Gapic::Config::Method` and includes
644
+ # the following configuration fields:
645
+ #
646
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
647
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
648
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
649
+ # include the following keys:
650
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
651
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
652
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
653
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
654
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
655
+ # trigger a retry.
656
+ #
657
+ class Rpcs
658
+ ##
659
+ # RPC-specific configuration for `create_read_session`
660
+ # @return [::Gapic::Config::Method]
661
+ #
662
+ attr_reader :create_read_session
663
+ ##
664
+ # RPC-specific configuration for `read_rows`
665
+ # @return [::Gapic::Config::Method]
666
+ #
667
+ attr_reader :read_rows
668
+ ##
669
+ # RPC-specific configuration for `split_read_stream`
670
+ # @return [::Gapic::Config::Method]
671
+ #
672
+ attr_reader :split_read_stream
673
+
674
+ # @private
675
+ def initialize parent_rpcs = nil
676
+ create_read_session_config = parent_rpcs.create_read_session if parent_rpcs.respond_to? :create_read_session
677
+ @create_read_session = ::Gapic::Config::Method.new create_read_session_config
678
+ read_rows_config = parent_rpcs.read_rows if parent_rpcs.respond_to? :read_rows
679
+ @read_rows = ::Gapic::Config::Method.new read_rows_config
680
+ split_read_stream_config = parent_rpcs.split_read_stream if parent_rpcs.respond_to? :split_read_stream
681
+ @split_read_stream = ::Gapic::Config::Method.new split_read_stream_config
682
+
683
+ yield self if block_given?
684
+ end
685
+ end
686
+ end
687
+ end
688
+ end
689
+ end
690
+ end
691
+ end
692
+ end
693
+ end
694
+ end