google-cloud-dataflow-v1beta3 0.9.0 → 0.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 +30 -20
- data/lib/google/cloud/dataflow/v1beta3/flex_templates_service/client.rb +32 -3
- data/lib/google/cloud/dataflow/v1beta3/flex_templates_service/rest/client.rb +32 -3
- data/lib/google/cloud/dataflow/v1beta3/flex_templates_service/rest/service_stub.rb +22 -8
- data/lib/google/cloud/dataflow/v1beta3/jobs/client.rb +46 -15
- data/lib/google/cloud/dataflow/v1beta3/jobs/rest/client.rb +42 -13
- data/lib/google/cloud/dataflow/v1beta3/jobs/rest/service_stub.rb +62 -38
- data/lib/google/cloud/dataflow/v1beta3/messages/client.rb +33 -3
- data/lib/google/cloud/dataflow/v1beta3/messages/rest/client.rb +32 -3
- data/lib/google/cloud/dataflow/v1beta3/messages/rest/service_stub.rb +22 -8
- data/lib/google/cloud/dataflow/v1beta3/metrics/client.rb +38 -7
- data/lib/google/cloud/dataflow/v1beta3/metrics/rest/client.rb +38 -7
- data/lib/google/cloud/dataflow/v1beta3/metrics/rest/service_stub.rb +38 -20
- data/lib/google/cloud/dataflow/v1beta3/snapshots/client.rb +36 -7
- data/lib/google/cloud/dataflow/v1beta3/snapshots/rest/client.rb +36 -7
- data/lib/google/cloud/dataflow/v1beta3/snapshots/rest/service_stub.rb +38 -20
- data/lib/google/cloud/dataflow/v1beta3/templates_service/client.rb +36 -7
- data/lib/google/cloud/dataflow/v1beta3/templates_service/rest/client.rb +36 -7
- data/lib/google/cloud/dataflow/v1beta3/templates_service/rest/service_stub.rb +38 -20
- data/lib/google/cloud/dataflow/v1beta3/version.rb +1 -1
- data/proto_docs/google/api/client.rb +74 -10
- data/proto_docs/google/api/resource.rb +7 -2
- metadata +5 -5
@@ -33,6 +33,9 @@ module Google
|
|
33
33
|
# A Job is a multi-stage computation graph run by the Cloud Dataflow service.
|
34
34
|
#
|
35
35
|
class Client
|
36
|
+
# @private
|
37
|
+
API_VERSION = ""
|
38
|
+
|
36
39
|
# @private
|
37
40
|
DEFAULT_ENDPOINT_TEMPLATE = "dataflow.$UNIVERSE_DOMAIN$"
|
38
41
|
|
@@ -148,8 +151,28 @@ module Google
|
|
148
151
|
endpoint: @config.endpoint,
|
149
152
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
150
153
|
universe_domain: @config.universe_domain,
|
151
|
-
credentials: credentials
|
154
|
+
credentials: credentials,
|
155
|
+
logger: @config.logger
|
152
156
|
)
|
157
|
+
|
158
|
+
@jobs_stub.logger(stub: true)&.info do |entry|
|
159
|
+
entry.set_system_name
|
160
|
+
entry.set_service
|
161
|
+
entry.message = "Created client for #{entry.service}"
|
162
|
+
entry.set_credentials_fields credentials
|
163
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
164
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
165
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
##
|
170
|
+
# The logger used for request/response debug logging.
|
171
|
+
#
|
172
|
+
# @return [Logger]
|
173
|
+
#
|
174
|
+
def logger
|
175
|
+
@jobs_stub.logger
|
153
176
|
end
|
154
177
|
|
155
178
|
# Service calls
|
@@ -224,12 +247,13 @@ module Google
|
|
224
247
|
# Customize the options with defaults
|
225
248
|
call_metadata = @config.rpcs.create_job.metadata.to_h
|
226
249
|
|
227
|
-
# Set x-goog-api-client
|
250
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
228
251
|
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
229
252
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
230
253
|
gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION,
|
231
254
|
transports_version_send: [:rest]
|
232
255
|
|
256
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
233
257
|
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
234
258
|
|
235
259
|
options.apply_defaults timeout: @config.rpcs.create_job.timeout,
|
@@ -242,7 +266,6 @@ module Google
|
|
242
266
|
|
243
267
|
@jobs_stub.create_job request, options do |result, operation|
|
244
268
|
yield result, operation if block_given?
|
245
|
-
return result
|
246
269
|
end
|
247
270
|
rescue ::Gapic::Rest::Error => e
|
248
271
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -316,12 +339,13 @@ module Google
|
|
316
339
|
# Customize the options with defaults
|
317
340
|
call_metadata = @config.rpcs.get_job.metadata.to_h
|
318
341
|
|
319
|
-
# Set x-goog-api-client
|
342
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
320
343
|
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
321
344
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
322
345
|
gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION,
|
323
346
|
transports_version_send: [:rest]
|
324
347
|
|
348
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
325
349
|
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
326
350
|
|
327
351
|
options.apply_defaults timeout: @config.rpcs.get_job.timeout,
|
@@ -334,7 +358,6 @@ module Google
|
|
334
358
|
|
335
359
|
@jobs_stub.get_job request, options do |result, operation|
|
336
360
|
yield result, operation if block_given?
|
337
|
-
return result
|
338
361
|
end
|
339
362
|
rescue ::Gapic::Rest::Error => e
|
340
363
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -409,12 +432,13 @@ module Google
|
|
409
432
|
# Customize the options with defaults
|
410
433
|
call_metadata = @config.rpcs.update_job.metadata.to_h
|
411
434
|
|
412
|
-
# Set x-goog-api-client
|
435
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
413
436
|
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
414
437
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
415
438
|
gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION,
|
416
439
|
transports_version_send: [:rest]
|
417
440
|
|
441
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
418
442
|
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
419
443
|
|
420
444
|
options.apply_defaults timeout: @config.rpcs.update_job.timeout,
|
@@ -427,7 +451,6 @@ module Google
|
|
427
451
|
|
428
452
|
@jobs_stub.update_job request, options do |result, operation|
|
429
453
|
yield result, operation if block_given?
|
430
|
-
return result
|
431
454
|
end
|
432
455
|
rescue ::Gapic::Rest::Error => e
|
433
456
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -514,12 +537,13 @@ module Google
|
|
514
537
|
# Customize the options with defaults
|
515
538
|
call_metadata = @config.rpcs.list_jobs.metadata.to_h
|
516
539
|
|
517
|
-
# Set x-goog-api-client
|
540
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
518
541
|
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
519
542
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
520
543
|
gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION,
|
521
544
|
transports_version_send: [:rest]
|
522
545
|
|
546
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
523
547
|
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
524
548
|
|
525
549
|
options.apply_defaults timeout: @config.rpcs.list_jobs.timeout,
|
@@ -532,7 +556,6 @@ module Google
|
|
532
556
|
|
533
557
|
@jobs_stub.list_jobs request, options do |result, operation|
|
534
558
|
yield result, operation if block_given?
|
535
|
-
return result
|
536
559
|
end
|
537
560
|
rescue ::Gapic::Rest::Error => e
|
538
561
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -612,12 +635,13 @@ module Google
|
|
612
635
|
# Customize the options with defaults
|
613
636
|
call_metadata = @config.rpcs.aggregated_list_jobs.metadata.to_h
|
614
637
|
|
615
|
-
# Set x-goog-api-client
|
638
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
616
639
|
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
617
640
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
618
641
|
gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION,
|
619
642
|
transports_version_send: [:rest]
|
620
643
|
|
644
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
621
645
|
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
622
646
|
|
623
647
|
options.apply_defaults timeout: @config.rpcs.aggregated_list_jobs.timeout,
|
@@ -630,7 +654,6 @@ module Google
|
|
630
654
|
|
631
655
|
@jobs_stub.aggregated_list_jobs request, options do |result, operation|
|
632
656
|
yield result, operation if block_given?
|
633
|
-
return result
|
634
657
|
end
|
635
658
|
rescue ::Gapic::Rest::Error => e
|
636
659
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -700,12 +723,13 @@ module Google
|
|
700
723
|
# Customize the options with defaults
|
701
724
|
call_metadata = @config.rpcs.snapshot_job.metadata.to_h
|
702
725
|
|
703
|
-
# Set x-goog-api-client
|
726
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
704
727
|
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
705
728
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
706
729
|
gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION,
|
707
730
|
transports_version_send: [:rest]
|
708
731
|
|
732
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
709
733
|
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
710
734
|
|
711
735
|
options.apply_defaults timeout: @config.rpcs.snapshot_job.timeout,
|
@@ -718,7 +742,6 @@ module Google
|
|
718
742
|
|
719
743
|
@jobs_stub.snapshot_job request, options do |result, operation|
|
720
744
|
yield result, operation if block_given?
|
721
|
-
return result
|
722
745
|
end
|
723
746
|
rescue ::Gapic::Rest::Error => e
|
724
747
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -798,6 +821,11 @@ module Google
|
|
798
821
|
# default endpoint URL. The default value of nil uses the environment
|
799
822
|
# universe (usually the default "googleapis.com" universe).
|
800
823
|
# @return [::String,nil]
|
824
|
+
# @!attribute [rw] logger
|
825
|
+
# A custom logger to use for request/response debug logging, or the value
|
826
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
827
|
+
# explicitly disable logging.
|
828
|
+
# @return [::Logger,:default,nil]
|
801
829
|
#
|
802
830
|
class Configuration
|
803
831
|
extend ::Gapic::Config
|
@@ -819,6 +847,7 @@ module Google
|
|
819
847
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
820
848
|
config_attr :quota_project, nil, ::String, nil
|
821
849
|
config_attr :universe_domain, nil, ::String, nil
|
850
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
822
851
|
|
823
852
|
# @private
|
824
853
|
def initialize parent_config = nil
|
@@ -30,7 +30,8 @@ module Google
|
|
30
30
|
# including transcoding, making the REST call, and deserialing the response.
|
31
31
|
#
|
32
32
|
class ServiceStub
|
33
|
-
|
33
|
+
# @private
|
34
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
|
34
35
|
# These require statements are intentionally placed here to initialize
|
35
36
|
# the REST modules only when it's required.
|
36
37
|
require "gapic/rest"
|
@@ -40,7 +41,9 @@ module Google
|
|
40
41
|
universe_domain: universe_domain,
|
41
42
|
credentials: credentials,
|
42
43
|
numeric_enums: true,
|
43
|
-
|
44
|
+
service_name: self.class,
|
45
|
+
raise_faraday_errors: false,
|
46
|
+
logger: logger
|
44
47
|
end
|
45
48
|
|
46
49
|
##
|
@@ -61,6 +64,15 @@ module Google
|
|
61
64
|
@client_stub.endpoint
|
62
65
|
end
|
63
66
|
|
67
|
+
##
|
68
|
+
# The logger used for request/response debug logging.
|
69
|
+
#
|
70
|
+
# @return [Logger]
|
71
|
+
#
|
72
|
+
def logger stub: false
|
73
|
+
stub ? @client_stub.stub_logger : @client_stub.logger
|
74
|
+
end
|
75
|
+
|
64
76
|
##
|
65
77
|
# Baseline implementation for the create_job REST call
|
66
78
|
#
|
@@ -87,16 +99,18 @@ module Google
|
|
87
99
|
|
88
100
|
response = @client_stub.make_http_request(
|
89
101
|
verb,
|
90
|
-
uri:
|
91
|
-
body:
|
92
|
-
params:
|
102
|
+
uri: uri,
|
103
|
+
body: body || "",
|
104
|
+
params: query_string_params,
|
105
|
+
method_name: "create_job",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Cloud::Dataflow::V1beta3::Job.decode_json response.body, ignore_unknown_fields: true
|
97
|
-
|
98
|
-
|
99
|
-
|
110
|
+
catch :response do
|
111
|
+
yield result, operation if block_given?
|
112
|
+
result
|
113
|
+
end
|
100
114
|
end
|
101
115
|
|
102
116
|
##
|
@@ -125,16 +139,18 @@ module Google
|
|
125
139
|
|
126
140
|
response = @client_stub.make_http_request(
|
127
141
|
verb,
|
128
|
-
uri:
|
129
|
-
body:
|
130
|
-
params:
|
142
|
+
uri: uri,
|
143
|
+
body: body || "",
|
144
|
+
params: query_string_params,
|
145
|
+
method_name: "get_job",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Cloud::Dataflow::V1beta3::Job.decode_json response.body, ignore_unknown_fields: true
|
135
|
-
|
136
|
-
|
137
|
-
|
150
|
+
catch :response do
|
151
|
+
yield result, operation if block_given?
|
152
|
+
result
|
153
|
+
end
|
138
154
|
end
|
139
155
|
|
140
156
|
##
|
@@ -163,16 +179,18 @@ module Google
|
|
163
179
|
|
164
180
|
response = @client_stub.make_http_request(
|
165
181
|
verb,
|
166
|
-
uri:
|
167
|
-
body:
|
168
|
-
params:
|
182
|
+
uri: uri,
|
183
|
+
body: body || "",
|
184
|
+
params: query_string_params,
|
185
|
+
method_name: "update_job",
|
169
186
|
options: options
|
170
187
|
)
|
171
188
|
operation = ::Gapic::Rest::TransportOperation.new response
|
172
189
|
result = ::Google::Cloud::Dataflow::V1beta3::Job.decode_json response.body, ignore_unknown_fields: true
|
173
|
-
|
174
|
-
|
175
|
-
|
190
|
+
catch :response do
|
191
|
+
yield result, operation if block_given?
|
192
|
+
result
|
193
|
+
end
|
176
194
|
end
|
177
195
|
|
178
196
|
##
|
@@ -201,16 +219,18 @@ module Google
|
|
201
219
|
|
202
220
|
response = @client_stub.make_http_request(
|
203
221
|
verb,
|
204
|
-
uri:
|
205
|
-
body:
|
206
|
-
params:
|
222
|
+
uri: uri,
|
223
|
+
body: body || "",
|
224
|
+
params: query_string_params,
|
225
|
+
method_name: "list_jobs",
|
207
226
|
options: options
|
208
227
|
)
|
209
228
|
operation = ::Gapic::Rest::TransportOperation.new response
|
210
229
|
result = ::Google::Cloud::Dataflow::V1beta3::ListJobsResponse.decode_json response.body, ignore_unknown_fields: true
|
211
|
-
|
212
|
-
|
213
|
-
|
230
|
+
catch :response do
|
231
|
+
yield result, operation if block_given?
|
232
|
+
result
|
233
|
+
end
|
214
234
|
end
|
215
235
|
|
216
236
|
##
|
@@ -239,16 +259,18 @@ module Google
|
|
239
259
|
|
240
260
|
response = @client_stub.make_http_request(
|
241
261
|
verb,
|
242
|
-
uri:
|
243
|
-
body:
|
244
|
-
params:
|
262
|
+
uri: uri,
|
263
|
+
body: body || "",
|
264
|
+
params: query_string_params,
|
265
|
+
method_name: "aggregated_list_jobs",
|
245
266
|
options: options
|
246
267
|
)
|
247
268
|
operation = ::Gapic::Rest::TransportOperation.new response
|
248
269
|
result = ::Google::Cloud::Dataflow::V1beta3::ListJobsResponse.decode_json response.body, ignore_unknown_fields: true
|
249
|
-
|
250
|
-
|
251
|
-
|
270
|
+
catch :response do
|
271
|
+
yield result, operation if block_given?
|
272
|
+
result
|
273
|
+
end
|
252
274
|
end
|
253
275
|
|
254
276
|
##
|
@@ -277,16 +299,18 @@ module Google
|
|
277
299
|
|
278
300
|
response = @client_stub.make_http_request(
|
279
301
|
verb,
|
280
|
-
uri:
|
281
|
-
body:
|
282
|
-
params:
|
302
|
+
uri: uri,
|
303
|
+
body: body || "",
|
304
|
+
params: query_string_params,
|
305
|
+
method_name: "snapshot_job",
|
283
306
|
options: options
|
284
307
|
)
|
285
308
|
operation = ::Gapic::Rest::TransportOperation.new response
|
286
309
|
result = ::Google::Cloud::Dataflow::V1beta3::Snapshot.decode_json response.body, ignore_unknown_fields: true
|
287
|
-
|
288
|
-
|
289
|
-
|
310
|
+
catch :response do
|
311
|
+
yield result, operation if block_given?
|
312
|
+
result
|
313
|
+
end
|
290
314
|
end
|
291
315
|
|
292
316
|
##
|
@@ -31,6 +31,9 @@ module Google
|
|
31
31
|
# Dataflow jobs.
|
32
32
|
#
|
33
33
|
class Client
|
34
|
+
# @private
|
35
|
+
API_VERSION = ""
|
36
|
+
|
34
37
|
# @private
|
35
38
|
DEFAULT_ENDPOINT_TEMPLATE = "dataflow.$UNIVERSE_DOMAIN$"
|
36
39
|
|
@@ -155,8 +158,28 @@ module Google
|
|
155
158
|
universe_domain: @config.universe_domain,
|
156
159
|
channel_args: @config.channel_args,
|
157
160
|
interceptors: @config.interceptors,
|
158
|
-
channel_pool_config: @config.channel_pool
|
161
|
+
channel_pool_config: @config.channel_pool,
|
162
|
+
logger: @config.logger
|
159
163
|
)
|
164
|
+
|
165
|
+
@messages_stub.stub_logger&.info do |entry|
|
166
|
+
entry.set_system_name
|
167
|
+
entry.set_service
|
168
|
+
entry.message = "Created client for #{entry.service}"
|
169
|
+
entry.set_credentials_fields credentials
|
170
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
171
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
172
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
##
|
177
|
+
# The logger used for request/response debug logging.
|
178
|
+
#
|
179
|
+
# @return [Logger]
|
180
|
+
#
|
181
|
+
def logger
|
182
|
+
@messages_stub.logger
|
160
183
|
end
|
161
184
|
|
162
185
|
# Service calls
|
@@ -248,10 +271,11 @@ module Google
|
|
248
271
|
# Customize the options with defaults
|
249
272
|
metadata = @config.rpcs.list_job_messages.metadata.to_h
|
250
273
|
|
251
|
-
# Set x-goog-api-client
|
274
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
252
275
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
253
276
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
254
277
|
gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION
|
278
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
255
279
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
256
280
|
|
257
281
|
header_params = {}
|
@@ -279,7 +303,7 @@ module Google
|
|
279
303
|
@messages_stub.call_rpc :list_job_messages, request, options: options do |response, operation|
|
280
304
|
response = ::Gapic::PagedEnumerable.new @messages_stub, :list_job_messages, request, response, operation, options
|
281
305
|
yield response, operation if block_given?
|
282
|
-
|
306
|
+
throw :response, response
|
283
307
|
end
|
284
308
|
rescue ::GRPC::BadStatus => e
|
285
309
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -368,6 +392,11 @@ module Google
|
|
368
392
|
# default endpoint URL. The default value of nil uses the environment
|
369
393
|
# universe (usually the default "googleapis.com" universe).
|
370
394
|
# @return [::String,nil]
|
395
|
+
# @!attribute [rw] logger
|
396
|
+
# A custom logger to use for request/response debug logging, or the value
|
397
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
398
|
+
# explicitly disable logging.
|
399
|
+
# @return [::Logger,:default,nil]
|
371
400
|
#
|
372
401
|
class Configuration
|
373
402
|
extend ::Gapic::Config
|
@@ -392,6 +421,7 @@ module Google
|
|
392
421
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
393
422
|
config_attr :quota_project, nil, ::String, nil
|
394
423
|
config_attr :universe_domain, nil, ::String, nil
|
424
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
395
425
|
|
396
426
|
# @private
|
397
427
|
def initialize parent_config = nil
|
@@ -33,6 +33,9 @@ module Google
|
|
33
33
|
# Dataflow jobs.
|
34
34
|
#
|
35
35
|
class Client
|
36
|
+
# @private
|
37
|
+
API_VERSION = ""
|
38
|
+
|
36
39
|
# @private
|
37
40
|
DEFAULT_ENDPOINT_TEMPLATE = "dataflow.$UNIVERSE_DOMAIN$"
|
38
41
|
|
@@ -148,8 +151,28 @@ module Google
|
|
148
151
|
endpoint: @config.endpoint,
|
149
152
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
150
153
|
universe_domain: @config.universe_domain,
|
151
|
-
credentials: credentials
|
154
|
+
credentials: credentials,
|
155
|
+
logger: @config.logger
|
152
156
|
)
|
157
|
+
|
158
|
+
@messages_stub.logger(stub: true)&.info do |entry|
|
159
|
+
entry.set_system_name
|
160
|
+
entry.set_service
|
161
|
+
entry.message = "Created client for #{entry.service}"
|
162
|
+
entry.set_credentials_fields credentials
|
163
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
164
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
165
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
##
|
170
|
+
# The logger used for request/response debug logging.
|
171
|
+
#
|
172
|
+
# @return [Logger]
|
173
|
+
#
|
174
|
+
def logger
|
175
|
+
@messages_stub.logger
|
153
176
|
end
|
154
177
|
|
155
178
|
# Service calls
|
@@ -240,12 +263,13 @@ module Google
|
|
240
263
|
# Customize the options with defaults
|
241
264
|
call_metadata = @config.rpcs.list_job_messages.metadata.to_h
|
242
265
|
|
243
|
-
# Set x-goog-api-client
|
266
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
244
267
|
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
245
268
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
246
269
|
gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION,
|
247
270
|
transports_version_send: [:rest]
|
248
271
|
|
272
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
249
273
|
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
250
274
|
|
251
275
|
options.apply_defaults timeout: @config.rpcs.list_job_messages.timeout,
|
@@ -258,7 +282,6 @@ module Google
|
|
258
282
|
|
259
283
|
@messages_stub.list_job_messages request, options do |result, operation|
|
260
284
|
yield result, operation if block_given?
|
261
|
-
return result
|
262
285
|
end
|
263
286
|
rescue ::Gapic::Rest::Error => e
|
264
287
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -338,6 +361,11 @@ module Google
|
|
338
361
|
# default endpoint URL. The default value of nil uses the environment
|
339
362
|
# universe (usually the default "googleapis.com" universe).
|
340
363
|
# @return [::String,nil]
|
364
|
+
# @!attribute [rw] logger
|
365
|
+
# A custom logger to use for request/response debug logging, or the value
|
366
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
367
|
+
# explicitly disable logging.
|
368
|
+
# @return [::Logger,:default,nil]
|
341
369
|
#
|
342
370
|
class Configuration
|
343
371
|
extend ::Gapic::Config
|
@@ -359,6 +387,7 @@ module Google
|
|
359
387
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
360
388
|
config_attr :quota_project, nil, ::String, nil
|
361
389
|
config_attr :universe_domain, nil, ::String, nil
|
390
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
362
391
|
|
363
392
|
# @private
|
364
393
|
def initialize parent_config = nil
|
@@ -30,7 +30,8 @@ module Google
|
|
30
30
|
# including transcoding, making the REST call, and deserialing the response.
|
31
31
|
#
|
32
32
|
class ServiceStub
|
33
|
-
|
33
|
+
# @private
|
34
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
|
34
35
|
# These require statements are intentionally placed here to initialize
|
35
36
|
# the REST modules only when it's required.
|
36
37
|
require "gapic/rest"
|
@@ -40,7 +41,9 @@ module Google
|
|
40
41
|
universe_domain: universe_domain,
|
41
42
|
credentials: credentials,
|
42
43
|
numeric_enums: true,
|
43
|
-
|
44
|
+
service_name: self.class,
|
45
|
+
raise_faraday_errors: false,
|
46
|
+
logger: logger
|
44
47
|
end
|
45
48
|
|
46
49
|
##
|
@@ -61,6 +64,15 @@ module Google
|
|
61
64
|
@client_stub.endpoint
|
62
65
|
end
|
63
66
|
|
67
|
+
##
|
68
|
+
# The logger used for request/response debug logging.
|
69
|
+
#
|
70
|
+
# @return [Logger]
|
71
|
+
#
|
72
|
+
def logger stub: false
|
73
|
+
stub ? @client_stub.stub_logger : @client_stub.logger
|
74
|
+
end
|
75
|
+
|
64
76
|
##
|
65
77
|
# Baseline implementation for the list_job_messages REST call
|
66
78
|
#
|
@@ -87,16 +99,18 @@ module Google
|
|
87
99
|
|
88
100
|
response = @client_stub.make_http_request(
|
89
101
|
verb,
|
90
|
-
uri:
|
91
|
-
body:
|
92
|
-
params:
|
102
|
+
uri: uri,
|
103
|
+
body: body || "",
|
104
|
+
params: query_string_params,
|
105
|
+
method_name: "list_job_messages",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Cloud::Dataflow::V1beta3::ListJobMessagesResponse.decode_json response.body, ignore_unknown_fields: true
|
97
|
-
|
98
|
-
|
99
|
-
|
110
|
+
catch :response do
|
111
|
+
yield result, operation if block_given?
|
112
|
+
result
|
113
|
+
end
|
100
114
|
end
|
101
115
|
|
102
116
|
##
|