google-cloud-bigquery-storage-v1 1.8.1 → 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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/google/cloud/bigquery/storage/v1/big_query_read/client.rb +6 -2
- data/lib/google/cloud/bigquery/storage/v1/big_query_read/credentials.rb +1 -1
- data/lib/google/cloud/bigquery/storage/v1/big_query_read/paths.rb +1 -1
- data/lib/google/cloud/bigquery/storage/v1/big_query_read/rest/client.rb +694 -0
- data/lib/google/cloud/bigquery/storage/v1/big_query_read/rest/service_stub.rb +261 -0
- data/lib/google/cloud/bigquery/storage/v1/big_query_read/rest.rb +56 -0
- data/lib/google/cloud/bigquery/storage/v1/big_query_read.rb +7 -1
- data/lib/google/cloud/bigquery/storage/v1/big_query_write/client.rb +1 -1
- data/lib/google/cloud/bigquery/storage/v1/big_query_write/credentials.rb +1 -1
- data/lib/google/cloud/bigquery/storage/v1/big_query_write/paths.rb +1 -1
- data/lib/google/cloud/bigquery/storage/v1/big_query_write/rest/client.rb +830 -0
- data/lib/google/cloud/bigquery/storage/v1/big_query_write/rest/service_stub.rb +392 -0
- data/lib/google/cloud/bigquery/storage/v1/big_query_write/rest.rb +59 -0
- data/lib/google/cloud/bigquery/storage/v1/big_query_write.rb +7 -1
- data/lib/google/cloud/bigquery/storage/v1/rest.rb +40 -0
- data/lib/google/cloud/bigquery/storage/v1/storage_pb.rb +4 -1
- data/lib/google/cloud/bigquery/storage/v1/storage_services_pb.rb +1 -1
- data/lib/google/cloud/bigquery/storage/v1/stream_pb.rb +1 -1
- data/lib/google/cloud/bigquery/storage/v1/table_pb.rb +1 -1
- data/lib/google/cloud/bigquery/storage/v1/version.rb +1 -1
- data/lib/google/cloud/bigquery/storage/v1.rb +6 -1
- data/lib/google-cloud-bigquery-storage-v1.rb +1 -1
- data/proto_docs/google/api/client.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +1 -1
- data/proto_docs/google/api/launch_stage.rb +1 -1
- data/proto_docs/google/api/resource.rb +1 -1
- data/proto_docs/google/cloud/bigquery/storage/v1/arrow.rb +1 -1
- data/proto_docs/google/cloud/bigquery/storage/v1/avro.rb +1 -1
- data/proto_docs/google/cloud/bigquery/storage/v1/protobuf.rb +1 -1
- data/proto_docs/google/cloud/bigquery/storage/v1/storage.rb +81 -2
- data/proto_docs/google/cloud/bigquery/storage/v1/stream.rb +1 -1
- data/proto_docs/google/cloud/bigquery/storage/v1/table.rb +1 -1
- data/proto_docs/google/protobuf/any.rb +1 -1
- data/proto_docs/google/protobuf/duration.rb +1 -1
- data/proto_docs/google/protobuf/timestamp.rb +8 -7
- data/proto_docs/google/protobuf/wrappers.rb +1 -1
- data/proto_docs/google/rpc/status.rb +1 -1
- metadata +13 -6
|
@@ -0,0 +1,830 @@
|
|
|
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_write/rest/service_stub"
|
|
22
|
+
|
|
23
|
+
module Google
|
|
24
|
+
module Cloud
|
|
25
|
+
module Bigquery
|
|
26
|
+
module Storage
|
|
27
|
+
module V1
|
|
28
|
+
module BigQueryWrite
|
|
29
|
+
module Rest
|
|
30
|
+
##
|
|
31
|
+
# REST client for the BigQueryWrite service.
|
|
32
|
+
#
|
|
33
|
+
# BigQuery Write API.
|
|
34
|
+
#
|
|
35
|
+
# The Write API can be used to write data to BigQuery.
|
|
36
|
+
#
|
|
37
|
+
# For supplementary information about the Write API, see:
|
|
38
|
+
# https://cloud.google.com/bigquery/docs/write-api
|
|
39
|
+
#
|
|
40
|
+
class Client
|
|
41
|
+
# @private
|
|
42
|
+
API_VERSION = ""
|
|
43
|
+
|
|
44
|
+
# @private
|
|
45
|
+
DEFAULT_ENDPOINT_TEMPLATE = "bigquerystorage.$UNIVERSE_DOMAIN$"
|
|
46
|
+
|
|
47
|
+
include Paths
|
|
48
|
+
|
|
49
|
+
# @private
|
|
50
|
+
attr_reader :big_query_write_stub
|
|
51
|
+
|
|
52
|
+
##
|
|
53
|
+
# Configure the BigQueryWrite Client class.
|
|
54
|
+
#
|
|
55
|
+
# See {::Google::Cloud::Bigquery::Storage::V1::BigQueryWrite::Rest::Client::Configuration}
|
|
56
|
+
# for a description of the configuration fields.
|
|
57
|
+
#
|
|
58
|
+
# @example
|
|
59
|
+
#
|
|
60
|
+
# # Modify the configuration for all BigQueryWrite clients
|
|
61
|
+
# ::Google::Cloud::Bigquery::Storage::V1::BigQueryWrite::Rest::Client.configure do |config|
|
|
62
|
+
# config.timeout = 10.0
|
|
63
|
+
# end
|
|
64
|
+
#
|
|
65
|
+
# @yield [config] Configure the Client client.
|
|
66
|
+
# @yieldparam config [Client::Configuration]
|
|
67
|
+
#
|
|
68
|
+
# @return [Client::Configuration]
|
|
69
|
+
#
|
|
70
|
+
def self.configure
|
|
71
|
+
@configure ||= begin
|
|
72
|
+
namespace = ["Google", "Cloud", "Bigquery", "Storage", "V1"]
|
|
73
|
+
parent_config = while namespace.any?
|
|
74
|
+
parent_name = namespace.join "::"
|
|
75
|
+
parent_const = const_get parent_name
|
|
76
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
|
77
|
+
namespace.pop
|
|
78
|
+
end
|
|
79
|
+
default_config = Client::Configuration.new parent_config
|
|
80
|
+
|
|
81
|
+
default_config.rpcs.create_write_stream.timeout = 1200.0
|
|
82
|
+
default_config.rpcs.create_write_stream.retry_policy = {
|
|
83
|
+
initial_delay: 10.0, max_delay: 120.0, multiplier: 1.3, retry_codes: [4, 14, 8]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
default_config.rpcs.get_write_stream.timeout = 600.0
|
|
87
|
+
default_config.rpcs.get_write_stream.retry_policy = {
|
|
88
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14, 8]
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
default_config.rpcs.finalize_write_stream.timeout = 600.0
|
|
92
|
+
default_config.rpcs.finalize_write_stream.retry_policy = {
|
|
93
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14, 8]
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
default_config.rpcs.batch_commit_write_streams.timeout = 600.0
|
|
97
|
+
default_config.rpcs.batch_commit_write_streams.retry_policy = {
|
|
98
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14, 8]
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
default_config.rpcs.flush_rows.timeout = 600.0
|
|
102
|
+
default_config.rpcs.flush_rows.retry_policy = {
|
|
103
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14, 8]
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
default_config
|
|
107
|
+
end
|
|
108
|
+
yield @configure if block_given?
|
|
109
|
+
@configure
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
##
|
|
113
|
+
# Configure the BigQueryWrite Client instance.
|
|
114
|
+
#
|
|
115
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
|
116
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
117
|
+
# should be made on {Client.configure}.
|
|
118
|
+
#
|
|
119
|
+
# See {::Google::Cloud::Bigquery::Storage::V1::BigQueryWrite::Rest::Client::Configuration}
|
|
120
|
+
# for a description of the configuration fields.
|
|
121
|
+
#
|
|
122
|
+
# @yield [config] Configure the Client client.
|
|
123
|
+
# @yieldparam config [Client::Configuration]
|
|
124
|
+
#
|
|
125
|
+
# @return [Client::Configuration]
|
|
126
|
+
#
|
|
127
|
+
def configure
|
|
128
|
+
yield @config if block_given?
|
|
129
|
+
@config
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
##
|
|
133
|
+
# The effective universe domain
|
|
134
|
+
#
|
|
135
|
+
# @return [String]
|
|
136
|
+
#
|
|
137
|
+
def universe_domain
|
|
138
|
+
@big_query_write_stub.universe_domain
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
##
|
|
142
|
+
# Create a new BigQueryWrite REST client object.
|
|
143
|
+
#
|
|
144
|
+
# @example
|
|
145
|
+
#
|
|
146
|
+
# # Create a client using the default configuration
|
|
147
|
+
# client = ::Google::Cloud::Bigquery::Storage::V1::BigQueryWrite::Rest::Client.new
|
|
148
|
+
#
|
|
149
|
+
# # Create a client using a custom configuration
|
|
150
|
+
# client = ::Google::Cloud::Bigquery::Storage::V1::BigQueryWrite::Rest::Client.new do |config|
|
|
151
|
+
# config.timeout = 10.0
|
|
152
|
+
# end
|
|
153
|
+
#
|
|
154
|
+
# @yield [config] Configure the BigQueryWrite client.
|
|
155
|
+
# @yieldparam config [Client::Configuration]
|
|
156
|
+
#
|
|
157
|
+
def initialize
|
|
158
|
+
# Create the configuration object
|
|
159
|
+
@config = Configuration.new Client.configure
|
|
160
|
+
|
|
161
|
+
# Yield the configuration if needed
|
|
162
|
+
yield @config if block_given?
|
|
163
|
+
|
|
164
|
+
# Create credentials
|
|
165
|
+
credentials = @config.credentials
|
|
166
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
|
167
|
+
# but only if the default endpoint does not have a region prefix.
|
|
168
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
|
169
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
|
170
|
+
!@config.endpoint.split(".").first.include?("-"))
|
|
171
|
+
credentials ||= Credentials.default scope: @config.scope,
|
|
172
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
|
173
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
|
174
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
@quota_project_id = @config.quota_project
|
|
178
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
|
179
|
+
|
|
180
|
+
@big_query_write_stub = ::Google::Cloud::Bigquery::Storage::V1::BigQueryWrite::Rest::ServiceStub.new(
|
|
181
|
+
endpoint: @config.endpoint,
|
|
182
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
|
183
|
+
universe_domain: @config.universe_domain,
|
|
184
|
+
credentials: credentials,
|
|
185
|
+
logger: @config.logger
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
@big_query_write_stub.logger(stub: true)&.info do |entry|
|
|
189
|
+
entry.set_system_name
|
|
190
|
+
entry.set_service
|
|
191
|
+
entry.message = "Created client for #{entry.service}"
|
|
192
|
+
entry.set_credentials_fields credentials
|
|
193
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
|
194
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
|
195
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
##
|
|
200
|
+
# The logger used for request/response debug logging.
|
|
201
|
+
#
|
|
202
|
+
# @return [Logger]
|
|
203
|
+
#
|
|
204
|
+
def logger
|
|
205
|
+
@big_query_write_stub.logger
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Service calls
|
|
209
|
+
|
|
210
|
+
##
|
|
211
|
+
# Creates a write stream to the given table.
|
|
212
|
+
# Additionally, every table has a special stream named '_default'
|
|
213
|
+
# to which data can be written. This stream doesn't need to be created using
|
|
214
|
+
# CreateWriteStream. It is a stream that can be used simultaneously by any
|
|
215
|
+
# number of clients. Data written to this stream is considered committed as
|
|
216
|
+
# soon as an acknowledgement is received.
|
|
217
|
+
#
|
|
218
|
+
# @overload create_write_stream(request, options = nil)
|
|
219
|
+
# Pass arguments to `create_write_stream` via a request object, either of type
|
|
220
|
+
# {::Google::Cloud::Bigquery::Storage::V1::CreateWriteStreamRequest} or an equivalent Hash.
|
|
221
|
+
#
|
|
222
|
+
# @param request [::Google::Cloud::Bigquery::Storage::V1::CreateWriteStreamRequest, ::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_write_stream(parent: nil, write_stream: nil)
|
|
229
|
+
# Pass arguments to `create_write_stream` 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. Reference to the table to which the stream belongs, in the format
|
|
235
|
+
# of `projects/{project}/datasets/{dataset}/tables/{table}`.
|
|
236
|
+
# @param write_stream [::Google::Cloud::Bigquery::Storage::V1::WriteStream, ::Hash]
|
|
237
|
+
# Required. Stream to be created.
|
|
238
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
239
|
+
# @yieldparam result [::Google::Cloud::Bigquery::Storage::V1::WriteStream]
|
|
240
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
241
|
+
#
|
|
242
|
+
# @return [::Google::Cloud::Bigquery::Storage::V1::WriteStream]
|
|
243
|
+
#
|
|
244
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
245
|
+
#
|
|
246
|
+
# @example Basic example
|
|
247
|
+
# require "google/cloud/bigquery/storage/v1"
|
|
248
|
+
#
|
|
249
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
250
|
+
# client = Google::Cloud::Bigquery::Storage::V1::BigQueryWrite::Rest::Client.new
|
|
251
|
+
#
|
|
252
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
253
|
+
# request = Google::Cloud::Bigquery::Storage::V1::CreateWriteStreamRequest.new
|
|
254
|
+
#
|
|
255
|
+
# # Call the create_write_stream method.
|
|
256
|
+
# result = client.create_write_stream request
|
|
257
|
+
#
|
|
258
|
+
# # The returned object is of type Google::Cloud::Bigquery::Storage::V1::WriteStream.
|
|
259
|
+
# p result
|
|
260
|
+
#
|
|
261
|
+
def create_write_stream request, options = nil
|
|
262
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
263
|
+
|
|
264
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Storage::V1::CreateWriteStreamRequest
|
|
265
|
+
|
|
266
|
+
# Converts hash and nil to an options object
|
|
267
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
268
|
+
|
|
269
|
+
# Customize the options with defaults
|
|
270
|
+
call_metadata = @config.rpcs.create_write_stream.metadata.to_h
|
|
271
|
+
|
|
272
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
273
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
274
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
275
|
+
gapic_version: ::Google::Cloud::Bigquery::Storage::V1::VERSION,
|
|
276
|
+
transports_version_send: [:rest]
|
|
277
|
+
|
|
278
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
279
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
280
|
+
|
|
281
|
+
options.apply_defaults timeout: @config.rpcs.create_write_stream.timeout,
|
|
282
|
+
metadata: call_metadata,
|
|
283
|
+
retry_policy: @config.rpcs.create_write_stream.retry_policy
|
|
284
|
+
|
|
285
|
+
options.apply_defaults timeout: @config.timeout,
|
|
286
|
+
metadata: @config.metadata,
|
|
287
|
+
retry_policy: @config.retry_policy
|
|
288
|
+
|
|
289
|
+
@big_query_write_stub.create_write_stream request, options do |result, operation|
|
|
290
|
+
yield result, operation if block_given?
|
|
291
|
+
end
|
|
292
|
+
rescue ::Gapic::Rest::Error => e
|
|
293
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
##
|
|
297
|
+
# Gets information about a write stream.
|
|
298
|
+
#
|
|
299
|
+
# @overload get_write_stream(request, options = nil)
|
|
300
|
+
# Pass arguments to `get_write_stream` via a request object, either of type
|
|
301
|
+
# {::Google::Cloud::Bigquery::Storage::V1::GetWriteStreamRequest} or an equivalent Hash.
|
|
302
|
+
#
|
|
303
|
+
# @param request [::Google::Cloud::Bigquery::Storage::V1::GetWriteStreamRequest, ::Hash]
|
|
304
|
+
# A request object representing the call parameters. Required. To specify no
|
|
305
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
306
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
307
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
308
|
+
#
|
|
309
|
+
# @overload get_write_stream(name: nil, view: nil)
|
|
310
|
+
# Pass arguments to `get_write_stream` via keyword arguments. Note that at
|
|
311
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
312
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
313
|
+
#
|
|
314
|
+
# @param name [::String]
|
|
315
|
+
# Required. Name of the stream to get, in the form of
|
|
316
|
+
# `projects/{project}/datasets/{dataset}/tables/{table}/streams/{stream}`.
|
|
317
|
+
# @param view [::Google::Cloud::Bigquery::Storage::V1::WriteStreamView]
|
|
318
|
+
# Indicates whether to get full or partial view of the WriteStream. If
|
|
319
|
+
# not set, view returned will be basic.
|
|
320
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
321
|
+
# @yieldparam result [::Google::Cloud::Bigquery::Storage::V1::WriteStream]
|
|
322
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
323
|
+
#
|
|
324
|
+
# @return [::Google::Cloud::Bigquery::Storage::V1::WriteStream]
|
|
325
|
+
#
|
|
326
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
327
|
+
#
|
|
328
|
+
# @example Basic example
|
|
329
|
+
# require "google/cloud/bigquery/storage/v1"
|
|
330
|
+
#
|
|
331
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
332
|
+
# client = Google::Cloud::Bigquery::Storage::V1::BigQueryWrite::Rest::Client.new
|
|
333
|
+
#
|
|
334
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
335
|
+
# request = Google::Cloud::Bigquery::Storage::V1::GetWriteStreamRequest.new
|
|
336
|
+
#
|
|
337
|
+
# # Call the get_write_stream method.
|
|
338
|
+
# result = client.get_write_stream request
|
|
339
|
+
#
|
|
340
|
+
# # The returned object is of type Google::Cloud::Bigquery::Storage::V1::WriteStream.
|
|
341
|
+
# p result
|
|
342
|
+
#
|
|
343
|
+
def get_write_stream request, options = nil
|
|
344
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
345
|
+
|
|
346
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Storage::V1::GetWriteStreamRequest
|
|
347
|
+
|
|
348
|
+
# Converts hash and nil to an options object
|
|
349
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
350
|
+
|
|
351
|
+
# Customize the options with defaults
|
|
352
|
+
call_metadata = @config.rpcs.get_write_stream.metadata.to_h
|
|
353
|
+
|
|
354
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
355
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
356
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
357
|
+
gapic_version: ::Google::Cloud::Bigquery::Storage::V1::VERSION,
|
|
358
|
+
transports_version_send: [:rest]
|
|
359
|
+
|
|
360
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
361
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
362
|
+
|
|
363
|
+
options.apply_defaults timeout: @config.rpcs.get_write_stream.timeout,
|
|
364
|
+
metadata: call_metadata,
|
|
365
|
+
retry_policy: @config.rpcs.get_write_stream.retry_policy
|
|
366
|
+
|
|
367
|
+
options.apply_defaults timeout: @config.timeout,
|
|
368
|
+
metadata: @config.metadata,
|
|
369
|
+
retry_policy: @config.retry_policy
|
|
370
|
+
|
|
371
|
+
@big_query_write_stub.get_write_stream request, options do |result, operation|
|
|
372
|
+
yield result, operation if block_given?
|
|
373
|
+
end
|
|
374
|
+
rescue ::Gapic::Rest::Error => e
|
|
375
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
##
|
|
379
|
+
# Finalize a write stream so that no new data can be appended to the
|
|
380
|
+
# stream. Finalize is not supported on the '_default' stream.
|
|
381
|
+
#
|
|
382
|
+
# @overload finalize_write_stream(request, options = nil)
|
|
383
|
+
# Pass arguments to `finalize_write_stream` via a request object, either of type
|
|
384
|
+
# {::Google::Cloud::Bigquery::Storage::V1::FinalizeWriteStreamRequest} or an equivalent Hash.
|
|
385
|
+
#
|
|
386
|
+
# @param request [::Google::Cloud::Bigquery::Storage::V1::FinalizeWriteStreamRequest, ::Hash]
|
|
387
|
+
# A request object representing the call parameters. Required. To specify no
|
|
388
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
389
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
390
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
391
|
+
#
|
|
392
|
+
# @overload finalize_write_stream(name: nil)
|
|
393
|
+
# Pass arguments to `finalize_write_stream` via keyword arguments. Note that at
|
|
394
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
395
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
396
|
+
#
|
|
397
|
+
# @param name [::String]
|
|
398
|
+
# Required. Name of the stream to finalize, in the form of
|
|
399
|
+
# `projects/{project}/datasets/{dataset}/tables/{table}/streams/{stream}`.
|
|
400
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
401
|
+
# @yieldparam result [::Google::Cloud::Bigquery::Storage::V1::FinalizeWriteStreamResponse]
|
|
402
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
403
|
+
#
|
|
404
|
+
# @return [::Google::Cloud::Bigquery::Storage::V1::FinalizeWriteStreamResponse]
|
|
405
|
+
#
|
|
406
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
407
|
+
#
|
|
408
|
+
# @example Basic example
|
|
409
|
+
# require "google/cloud/bigquery/storage/v1"
|
|
410
|
+
#
|
|
411
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
412
|
+
# client = Google::Cloud::Bigquery::Storage::V1::BigQueryWrite::Rest::Client.new
|
|
413
|
+
#
|
|
414
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
415
|
+
# request = Google::Cloud::Bigquery::Storage::V1::FinalizeWriteStreamRequest.new
|
|
416
|
+
#
|
|
417
|
+
# # Call the finalize_write_stream method.
|
|
418
|
+
# result = client.finalize_write_stream request
|
|
419
|
+
#
|
|
420
|
+
# # The returned object is of type Google::Cloud::Bigquery::Storage::V1::FinalizeWriteStreamResponse.
|
|
421
|
+
# p result
|
|
422
|
+
#
|
|
423
|
+
def finalize_write_stream request, options = nil
|
|
424
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
425
|
+
|
|
426
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Storage::V1::FinalizeWriteStreamRequest
|
|
427
|
+
|
|
428
|
+
# Converts hash and nil to an options object
|
|
429
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
430
|
+
|
|
431
|
+
# Customize the options with defaults
|
|
432
|
+
call_metadata = @config.rpcs.finalize_write_stream.metadata.to_h
|
|
433
|
+
|
|
434
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
435
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
436
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
437
|
+
gapic_version: ::Google::Cloud::Bigquery::Storage::V1::VERSION,
|
|
438
|
+
transports_version_send: [:rest]
|
|
439
|
+
|
|
440
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
441
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
442
|
+
|
|
443
|
+
options.apply_defaults timeout: @config.rpcs.finalize_write_stream.timeout,
|
|
444
|
+
metadata: call_metadata,
|
|
445
|
+
retry_policy: @config.rpcs.finalize_write_stream.retry_policy
|
|
446
|
+
|
|
447
|
+
options.apply_defaults timeout: @config.timeout,
|
|
448
|
+
metadata: @config.metadata,
|
|
449
|
+
retry_policy: @config.retry_policy
|
|
450
|
+
|
|
451
|
+
@big_query_write_stub.finalize_write_stream request, options do |result, operation|
|
|
452
|
+
yield result, operation if block_given?
|
|
453
|
+
end
|
|
454
|
+
rescue ::Gapic::Rest::Error => e
|
|
455
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
456
|
+
end
|
|
457
|
+
|
|
458
|
+
##
|
|
459
|
+
# Atomically commits a group of `PENDING` streams that belong to the same
|
|
460
|
+
# `parent` table.
|
|
461
|
+
#
|
|
462
|
+
# Streams must be finalized before commit and cannot be committed multiple
|
|
463
|
+
# times. Once a stream is committed, data in the stream becomes available
|
|
464
|
+
# for read operations.
|
|
465
|
+
#
|
|
466
|
+
# @overload batch_commit_write_streams(request, options = nil)
|
|
467
|
+
# Pass arguments to `batch_commit_write_streams` via a request object, either of type
|
|
468
|
+
# {::Google::Cloud::Bigquery::Storage::V1::BatchCommitWriteStreamsRequest} or an equivalent Hash.
|
|
469
|
+
#
|
|
470
|
+
# @param request [::Google::Cloud::Bigquery::Storage::V1::BatchCommitWriteStreamsRequest, ::Hash]
|
|
471
|
+
# A request object representing the call parameters. Required. To specify no
|
|
472
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
473
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
474
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
475
|
+
#
|
|
476
|
+
# @overload batch_commit_write_streams(parent: nil, write_streams: nil)
|
|
477
|
+
# Pass arguments to `batch_commit_write_streams` via keyword arguments. Note that at
|
|
478
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
479
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
480
|
+
#
|
|
481
|
+
# @param parent [::String]
|
|
482
|
+
# Required. Parent table that all the streams should belong to, in the form
|
|
483
|
+
# of `projects/{project}/datasets/{dataset}/tables/{table}`.
|
|
484
|
+
# @param write_streams [::Array<::String>]
|
|
485
|
+
# Required. The group of streams that will be committed atomically.
|
|
486
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
487
|
+
# @yieldparam result [::Google::Cloud::Bigquery::Storage::V1::BatchCommitWriteStreamsResponse]
|
|
488
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
489
|
+
#
|
|
490
|
+
# @return [::Google::Cloud::Bigquery::Storage::V1::BatchCommitWriteStreamsResponse]
|
|
491
|
+
#
|
|
492
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
493
|
+
#
|
|
494
|
+
# @example Basic example
|
|
495
|
+
# require "google/cloud/bigquery/storage/v1"
|
|
496
|
+
#
|
|
497
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
498
|
+
# client = Google::Cloud::Bigquery::Storage::V1::BigQueryWrite::Rest::Client.new
|
|
499
|
+
#
|
|
500
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
501
|
+
# request = Google::Cloud::Bigquery::Storage::V1::BatchCommitWriteStreamsRequest.new
|
|
502
|
+
#
|
|
503
|
+
# # Call the batch_commit_write_streams method.
|
|
504
|
+
# result = client.batch_commit_write_streams request
|
|
505
|
+
#
|
|
506
|
+
# # The returned object is of type Google::Cloud::Bigquery::Storage::V1::BatchCommitWriteStreamsResponse.
|
|
507
|
+
# p result
|
|
508
|
+
#
|
|
509
|
+
def batch_commit_write_streams request, options = nil
|
|
510
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
511
|
+
|
|
512
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Storage::V1::BatchCommitWriteStreamsRequest
|
|
513
|
+
|
|
514
|
+
# Converts hash and nil to an options object
|
|
515
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
516
|
+
|
|
517
|
+
# Customize the options with defaults
|
|
518
|
+
call_metadata = @config.rpcs.batch_commit_write_streams.metadata.to_h
|
|
519
|
+
|
|
520
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
521
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
522
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
523
|
+
gapic_version: ::Google::Cloud::Bigquery::Storage::V1::VERSION,
|
|
524
|
+
transports_version_send: [:rest]
|
|
525
|
+
|
|
526
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
527
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
528
|
+
|
|
529
|
+
options.apply_defaults timeout: @config.rpcs.batch_commit_write_streams.timeout,
|
|
530
|
+
metadata: call_metadata,
|
|
531
|
+
retry_policy: @config.rpcs.batch_commit_write_streams.retry_policy
|
|
532
|
+
|
|
533
|
+
options.apply_defaults timeout: @config.timeout,
|
|
534
|
+
metadata: @config.metadata,
|
|
535
|
+
retry_policy: @config.retry_policy
|
|
536
|
+
|
|
537
|
+
@big_query_write_stub.batch_commit_write_streams request, options do |result, operation|
|
|
538
|
+
yield result, operation if block_given?
|
|
539
|
+
end
|
|
540
|
+
rescue ::Gapic::Rest::Error => e
|
|
541
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
542
|
+
end
|
|
543
|
+
|
|
544
|
+
##
|
|
545
|
+
# Flushes rows to a BUFFERED stream.
|
|
546
|
+
#
|
|
547
|
+
# If users are appending rows to BUFFERED stream, flush operation is
|
|
548
|
+
# required in order for the rows to become available for reading. A
|
|
549
|
+
# Flush operation flushes up to any previously flushed offset in a BUFFERED
|
|
550
|
+
# stream, to the offset specified in the request.
|
|
551
|
+
#
|
|
552
|
+
# Flush is not supported on the _default stream, since it is not BUFFERED.
|
|
553
|
+
#
|
|
554
|
+
# @overload flush_rows(request, options = nil)
|
|
555
|
+
# Pass arguments to `flush_rows` via a request object, either of type
|
|
556
|
+
# {::Google::Cloud::Bigquery::Storage::V1::FlushRowsRequest} or an equivalent Hash.
|
|
557
|
+
#
|
|
558
|
+
# @param request [::Google::Cloud::Bigquery::Storage::V1::FlushRowsRequest, ::Hash]
|
|
559
|
+
# A request object representing the call parameters. Required. To specify no
|
|
560
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
561
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
562
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
563
|
+
#
|
|
564
|
+
# @overload flush_rows(write_stream: nil, offset: nil)
|
|
565
|
+
# Pass arguments to `flush_rows` via keyword arguments. Note that at
|
|
566
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
567
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
568
|
+
#
|
|
569
|
+
# @param write_stream [::String]
|
|
570
|
+
# Required. The stream that is the target of the flush operation.
|
|
571
|
+
# @param offset [::Google::Protobuf::Int64Value, ::Hash]
|
|
572
|
+
# Ending offset of the flush operation. Rows before this offset(including
|
|
573
|
+
# this offset) will be flushed.
|
|
574
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
575
|
+
# @yieldparam result [::Google::Cloud::Bigquery::Storage::V1::FlushRowsResponse]
|
|
576
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
577
|
+
#
|
|
578
|
+
# @return [::Google::Cloud::Bigquery::Storage::V1::FlushRowsResponse]
|
|
579
|
+
#
|
|
580
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
581
|
+
#
|
|
582
|
+
# @example Basic example
|
|
583
|
+
# require "google/cloud/bigquery/storage/v1"
|
|
584
|
+
#
|
|
585
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
586
|
+
# client = Google::Cloud::Bigquery::Storage::V1::BigQueryWrite::Rest::Client.new
|
|
587
|
+
#
|
|
588
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
589
|
+
# request = Google::Cloud::Bigquery::Storage::V1::FlushRowsRequest.new
|
|
590
|
+
#
|
|
591
|
+
# # Call the flush_rows method.
|
|
592
|
+
# result = client.flush_rows request
|
|
593
|
+
#
|
|
594
|
+
# # The returned object is of type Google::Cloud::Bigquery::Storage::V1::FlushRowsResponse.
|
|
595
|
+
# p result
|
|
596
|
+
#
|
|
597
|
+
def flush_rows request, options = nil
|
|
598
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
599
|
+
|
|
600
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Storage::V1::FlushRowsRequest
|
|
601
|
+
|
|
602
|
+
# Converts hash and nil to an options object
|
|
603
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
604
|
+
|
|
605
|
+
# Customize the options with defaults
|
|
606
|
+
call_metadata = @config.rpcs.flush_rows.metadata.to_h
|
|
607
|
+
|
|
608
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
609
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
610
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
611
|
+
gapic_version: ::Google::Cloud::Bigquery::Storage::V1::VERSION,
|
|
612
|
+
transports_version_send: [:rest]
|
|
613
|
+
|
|
614
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
615
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
616
|
+
|
|
617
|
+
options.apply_defaults timeout: @config.rpcs.flush_rows.timeout,
|
|
618
|
+
metadata: call_metadata,
|
|
619
|
+
retry_policy: @config.rpcs.flush_rows.retry_policy
|
|
620
|
+
|
|
621
|
+
options.apply_defaults timeout: @config.timeout,
|
|
622
|
+
metadata: @config.metadata,
|
|
623
|
+
retry_policy: @config.retry_policy
|
|
624
|
+
|
|
625
|
+
@big_query_write_stub.flush_rows request, options do |result, operation|
|
|
626
|
+
yield result, operation if block_given?
|
|
627
|
+
end
|
|
628
|
+
rescue ::Gapic::Rest::Error => e
|
|
629
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
630
|
+
end
|
|
631
|
+
|
|
632
|
+
##
|
|
633
|
+
# Configuration class for the BigQueryWrite REST API.
|
|
634
|
+
#
|
|
635
|
+
# This class represents the configuration for BigQueryWrite REST,
|
|
636
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
637
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
638
|
+
# applied individually to specific RPCs. See
|
|
639
|
+
# {::Google::Cloud::Bigquery::Storage::V1::BigQueryWrite::Rest::Client::Configuration::Rpcs}
|
|
640
|
+
# for a list of RPCs that can be configured independently.
|
|
641
|
+
#
|
|
642
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
643
|
+
# on construction.
|
|
644
|
+
#
|
|
645
|
+
# @example
|
|
646
|
+
#
|
|
647
|
+
# # Modify the global config, setting the timeout for
|
|
648
|
+
# # create_write_stream to 20 seconds,
|
|
649
|
+
# # and all remaining timeouts to 10 seconds.
|
|
650
|
+
# ::Google::Cloud::Bigquery::Storage::V1::BigQueryWrite::Rest::Client.configure do |config|
|
|
651
|
+
# config.timeout = 10.0
|
|
652
|
+
# config.rpcs.create_write_stream.timeout = 20.0
|
|
653
|
+
# end
|
|
654
|
+
#
|
|
655
|
+
# # Apply the above configuration only to a new client.
|
|
656
|
+
# client = ::Google::Cloud::Bigquery::Storage::V1::BigQueryWrite::Rest::Client.new do |config|
|
|
657
|
+
# config.timeout = 10.0
|
|
658
|
+
# config.rpcs.create_write_stream.timeout = 20.0
|
|
659
|
+
# end
|
|
660
|
+
#
|
|
661
|
+
# @!attribute [rw] endpoint
|
|
662
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
|
663
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
|
664
|
+
# @return [::String,nil]
|
|
665
|
+
# @!attribute [rw] credentials
|
|
666
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
667
|
+
# * (`String`) The path to a service account key file in JSON format
|
|
668
|
+
# * (`Hash`) A service account key as a Hash
|
|
669
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
670
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
671
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
672
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
673
|
+
# * (`nil`) indicating no credentials
|
|
674
|
+
#
|
|
675
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
|
676
|
+
# external source for authentication to Google Cloud, you must validate it before
|
|
677
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
|
678
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
|
679
|
+
# For more information, refer to [Validate credential configurations from external
|
|
680
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
|
681
|
+
# @return [::Object]
|
|
682
|
+
# @!attribute [rw] scope
|
|
683
|
+
# The OAuth scopes
|
|
684
|
+
# @return [::Array<::String>]
|
|
685
|
+
# @!attribute [rw] lib_name
|
|
686
|
+
# The library name as recorded in instrumentation and logging
|
|
687
|
+
# @return [::String]
|
|
688
|
+
# @!attribute [rw] lib_version
|
|
689
|
+
# The library version as recorded in instrumentation and logging
|
|
690
|
+
# @return [::String]
|
|
691
|
+
# @!attribute [rw] timeout
|
|
692
|
+
# The call timeout in seconds.
|
|
693
|
+
# @return [::Numeric]
|
|
694
|
+
# @!attribute [rw] metadata
|
|
695
|
+
# Additional headers to be sent with the call.
|
|
696
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
697
|
+
# @!attribute [rw] retry_policy
|
|
698
|
+
# The retry policy. The value is a hash with the following keys:
|
|
699
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
700
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
701
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
702
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
703
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
704
|
+
# trigger a retry.
|
|
705
|
+
# @return [::Hash]
|
|
706
|
+
# @!attribute [rw] quota_project
|
|
707
|
+
# A separate project against which to charge quota.
|
|
708
|
+
# @return [::String]
|
|
709
|
+
# @!attribute [rw] universe_domain
|
|
710
|
+
# The universe domain within which to make requests. This determines the
|
|
711
|
+
# default endpoint URL. The default value of nil uses the environment
|
|
712
|
+
# universe (usually the default "googleapis.com" universe).
|
|
713
|
+
# @return [::String,nil]
|
|
714
|
+
# @!attribute [rw] logger
|
|
715
|
+
# A custom logger to use for request/response debug logging, or the value
|
|
716
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
|
717
|
+
# explicitly disable logging.
|
|
718
|
+
# @return [::Logger,:default,nil]
|
|
719
|
+
#
|
|
720
|
+
class Configuration
|
|
721
|
+
extend ::Gapic::Config
|
|
722
|
+
|
|
723
|
+
# @private
|
|
724
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
|
725
|
+
DEFAULT_ENDPOINT = "bigquerystorage.googleapis.com"
|
|
726
|
+
|
|
727
|
+
config_attr :endpoint, nil, ::String, nil
|
|
728
|
+
config_attr :credentials, nil do |value|
|
|
729
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
|
730
|
+
allowed.any? { |klass| klass === value }
|
|
731
|
+
end
|
|
732
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
733
|
+
config_attr :lib_name, nil, ::String, nil
|
|
734
|
+
config_attr :lib_version, nil, ::String, nil
|
|
735
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
736
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
737
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
738
|
+
config_attr :quota_project, nil, ::String, nil
|
|
739
|
+
config_attr :universe_domain, nil, ::String, nil
|
|
740
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
|
741
|
+
|
|
742
|
+
# @private
|
|
743
|
+
def initialize parent_config = nil
|
|
744
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
745
|
+
|
|
746
|
+
yield self if block_given?
|
|
747
|
+
end
|
|
748
|
+
|
|
749
|
+
##
|
|
750
|
+
# Configurations for individual RPCs
|
|
751
|
+
# @return [Rpcs]
|
|
752
|
+
#
|
|
753
|
+
def rpcs
|
|
754
|
+
@rpcs ||= begin
|
|
755
|
+
parent_rpcs = nil
|
|
756
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
757
|
+
Rpcs.new parent_rpcs
|
|
758
|
+
end
|
|
759
|
+
end
|
|
760
|
+
|
|
761
|
+
##
|
|
762
|
+
# Configuration RPC class for the BigQueryWrite API.
|
|
763
|
+
#
|
|
764
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
765
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
766
|
+
# the following configuration fields:
|
|
767
|
+
#
|
|
768
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
769
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
|
770
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
771
|
+
# include the following keys:
|
|
772
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
773
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
774
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
775
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
776
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
777
|
+
# trigger a retry.
|
|
778
|
+
#
|
|
779
|
+
class Rpcs
|
|
780
|
+
##
|
|
781
|
+
# RPC-specific configuration for `create_write_stream`
|
|
782
|
+
# @return [::Gapic::Config::Method]
|
|
783
|
+
#
|
|
784
|
+
attr_reader :create_write_stream
|
|
785
|
+
##
|
|
786
|
+
# RPC-specific configuration for `get_write_stream`
|
|
787
|
+
# @return [::Gapic::Config::Method]
|
|
788
|
+
#
|
|
789
|
+
attr_reader :get_write_stream
|
|
790
|
+
##
|
|
791
|
+
# RPC-specific configuration for `finalize_write_stream`
|
|
792
|
+
# @return [::Gapic::Config::Method]
|
|
793
|
+
#
|
|
794
|
+
attr_reader :finalize_write_stream
|
|
795
|
+
##
|
|
796
|
+
# RPC-specific configuration for `batch_commit_write_streams`
|
|
797
|
+
# @return [::Gapic::Config::Method]
|
|
798
|
+
#
|
|
799
|
+
attr_reader :batch_commit_write_streams
|
|
800
|
+
##
|
|
801
|
+
# RPC-specific configuration for `flush_rows`
|
|
802
|
+
# @return [::Gapic::Config::Method]
|
|
803
|
+
#
|
|
804
|
+
attr_reader :flush_rows
|
|
805
|
+
|
|
806
|
+
# @private
|
|
807
|
+
def initialize parent_rpcs = nil
|
|
808
|
+
create_write_stream_config = parent_rpcs.create_write_stream if parent_rpcs.respond_to? :create_write_stream
|
|
809
|
+
@create_write_stream = ::Gapic::Config::Method.new create_write_stream_config
|
|
810
|
+
get_write_stream_config = parent_rpcs.get_write_stream if parent_rpcs.respond_to? :get_write_stream
|
|
811
|
+
@get_write_stream = ::Gapic::Config::Method.new get_write_stream_config
|
|
812
|
+
finalize_write_stream_config = parent_rpcs.finalize_write_stream if parent_rpcs.respond_to? :finalize_write_stream
|
|
813
|
+
@finalize_write_stream = ::Gapic::Config::Method.new finalize_write_stream_config
|
|
814
|
+
batch_commit_write_streams_config = parent_rpcs.batch_commit_write_streams if parent_rpcs.respond_to? :batch_commit_write_streams
|
|
815
|
+
@batch_commit_write_streams = ::Gapic::Config::Method.new batch_commit_write_streams_config
|
|
816
|
+
flush_rows_config = parent_rpcs.flush_rows if parent_rpcs.respond_to? :flush_rows
|
|
817
|
+
@flush_rows = ::Gapic::Config::Method.new flush_rows_config
|
|
818
|
+
|
|
819
|
+
yield self if block_given?
|
|
820
|
+
end
|
|
821
|
+
end
|
|
822
|
+
end
|
|
823
|
+
end
|
|
824
|
+
end
|
|
825
|
+
end
|
|
826
|
+
end
|
|
827
|
+
end
|
|
828
|
+
end
|
|
829
|
+
end
|
|
830
|
+
end
|