google-cloud-dialogflow-cx-v3 1.2.0 → 1.3.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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/cloud/dialogflow/cx/v3/agents/client.rb +31 -12
  4. data/lib/google/cloud/dialogflow/cx/v3/agents/operations.rb +12 -15
  5. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/client.rb +31 -12
  6. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/operations.rb +43 -38
  7. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/service_stub.rb +102 -68
  8. data/lib/google/cloud/dialogflow/cx/v3/changelogs/client.rb +29 -3
  9. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/client.rb +29 -3
  10. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/service_stub.rb +30 -14
  11. data/lib/google/cloud/dialogflow/cx/v3/deployments/client.rb +29 -3
  12. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/client.rb +29 -3
  13. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/service_stub.rb +30 -14
  14. data/lib/google/cloud/dialogflow/cx/v3/entity_types/client.rb +31 -8
  15. data/lib/google/cloud/dialogflow/cx/v3/entity_types/operations.rb +12 -15
  16. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/client.rb +31 -8
  17. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/operations.rb +43 -38
  18. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/service_stub.rb +70 -44
  19. data/lib/google/cloud/dialogflow/cx/v3/environments/client.rb +35 -10
  20. data/lib/google/cloud/dialogflow/cx/v3/environments/operations.rb +12 -15
  21. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/client.rb +35 -10
  22. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/operations.rb +43 -38
  23. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/service_stub.rb +86 -56
  24. data/lib/google/cloud/dialogflow/cx/v3/experiments/client.rb +29 -8
  25. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/client.rb +29 -8
  26. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/service_stub.rb +70 -44
  27. data/lib/google/cloud/dialogflow/cx/v3/flows/client.rb +32 -11
  28. data/lib/google/cloud/dialogflow/cx/v3/flows/operations.rb +12 -15
  29. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/client.rb +32 -11
  30. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/operations.rb +43 -38
  31. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/service_stub.rb +94 -62
  32. data/lib/google/cloud/dialogflow/cx/v3/generators/client.rb +29 -6
  33. data/lib/google/cloud/dialogflow/cx/v3/generators/rest/client.rb +29 -6
  34. data/lib/google/cloud/dialogflow/cx/v3/generators/rest/service_stub.rb +54 -32
  35. data/lib/google/cloud/dialogflow/cx/v3/intents/client.rb +31 -8
  36. data/lib/google/cloud/dialogflow/cx/v3/intents/operations.rb +12 -15
  37. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/client.rb +31 -8
  38. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/operations.rb +43 -38
  39. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/service_stub.rb +70 -44
  40. data/lib/google/cloud/dialogflow/cx/v3/pages/client.rb +29 -6
  41. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/client.rb +29 -6
  42. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/service_stub.rb +54 -32
  43. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/client.rb +29 -6
  44. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/client.rb +29 -6
  45. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/service_stub.rb +54 -32
  46. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/client.rb +29 -6
  47. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/client.rb +29 -6
  48. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/service_stub.rb +54 -32
  49. data/lib/google/cloud/dialogflow/cx/v3/sessions/client.rb +28 -7
  50. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/client.rb +28 -5
  51. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb +47 -26
  52. data/lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb +34 -13
  53. data/lib/google/cloud/dialogflow/cx/v3/test_cases/operations.rb +12 -15
  54. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/client.rb +34 -13
  55. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/operations.rb +43 -38
  56. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/service_stub.rb +110 -74
  57. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/client.rb +29 -6
  58. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/client.rb +29 -6
  59. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/service_stub.rb +54 -32
  60. data/lib/google/cloud/dialogflow/cx/v3/version.rb +1 -1
  61. data/lib/google/cloud/dialogflow/cx/v3/versions/client.rb +31 -8
  62. data/lib/google/cloud/dialogflow/cx/v3/versions/operations.rb +12 -15
  63. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/client.rb +31 -8
  64. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/operations.rb +43 -38
  65. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/service_stub.rb +70 -44
  66. data/lib/google/cloud/dialogflow/cx/v3/webhooks/client.rb +29 -6
  67. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/client.rb +29 -6
  68. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/service_stub.rb +54 -32
  69. data/proto_docs/google/api/client.rb +19 -0
  70. data/proto_docs/google/longrunning/operations.rb +19 -14
  71. metadata +5 -5
@@ -31,7 +31,8 @@ module Google
31
31
  # including transcoding, making the REST call, and deserialing the response.
32
32
  #
33
33
  class ServiceStub
34
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
34
+ # @private
35
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
35
36
  # These require statements are intentionally placed here to initialize
36
37
  # the REST modules only when it's required.
37
38
  require "gapic/rest"
@@ -41,7 +42,9 @@ module Google
41
42
  universe_domain: universe_domain,
42
43
  credentials: credentials,
43
44
  numeric_enums: true,
44
- raise_faraday_errors: false
45
+ service_name: self.class,
46
+ raise_faraday_errors: false,
47
+ logger: logger
45
48
  end
46
49
 
47
50
  ##
@@ -62,6 +65,15 @@ module Google
62
65
  @client_stub.endpoint
63
66
  end
64
67
 
68
+ ##
69
+ # The logger used for request/response debug logging.
70
+ #
71
+ # @return [Logger]
72
+ #
73
+ def logger stub: false
74
+ stub ? @client_stub.stub_logger : @client_stub.logger
75
+ end
76
+
65
77
  ##
66
78
  # Baseline implementation for the detect_intent REST call
67
79
  #
@@ -88,16 +100,18 @@ module Google
88
100
 
89
101
  response = @client_stub.make_http_request(
90
102
  verb,
91
- uri: uri,
92
- body: body || "",
93
- params: query_string_params,
103
+ uri: uri,
104
+ body: body || "",
105
+ params: query_string_params,
106
+ method_name: "detect_intent",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Cloud::Dialogflow::CX::V3::DetectIntentResponse.decode_json response.body, ignore_unknown_fields: true
98
-
99
- yield result, operation if block_given?
100
- result
111
+ catch :response do
112
+ yield result, operation if block_given?
113
+ result
114
+ end
101
115
  end
102
116
 
103
117
  ##
@@ -126,6 +140,7 @@ module Google
126
140
  uri: uri,
127
141
  body: body || "",
128
142
  params: query_string_params,
143
+ method_name: "server_streaming_detect_intent",
129
144
  options: options,
130
145
  is_server_streaming: true,
131
146
  &block
@@ -159,16 +174,18 @@ module Google
159
174
 
160
175
  response = @client_stub.make_http_request(
161
176
  verb,
162
- uri: uri,
163
- body: body || "",
164
- params: query_string_params,
177
+ uri: uri,
178
+ body: body || "",
179
+ params: query_string_params,
180
+ method_name: "match_intent",
165
181
  options: options
166
182
  )
167
183
  operation = ::Gapic::Rest::TransportOperation.new response
168
184
  result = ::Google::Cloud::Dialogflow::CX::V3::MatchIntentResponse.decode_json response.body, ignore_unknown_fields: true
169
-
170
- yield result, operation if block_given?
171
- result
185
+ catch :response do
186
+ yield result, operation if block_given?
187
+ result
188
+ end
172
189
  end
173
190
 
174
191
  ##
@@ -197,16 +214,18 @@ module Google
197
214
 
198
215
  response = @client_stub.make_http_request(
199
216
  verb,
200
- uri: uri,
201
- body: body || "",
202
- params: query_string_params,
217
+ uri: uri,
218
+ body: body || "",
219
+ params: query_string_params,
220
+ method_name: "fulfill_intent",
203
221
  options: options
204
222
  )
205
223
  operation = ::Gapic::Rest::TransportOperation.new response
206
224
  result = ::Google::Cloud::Dialogflow::CX::V3::FulfillIntentResponse.decode_json response.body, ignore_unknown_fields: true
207
-
208
- yield result, operation if block_given?
209
- result
225
+ catch :response do
226
+ yield result, operation if block_given?
227
+ result
228
+ end
210
229
  end
211
230
 
212
231
  ##
@@ -235,16 +254,18 @@ module Google
235
254
 
236
255
  response = @client_stub.make_http_request(
237
256
  verb,
238
- uri: uri,
239
- body: body || "",
240
- params: query_string_params,
257
+ uri: uri,
258
+ body: body || "",
259
+ params: query_string_params,
260
+ method_name: "submit_answer_feedback",
241
261
  options: options
242
262
  )
243
263
  operation = ::Gapic::Rest::TransportOperation.new response
244
264
  result = ::Google::Cloud::Dialogflow::CX::V3::AnswerFeedback.decode_json response.body, ignore_unknown_fields: true
245
-
246
- yield result, operation if block_given?
247
- result
265
+ catch :response do
266
+ yield result, operation if block_given?
267
+ result
268
+ end
248
269
  end
249
270
 
250
271
  ##
@@ -172,14 +172,26 @@ module Google
172
172
  universe_domain: @config.universe_domain,
173
173
  channel_args: @config.channel_args,
174
174
  interceptors: @config.interceptors,
175
- channel_pool_config: @config.channel_pool
175
+ channel_pool_config: @config.channel_pool,
176
+ logger: @config.logger
176
177
  )
177
178
 
179
+ @test_cases_stub.stub_logger&.info do |entry|
180
+ entry.set_system_name
181
+ entry.set_service
182
+ entry.message = "Created client for #{entry.service}"
183
+ entry.set_credentials_fields credentials
184
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
185
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
186
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
187
+ end
188
+
178
189
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
179
190
  config.credentials = credentials
180
191
  config.quota_project = @quota_project_id
181
192
  config.endpoint = @test_cases_stub.endpoint
182
193
  config.universe_domain = @test_cases_stub.universe_domain
194
+ config.logger = @test_cases_stub.logger if config.respond_to? :logger=
183
195
  end
184
196
  end
185
197
 
@@ -197,6 +209,15 @@ module Google
197
209
  #
198
210
  attr_reader :location_client
199
211
 
212
+ ##
213
+ # The logger used for request/response debug logging.
214
+ #
215
+ # @return [Logger]
216
+ #
217
+ def logger
218
+ @test_cases_stub.logger
219
+ end
220
+
200
221
  # Service calls
201
222
 
202
223
  ##
@@ -293,7 +314,7 @@ module Google
293
314
  @test_cases_stub.call_rpc :list_test_cases, request, options: options do |response, operation|
294
315
  response = ::Gapic::PagedEnumerable.new @test_cases_stub, :list_test_cases, request, response, operation, options
295
316
  yield response, operation if block_given?
296
- return response
317
+ throw :response, response
297
318
  end
298
319
  rescue ::GRPC::BadStatus => e
299
320
  raise ::Google::Cloud::Error.from_error(e)
@@ -383,7 +404,6 @@ module Google
383
404
 
384
405
  @test_cases_stub.call_rpc :batch_delete_test_cases, request, options: options do |response, operation|
385
406
  yield response, operation if block_given?
386
- return response
387
407
  end
388
408
  rescue ::GRPC::BadStatus => e
389
409
  raise ::Google::Cloud::Error.from_error(e)
@@ -471,7 +491,6 @@ module Google
471
491
 
472
492
  @test_cases_stub.call_rpc :get_test_case, request, options: options do |response, operation|
473
493
  yield response, operation if block_given?
474
- return response
475
494
  end
476
495
  rescue ::GRPC::BadStatus => e
477
496
  raise ::Google::Cloud::Error.from_error(e)
@@ -560,7 +579,6 @@ module Google
560
579
 
561
580
  @test_cases_stub.call_rpc :create_test_case, request, options: options do |response, operation|
562
581
  yield response, operation if block_given?
563
- return response
564
582
  end
565
583
  rescue ::GRPC::BadStatus => e
566
584
  raise ::Google::Cloud::Error.from_error(e)
@@ -651,7 +669,6 @@ module Google
651
669
 
652
670
  @test_cases_stub.call_rpc :update_test_case, request, options: options do |response, operation|
653
671
  yield response, operation if block_given?
654
- return response
655
672
  end
656
673
  rescue ::GRPC::BadStatus => e
657
674
  raise ::Google::Cloud::Error.from_error(e)
@@ -759,7 +776,7 @@ module Google
759
776
  @test_cases_stub.call_rpc :run_test_case, request, options: options do |response, operation|
760
777
  response = ::Gapic::Operation.new response, @operations_client, options: options
761
778
  yield response, operation if block_given?
762
- return response
779
+ throw :response, response
763
780
  end
764
781
  rescue ::GRPC::BadStatus => e
765
782
  raise ::Google::Cloud::Error.from_error(e)
@@ -869,7 +886,7 @@ module Google
869
886
  @test_cases_stub.call_rpc :batch_run_test_cases, request, options: options do |response, operation|
870
887
  response = ::Gapic::Operation.new response, @operations_client, options: options
871
888
  yield response, operation if block_given?
872
- return response
889
+ throw :response, response
873
890
  end
874
891
  rescue ::GRPC::BadStatus => e
875
892
  raise ::Google::Cloud::Error.from_error(e)
@@ -958,7 +975,6 @@ module Google
958
975
 
959
976
  @test_cases_stub.call_rpc :calculate_coverage, request, options: options do |response, operation|
960
977
  yield response, operation if block_given?
961
- return response
962
978
  end
963
979
  rescue ::GRPC::BadStatus => e
964
980
  raise ::Google::Cloud::Error.from_error(e)
@@ -1076,7 +1092,7 @@ module Google
1076
1092
  @test_cases_stub.call_rpc :import_test_cases, request, options: options do |response, operation|
1077
1093
  response = ::Gapic::Operation.new response, @operations_client, options: options
1078
1094
  yield response, operation if block_given?
1079
- return response
1095
+ throw :response, response
1080
1096
  end
1081
1097
  rescue ::GRPC::BadStatus => e
1082
1098
  raise ::Google::Cloud::Error.from_error(e)
@@ -1206,7 +1222,7 @@ module Google
1206
1222
  @test_cases_stub.call_rpc :export_test_cases, request, options: options do |response, operation|
1207
1223
  response = ::Gapic::Operation.new response, @operations_client, options: options
1208
1224
  yield response, operation if block_given?
1209
- return response
1225
+ throw :response, response
1210
1226
  end
1211
1227
  rescue ::GRPC::BadStatus => e
1212
1228
  raise ::Google::Cloud::Error.from_error(e)
@@ -1332,7 +1348,7 @@ module Google
1332
1348
  @test_cases_stub.call_rpc :list_test_case_results, request, options: options do |response, operation|
1333
1349
  response = ::Gapic::PagedEnumerable.new @test_cases_stub, :list_test_case_results, request, response, operation, options
1334
1350
  yield response, operation if block_given?
1335
- return response
1351
+ throw :response, response
1336
1352
  end
1337
1353
  rescue ::GRPC::BadStatus => e
1338
1354
  raise ::Google::Cloud::Error.from_error(e)
@@ -1420,7 +1436,6 @@ module Google
1420
1436
 
1421
1437
  @test_cases_stub.call_rpc :get_test_case_result, request, options: options do |response, operation|
1422
1438
  yield response, operation if block_given?
1423
- return response
1424
1439
  end
1425
1440
  rescue ::GRPC::BadStatus => e
1426
1441
  raise ::Google::Cloud::Error.from_error(e)
@@ -1509,6 +1524,11 @@ module Google
1509
1524
  # default endpoint URL. The default value of nil uses the environment
1510
1525
  # universe (usually the default "googleapis.com" universe).
1511
1526
  # @return [::String,nil]
1527
+ # @!attribute [rw] logger
1528
+ # A custom logger to use for request/response debug logging, or the value
1529
+ # `:default` (the default) to construct a default logger, or `nil` to
1530
+ # explicitly disable logging.
1531
+ # @return [::Logger,:default,nil]
1512
1532
  #
1513
1533
  class Configuration
1514
1534
  extend ::Gapic::Config
@@ -1533,6 +1553,7 @@ module Google
1533
1553
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1534
1554
  config_attr :quota_project, nil, ::String, nil
1535
1555
  config_attr :universe_domain, nil, ::String, nil
1556
+ config_attr :logger, :default, ::Logger, nil, :default
1536
1557
 
1537
1558
  # @private
1538
1559
  def initialize parent_config = nil
@@ -125,14 +125,6 @@ module Google
125
125
  # Lists operations that match the specified filter in the request. If the
126
126
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
127
127
  #
128
- # NOTE: the `name` binding allows API services to override the binding
129
- # to use different resource name schemes, such as `users/*/operations`. To
130
- # override the binding, API services can add a binding such as
131
- # `"/v1/{name=users/*}/operations"` to their service configuration.
132
- # For backwards compatibility, the default name includes the operations
133
- # collection id, however overriding users must ensure the name binding
134
- # is the parent resource, without the operations collection id.
135
- #
136
128
  # @overload list_operations(request, options = nil)
137
129
  # Pass arguments to `list_operations` via a request object, either of type
138
130
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -222,7 +214,7 @@ module Google
222
214
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
223
215
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
224
216
  yield response, operation if block_given?
225
- return response
217
+ throw :response, response
226
218
  end
227
219
  rescue ::GRPC::BadStatus => e
228
220
  raise ::Google::Cloud::Error.from_error(e)
@@ -318,7 +310,7 @@ module Google
318
310
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
319
311
  response = ::Gapic::Operation.new response, @operations_client, options: options
320
312
  yield response, operation if block_given?
321
- return response
313
+ throw :response, response
322
314
  end
323
315
  rescue ::GRPC::BadStatus => e
324
316
  raise ::Google::Cloud::Error.from_error(e)
@@ -407,7 +399,6 @@ module Google
407
399
 
408
400
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
409
401
  yield response, operation if block_given?
410
- return response
411
402
  end
412
403
  rescue ::GRPC::BadStatus => e
413
404
  raise ::Google::Cloud::Error.from_error(e)
@@ -422,8 +413,9 @@ module Google
422
413
  # other methods to check whether the cancellation succeeded or whether the
423
414
  # operation completed despite cancellation. On successful cancellation,
424
415
  # the operation is not deleted; instead, it becomes an operation with
425
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
426
- # corresponding to `Code.CANCELLED`.
416
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
417
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
418
+ # `Code.CANCELLED`.
427
419
  #
428
420
  # @overload cancel_operation(request, options = nil)
429
421
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -502,7 +494,6 @@ module Google
502
494
 
503
495
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
504
496
  yield response, operation if block_given?
505
- return response
506
497
  end
507
498
  rescue ::GRPC::BadStatus => e
508
499
  raise ::Google::Cloud::Error.from_error(e)
@@ -600,7 +591,7 @@ module Google
600
591
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
601
592
  response = ::Gapic::Operation.new response, @operations_client, options: options
602
593
  yield response, operation if block_given?
603
- return response
594
+ throw :response, response
604
595
  end
605
596
  rescue ::GRPC::BadStatus => e
606
597
  raise ::Google::Cloud::Error.from_error(e)
@@ -689,6 +680,11 @@ module Google
689
680
  # default endpoint URL. The default value of nil uses the environment
690
681
  # universe (usually the default "googleapis.com" universe).
691
682
  # @return [::String,nil]
683
+ # @!attribute [rw] logger
684
+ # A custom logger to use for request/response debug logging, or the value
685
+ # `:default` (the default) to construct a default logger, or `nil` to
686
+ # explicitly disable logging.
687
+ # @return [::Logger,:default,nil]
692
688
  #
693
689
  class Configuration
694
690
  extend ::Gapic::Config
@@ -713,6 +709,7 @@ module Google
713
709
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
714
710
  config_attr :quota_project, nil, ::String, nil
715
711
  config_attr :universe_domain, nil, ::String, nil
712
+ config_attr :logger, :default, ::Logger, nil, :default
716
713
 
717
714
  # @private
718
715
  def initialize parent_config = nil
@@ -165,15 +165,27 @@ module Google
165
165
  endpoint: @config.endpoint,
166
166
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
167
167
  universe_domain: @config.universe_domain,
168
- credentials: credentials
168
+ credentials: credentials,
169
+ logger: @config.logger
169
170
  )
170
171
 
172
+ @test_cases_stub.logger(stub: true)&.info do |entry|
173
+ entry.set_system_name
174
+ entry.set_service
175
+ entry.message = "Created client for #{entry.service}"
176
+ entry.set_credentials_fields credentials
177
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
178
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
179
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
180
+ end
181
+
171
182
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
172
183
  config.credentials = credentials
173
184
  config.quota_project = @quota_project_id
174
185
  config.endpoint = @test_cases_stub.endpoint
175
186
  config.universe_domain = @test_cases_stub.universe_domain
176
187
  config.bindings_override = @config.bindings_override
188
+ config.logger = @test_cases_stub.logger if config.respond_to? :logger=
177
189
  end
178
190
  end
179
191
 
@@ -191,6 +203,15 @@ module Google
191
203
  #
192
204
  attr_reader :location_client
193
205
 
206
+ ##
207
+ # The logger used for request/response debug logging.
208
+ #
209
+ # @return [Logger]
210
+ #
211
+ def logger
212
+ @test_cases_stub.logger
213
+ end
214
+
194
215
  # Service calls
195
216
 
196
217
  ##
@@ -280,7 +301,7 @@ module Google
280
301
  @test_cases_stub.list_test_cases request, options do |result, operation|
281
302
  result = ::Gapic::Rest::PagedEnumerable.new @test_cases_stub, :list_test_cases, "test_cases", request, result, options
282
303
  yield result, operation if block_given?
283
- return result
304
+ throw :response, result
284
305
  end
285
306
  rescue ::Gapic::Rest::Error => e
286
307
  raise ::Google::Cloud::Error.from_error(e)
@@ -363,7 +384,6 @@ module Google
363
384
 
364
385
  @test_cases_stub.batch_delete_test_cases request, options do |result, operation|
365
386
  yield result, operation if block_given?
366
- return result
367
387
  end
368
388
  rescue ::Gapic::Rest::Error => e
369
389
  raise ::Google::Cloud::Error.from_error(e)
@@ -444,7 +464,6 @@ module Google
444
464
 
445
465
  @test_cases_stub.get_test_case request, options do |result, operation|
446
466
  yield result, operation if block_given?
447
- return result
448
467
  end
449
468
  rescue ::Gapic::Rest::Error => e
450
469
  raise ::Google::Cloud::Error.from_error(e)
@@ -526,7 +545,6 @@ module Google
526
545
 
527
546
  @test_cases_stub.create_test_case request, options do |result, operation|
528
547
  yield result, operation if block_given?
529
- return result
530
548
  end
531
549
  rescue ::Gapic::Rest::Error => e
532
550
  raise ::Google::Cloud::Error.from_error(e)
@@ -610,7 +628,6 @@ module Google
610
628
 
611
629
  @test_cases_stub.update_test_case request, options do |result, operation|
612
630
  yield result, operation if block_given?
613
- return result
614
631
  end
615
632
  rescue ::Gapic::Rest::Error => e
616
633
  raise ::Google::Cloud::Error.from_error(e)
@@ -711,7 +728,7 @@ module Google
711
728
  @test_cases_stub.run_test_case request, options do |result, operation|
712
729
  result = ::Gapic::Operation.new result, @operations_client, options: options
713
730
  yield result, operation if block_given?
714
- return result
731
+ throw :response, result
715
732
  end
716
733
  rescue ::Gapic::Rest::Error => e
717
734
  raise ::Google::Cloud::Error.from_error(e)
@@ -814,7 +831,7 @@ module Google
814
831
  @test_cases_stub.batch_run_test_cases request, options do |result, operation|
815
832
  result = ::Gapic::Operation.new result, @operations_client, options: options
816
833
  yield result, operation if block_given?
817
- return result
834
+ throw :response, result
818
835
  end
819
836
  rescue ::Gapic::Rest::Error => e
820
837
  raise ::Google::Cloud::Error.from_error(e)
@@ -896,7 +913,6 @@ module Google
896
913
 
897
914
  @test_cases_stub.calculate_coverage request, options do |result, operation|
898
915
  yield result, operation if block_given?
899
- return result
900
916
  end
901
917
  rescue ::Gapic::Rest::Error => e
902
918
  raise ::Google::Cloud::Error.from_error(e)
@@ -1007,7 +1023,7 @@ module Google
1007
1023
  @test_cases_stub.import_test_cases request, options do |result, operation|
1008
1024
  result = ::Gapic::Operation.new result, @operations_client, options: options
1009
1025
  yield result, operation if block_given?
1010
- return result
1026
+ throw :response, result
1011
1027
  end
1012
1028
  rescue ::Gapic::Rest::Error => e
1013
1029
  raise ::Google::Cloud::Error.from_error(e)
@@ -1130,7 +1146,7 @@ module Google
1130
1146
  @test_cases_stub.export_test_cases request, options do |result, operation|
1131
1147
  result = ::Gapic::Operation.new result, @operations_client, options: options
1132
1148
  yield result, operation if block_given?
1133
- return result
1149
+ throw :response, result
1134
1150
  end
1135
1151
  rescue ::Gapic::Rest::Error => e
1136
1152
  raise ::Google::Cloud::Error.from_error(e)
@@ -1249,7 +1265,7 @@ module Google
1249
1265
  @test_cases_stub.list_test_case_results request, options do |result, operation|
1250
1266
  result = ::Gapic::Rest::PagedEnumerable.new @test_cases_stub, :list_test_case_results, "test_case_results", request, result, options
1251
1267
  yield result, operation if block_given?
1252
- return result
1268
+ throw :response, result
1253
1269
  end
1254
1270
  rescue ::Gapic::Rest::Error => e
1255
1271
  raise ::Google::Cloud::Error.from_error(e)
@@ -1330,7 +1346,6 @@ module Google
1330
1346
 
1331
1347
  @test_cases_stub.get_test_case_result request, options do |result, operation|
1332
1348
  yield result, operation if block_given?
1333
- return result
1334
1349
  end
1335
1350
  rescue ::Gapic::Rest::Error => e
1336
1351
  raise ::Google::Cloud::Error.from_error(e)
@@ -1410,6 +1425,11 @@ module Google
1410
1425
  # default endpoint URL. The default value of nil uses the environment
1411
1426
  # universe (usually the default "googleapis.com" universe).
1412
1427
  # @return [::String,nil]
1428
+ # @!attribute [rw] logger
1429
+ # A custom logger to use for request/response debug logging, or the value
1430
+ # `:default` (the default) to construct a default logger, or `nil` to
1431
+ # explicitly disable logging.
1432
+ # @return [::Logger,:default,nil]
1413
1433
  #
1414
1434
  class Configuration
1415
1435
  extend ::Gapic::Config
@@ -1438,6 +1458,7 @@ module Google
1438
1458
  # by the host service.
1439
1459
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1440
1460
  config_attr :bindings_override, {}, ::Hash, nil
1461
+ config_attr :logger, :default, ::Logger, nil, :default
1441
1462
 
1442
1463
  # @private
1443
1464
  def initialize parent_config = nil