google-cloud-dataflow-v1beta3 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/cloud/dataflow/v1beta3/flex_templates_service/client.rb +32 -3
  4. data/lib/google/cloud/dataflow/v1beta3/flex_templates_service/rest/client.rb +32 -3
  5. data/lib/google/cloud/dataflow/v1beta3/flex_templates_service/rest/service_stub.rb +22 -8
  6. data/lib/google/cloud/dataflow/v1beta3/jobs/client.rb +46 -15
  7. data/lib/google/cloud/dataflow/v1beta3/jobs/rest/client.rb +42 -13
  8. data/lib/google/cloud/dataflow/v1beta3/jobs/rest/service_stub.rb +62 -38
  9. data/lib/google/cloud/dataflow/v1beta3/messages/client.rb +33 -3
  10. data/lib/google/cloud/dataflow/v1beta3/messages/rest/client.rb +32 -3
  11. data/lib/google/cloud/dataflow/v1beta3/messages/rest/service_stub.rb +22 -8
  12. data/lib/google/cloud/dataflow/v1beta3/metrics/client.rb +38 -7
  13. data/lib/google/cloud/dataflow/v1beta3/metrics/rest/client.rb +38 -7
  14. data/lib/google/cloud/dataflow/v1beta3/metrics/rest/service_stub.rb +38 -20
  15. data/lib/google/cloud/dataflow/v1beta3/snapshots/client.rb +36 -7
  16. data/lib/google/cloud/dataflow/v1beta3/snapshots/rest/client.rb +36 -7
  17. data/lib/google/cloud/dataflow/v1beta3/snapshots/rest/service_stub.rb +38 -20
  18. data/lib/google/cloud/dataflow/v1beta3/templates_service/client.rb +36 -7
  19. data/lib/google/cloud/dataflow/v1beta3/templates_service/rest/client.rb +36 -7
  20. data/lib/google/cloud/dataflow/v1beta3/templates_service/rest/service_stub.rb +38 -20
  21. data/lib/google/cloud/dataflow/v1beta3/version.rb +1 -1
  22. data/proto_docs/google/api/client.rb +74 -10
  23. data/proto_docs/google/api/resource.rb +7 -2
  24. metadata +5 -5
@@ -31,6 +31,9 @@ module Google
31
31
  # 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
+ @metrics_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
+ @metrics_stub.logger
160
183
  end
161
184
 
162
185
  # Service calls
@@ -231,10 +254,11 @@ module Google
231
254
  # Customize the options with defaults
232
255
  metadata = @config.rpcs.get_job_metrics.metadata.to_h
233
256
 
234
- # Set x-goog-api-client and x-goog-user-project headers
257
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
235
258
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
236
259
  lib_name: @config.lib_name, lib_version: @config.lib_version,
237
260
  gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION
261
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
238
262
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
239
263
 
240
264
  header_params = {}
@@ -261,7 +285,6 @@ module Google
261
285
 
262
286
  @metrics_stub.call_rpc :get_job_metrics, request, options: options do |response, operation|
263
287
  yield response, operation if block_given?
264
- return response
265
288
  end
266
289
  rescue ::GRPC::BadStatus => e
267
290
  raise ::Google::Cloud::Error.from_error(e)
@@ -342,10 +365,11 @@ module Google
342
365
  # Customize the options with defaults
343
366
  metadata = @config.rpcs.get_job_execution_details.metadata.to_h
344
367
 
345
- # Set x-goog-api-client and x-goog-user-project headers
368
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
346
369
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
347
370
  lib_name: @config.lib_name, lib_version: @config.lib_version,
348
371
  gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION
372
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
349
373
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
350
374
 
351
375
  header_params = {}
@@ -373,7 +397,7 @@ module Google
373
397
  @metrics_stub.call_rpc :get_job_execution_details, request, options: options do |response, operation|
374
398
  response = ::Gapic::PagedEnumerable.new @metrics_stub, :get_job_execution_details, request, response, operation, options
375
399
  yield response, operation if block_given?
376
- return response
400
+ throw :response, response
377
401
  end
378
402
  rescue ::GRPC::BadStatus => e
379
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -461,10 +485,11 @@ module Google
461
485
  # Customize the options with defaults
462
486
  metadata = @config.rpcs.get_stage_execution_details.metadata.to_h
463
487
 
464
- # Set x-goog-api-client and x-goog-user-project headers
488
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
465
489
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
466
490
  lib_name: @config.lib_name, lib_version: @config.lib_version,
467
491
  gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION
492
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
468
493
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
469
494
 
470
495
  header_params = {}
@@ -495,7 +520,7 @@ module Google
495
520
  @metrics_stub.call_rpc :get_stage_execution_details, request, options: options do |response, operation|
496
521
  response = ::Gapic::PagedEnumerable.new @metrics_stub, :get_stage_execution_details, request, response, operation, options
497
522
  yield response, operation if block_given?
498
- return response
523
+ throw :response, response
499
524
  end
500
525
  rescue ::GRPC::BadStatus => e
501
526
  raise ::Google::Cloud::Error.from_error(e)
@@ -584,6 +609,11 @@ module Google
584
609
  # default endpoint URL. The default value of nil uses the environment
585
610
  # universe (usually the default "googleapis.com" universe).
586
611
  # @return [::String,nil]
612
+ # @!attribute [rw] logger
613
+ # A custom logger to use for request/response debug logging, or the value
614
+ # `:default` (the default) to construct a default logger, or `nil` to
615
+ # explicitly disable logging.
616
+ # @return [::Logger,:default,nil]
587
617
  #
588
618
  class Configuration
589
619
  extend ::Gapic::Config
@@ -608,6 +638,7 @@ module Google
608
638
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
609
639
  config_attr :quota_project, nil, ::String, nil
610
640
  config_attr :universe_domain, nil, ::String, nil
641
+ config_attr :logger, :default, ::Logger, nil, :default
611
642
 
612
643
  # @private
613
644
  def initialize parent_config = nil
@@ -33,6 +33,9 @@ module Google
33
33
  # 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
+ @metrics_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
+ @metrics_stub.logger
153
176
  end
154
177
 
155
178
  # Service calls
@@ -223,12 +246,13 @@ module Google
223
246
  # Customize the options with defaults
224
247
  call_metadata = @config.rpcs.get_job_metrics.metadata.to_h
225
248
 
226
- # Set x-goog-api-client and x-goog-user-project headers
249
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
227
250
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
228
251
  lib_name: @config.lib_name, lib_version: @config.lib_version,
229
252
  gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION,
230
253
  transports_version_send: [:rest]
231
254
 
255
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
232
256
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
233
257
 
234
258
  options.apply_defaults timeout: @config.rpcs.get_job_metrics.timeout,
@@ -241,7 +265,6 @@ module Google
241
265
 
242
266
  @metrics_stub.get_job_metrics request, options do |result, operation|
243
267
  yield result, operation if block_given?
244
- return result
245
268
  end
246
269
  rescue ::Gapic::Rest::Error => e
247
270
  raise ::Google::Cloud::Error.from_error(e)
@@ -321,12 +344,13 @@ module Google
321
344
  # Customize the options with defaults
322
345
  call_metadata = @config.rpcs.get_job_execution_details.metadata.to_h
323
346
 
324
- # Set x-goog-api-client and x-goog-user-project headers
347
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
325
348
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
326
349
  lib_name: @config.lib_name, lib_version: @config.lib_version,
327
350
  gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION,
328
351
  transports_version_send: [:rest]
329
352
 
353
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
330
354
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
331
355
 
332
356
  options.apply_defaults timeout: @config.rpcs.get_job_execution_details.timeout,
@@ -340,7 +364,7 @@ module Google
340
364
  @metrics_stub.get_job_execution_details request, options do |result, operation|
341
365
  result = ::Gapic::Rest::PagedEnumerable.new @metrics_stub, :get_job_execution_details, "stages", request, result, options
342
366
  yield result, operation if block_given?
343
- return result
367
+ throw :response, result
344
368
  end
345
369
  rescue ::Gapic::Rest::Error => e
346
370
  raise ::Google::Cloud::Error.from_error(e)
@@ -427,12 +451,13 @@ module Google
427
451
  # Customize the options with defaults
428
452
  call_metadata = @config.rpcs.get_stage_execution_details.metadata.to_h
429
453
 
430
- # Set x-goog-api-client and x-goog-user-project headers
454
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
431
455
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
432
456
  lib_name: @config.lib_name, lib_version: @config.lib_version,
433
457
  gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION,
434
458
  transports_version_send: [:rest]
435
459
 
460
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
436
461
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
437
462
 
438
463
  options.apply_defaults timeout: @config.rpcs.get_stage_execution_details.timeout,
@@ -446,7 +471,7 @@ module Google
446
471
  @metrics_stub.get_stage_execution_details request, options do |result, operation|
447
472
  result = ::Gapic::Rest::PagedEnumerable.new @metrics_stub, :get_stage_execution_details, "workers", request, result, options
448
473
  yield result, operation if block_given?
449
- return result
474
+ throw :response, result
450
475
  end
451
476
  rescue ::Gapic::Rest::Error => e
452
477
  raise ::Google::Cloud::Error.from_error(e)
@@ -526,6 +551,11 @@ module Google
526
551
  # default endpoint URL. The default value of nil uses the environment
527
552
  # universe (usually the default "googleapis.com" universe).
528
553
  # @return [::String,nil]
554
+ # @!attribute [rw] logger
555
+ # A custom logger to use for request/response debug logging, or the value
556
+ # `:default` (the default) to construct a default logger, or `nil` to
557
+ # explicitly disable logging.
558
+ # @return [::Logger,:default,nil]
529
559
  #
530
560
  class Configuration
531
561
  extend ::Gapic::Config
@@ -547,6 +577,7 @@ module Google
547
577
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
548
578
  config_attr :quota_project, nil, ::String, nil
549
579
  config_attr :universe_domain, nil, ::String, nil
580
+ config_attr :logger, :default, ::Logger, nil, :default
550
581
 
551
582
  # @private
552
583
  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
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
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
- raise_faraday_errors: false
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 get_job_metrics 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: uri,
91
- body: body || "",
92
- params: query_string_params,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "get_job_metrics",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Dataflow::V1beta3::JobMetrics.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
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: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "get_job_execution_details",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::Dataflow::V1beta3::JobExecutionDetails.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
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: uri,
167
- body: body || "",
168
- params: query_string_params,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "get_stage_execution_details",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Cloud::Dataflow::V1beta3::StageExecutionDetails.decode_json response.body, ignore_unknown_fields: true
173
-
174
- yield result, operation if block_given?
175
- result
190
+ catch :response do
191
+ yield result, operation if block_given?
192
+ result
193
+ end
176
194
  end
177
195
 
178
196
  ##
@@ -30,6 +30,9 @@ module Google
30
30
  # Provides methods to manage snapshots of Google Cloud Dataflow jobs.
31
31
  #
32
32
  class Client
33
+ # @private
34
+ API_VERSION = ""
35
+
33
36
  # @private
34
37
  DEFAULT_ENDPOINT_TEMPLATE = "dataflow.$UNIVERSE_DOMAIN$"
35
38
 
@@ -154,8 +157,28 @@ module Google
154
157
  universe_domain: @config.universe_domain,
155
158
  channel_args: @config.channel_args,
156
159
  interceptors: @config.interceptors,
157
- channel_pool_config: @config.channel_pool
160
+ channel_pool_config: @config.channel_pool,
161
+ logger: @config.logger
158
162
  )
163
+
164
+ @snapshots_stub.stub_logger&.info do |entry|
165
+ entry.set_system_name
166
+ entry.set_service
167
+ entry.message = "Created client for #{entry.service}"
168
+ entry.set_credentials_fields credentials
169
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
170
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
171
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
172
+ end
173
+ end
174
+
175
+ ##
176
+ # The logger used for request/response debug logging.
177
+ #
178
+ # @return [Logger]
179
+ #
180
+ def logger
181
+ @snapshots_stub.logger
159
182
  end
160
183
 
161
184
  # Service calls
@@ -219,10 +242,11 @@ module Google
219
242
  # Customize the options with defaults
220
243
  metadata = @config.rpcs.get_snapshot.metadata.to_h
221
244
 
222
- # Set x-goog-api-client and x-goog-user-project headers
245
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
223
246
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
224
247
  lib_name: @config.lib_name, lib_version: @config.lib_version,
225
248
  gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION
249
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
226
250
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
227
251
 
228
252
  header_params = {}
@@ -249,7 +273,6 @@ module Google
249
273
 
250
274
  @snapshots_stub.call_rpc :get_snapshot, request, options: options do |response, operation|
251
275
  yield response, operation if block_given?
252
- return response
253
276
  end
254
277
  rescue ::GRPC::BadStatus => e
255
278
  raise ::Google::Cloud::Error.from_error(e)
@@ -314,10 +337,11 @@ module Google
314
337
  # Customize the options with defaults
315
338
  metadata = @config.rpcs.delete_snapshot.metadata.to_h
316
339
 
317
- # Set x-goog-api-client and x-goog-user-project headers
340
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
318
341
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
319
342
  lib_name: @config.lib_name, lib_version: @config.lib_version,
320
343
  gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION
344
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
321
345
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
322
346
 
323
347
  header_params = {}
@@ -344,7 +368,6 @@ module Google
344
368
 
345
369
  @snapshots_stub.call_rpc :delete_snapshot, request, options: options do |response, operation|
346
370
  yield response, operation if block_given?
347
- return response
348
371
  end
349
372
  rescue ::GRPC::BadStatus => e
350
373
  raise ::Google::Cloud::Error.from_error(e)
@@ -409,10 +432,11 @@ module Google
409
432
  # Customize the options with defaults
410
433
  metadata = @config.rpcs.list_snapshots.metadata.to_h
411
434
 
412
- # Set x-goog-api-client and x-goog-user-project headers
435
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
413
436
  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
439
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
416
440
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
417
441
 
418
442
  header_params = {}
@@ -439,7 +463,6 @@ module Google
439
463
 
440
464
  @snapshots_stub.call_rpc :list_snapshots, request, options: options do |response, operation|
441
465
  yield response, operation if block_given?
442
- return response
443
466
  end
444
467
  rescue ::GRPC::BadStatus => e
445
468
  raise ::Google::Cloud::Error.from_error(e)
@@ -528,6 +551,11 @@ module Google
528
551
  # default endpoint URL. The default value of nil uses the environment
529
552
  # universe (usually the default "googleapis.com" universe).
530
553
  # @return [::String,nil]
554
+ # @!attribute [rw] logger
555
+ # A custom logger to use for request/response debug logging, or the value
556
+ # `:default` (the default) to construct a default logger, or `nil` to
557
+ # explicitly disable logging.
558
+ # @return [::Logger,:default,nil]
531
559
  #
532
560
  class Configuration
533
561
  extend ::Gapic::Config
@@ -552,6 +580,7 @@ module Google
552
580
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
553
581
  config_attr :quota_project, nil, ::String, nil
554
582
  config_attr :universe_domain, nil, ::String, nil
583
+ config_attr :logger, :default, ::Logger, nil, :default
555
584
 
556
585
  # @private
557
586
  def initialize parent_config = nil
@@ -32,6 +32,9 @@ module Google
32
32
  # Provides methods to manage snapshots of Google Cloud Dataflow jobs.
33
33
  #
34
34
  class Client
35
+ # @private
36
+ API_VERSION = ""
37
+
35
38
  # @private
36
39
  DEFAULT_ENDPOINT_TEMPLATE = "dataflow.$UNIVERSE_DOMAIN$"
37
40
 
@@ -147,8 +150,28 @@ module Google
147
150
  endpoint: @config.endpoint,
148
151
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
149
152
  universe_domain: @config.universe_domain,
150
- credentials: credentials
153
+ credentials: credentials,
154
+ logger: @config.logger
151
155
  )
156
+
157
+ @snapshots_stub.logger(stub: true)&.info do |entry|
158
+ entry.set_system_name
159
+ entry.set_service
160
+ entry.message = "Created client for #{entry.service}"
161
+ entry.set_credentials_fields credentials
162
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
163
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
164
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
165
+ end
166
+ end
167
+
168
+ ##
169
+ # The logger used for request/response debug logging.
170
+ #
171
+ # @return [Logger]
172
+ #
173
+ def logger
174
+ @snapshots_stub.logger
152
175
  end
153
176
 
154
177
  # Service calls
@@ -211,12 +234,13 @@ module Google
211
234
  # Customize the options with defaults
212
235
  call_metadata = @config.rpcs.get_snapshot.metadata.to_h
213
236
 
214
- # Set x-goog-api-client and x-goog-user-project headers
237
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
215
238
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
216
239
  lib_name: @config.lib_name, lib_version: @config.lib_version,
217
240
  gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION,
218
241
  transports_version_send: [:rest]
219
242
 
243
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
220
244
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
221
245
 
222
246
  options.apply_defaults timeout: @config.rpcs.get_snapshot.timeout,
@@ -229,7 +253,6 @@ module Google
229
253
 
230
254
  @snapshots_stub.get_snapshot request, options do |result, operation|
231
255
  yield result, operation if block_given?
232
- return result
233
256
  end
234
257
  rescue ::Gapic::Rest::Error => e
235
258
  raise ::Google::Cloud::Error.from_error(e)
@@ -293,12 +316,13 @@ module Google
293
316
  # Customize the options with defaults
294
317
  call_metadata = @config.rpcs.delete_snapshot.metadata.to_h
295
318
 
296
- # Set x-goog-api-client and x-goog-user-project headers
319
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
297
320
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
298
321
  lib_name: @config.lib_name, lib_version: @config.lib_version,
299
322
  gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION,
300
323
  transports_version_send: [:rest]
301
324
 
325
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
302
326
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
303
327
 
304
328
  options.apply_defaults timeout: @config.rpcs.delete_snapshot.timeout,
@@ -311,7 +335,6 @@ module Google
311
335
 
312
336
  @snapshots_stub.delete_snapshot request, options do |result, operation|
313
337
  yield result, operation if block_given?
314
- return result
315
338
  end
316
339
  rescue ::Gapic::Rest::Error => e
317
340
  raise ::Google::Cloud::Error.from_error(e)
@@ -375,12 +398,13 @@ module Google
375
398
  # Customize the options with defaults
376
399
  call_metadata = @config.rpcs.list_snapshots.metadata.to_h
377
400
 
378
- # Set x-goog-api-client and x-goog-user-project headers
401
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
379
402
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
380
403
  lib_name: @config.lib_name, lib_version: @config.lib_version,
381
404
  gapic_version: ::Google::Cloud::Dataflow::V1beta3::VERSION,
382
405
  transports_version_send: [:rest]
383
406
 
407
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
384
408
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
385
409
 
386
410
  options.apply_defaults timeout: @config.rpcs.list_snapshots.timeout,
@@ -393,7 +417,6 @@ module Google
393
417
 
394
418
  @snapshots_stub.list_snapshots request, options do |result, operation|
395
419
  yield result, operation if block_given?
396
- return result
397
420
  end
398
421
  rescue ::Gapic::Rest::Error => e
399
422
  raise ::Google::Cloud::Error.from_error(e)
@@ -473,6 +496,11 @@ module Google
473
496
  # default endpoint URL. The default value of nil uses the environment
474
497
  # universe (usually the default "googleapis.com" universe).
475
498
  # @return [::String,nil]
499
+ # @!attribute [rw] logger
500
+ # A custom logger to use for request/response debug logging, or the value
501
+ # `:default` (the default) to construct a default logger, or `nil` to
502
+ # explicitly disable logging.
503
+ # @return [::Logger,:default,nil]
476
504
  #
477
505
  class Configuration
478
506
  extend ::Gapic::Config
@@ -494,6 +522,7 @@ module Google
494
522
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
495
523
  config_attr :quota_project, nil, ::String, nil
496
524
  config_attr :universe_domain, nil, ::String, nil
525
+ config_attr :logger, :default, ::Logger, nil, :default
497
526
 
498
527
  # @private
499
528
  def initialize parent_config = nil