google-cloud-dialogflow-v2 1.4.1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/cloud/dialogflow/v2/agents/client.rb +33 -10
  4. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +9 -5
  5. data/lib/google/cloud/dialogflow/v2/agents/rest/client.rb +33 -10
  6. data/lib/google/cloud/dialogflow/v2/agents/rest/operations.rb +40 -28
  7. data/lib/google/cloud/dialogflow/v2/agents/rest/service_stub.rb +86 -56
  8. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +29 -3
  9. data/lib/google/cloud/dialogflow/v2/answer_records/rest/client.rb +29 -3
  10. data/lib/google/cloud/dialogflow/v2/answer_records/rest/service_stub.rb +30 -14
  11. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +29 -7
  12. data/lib/google/cloud/dialogflow/v2/contexts/rest/client.rb +29 -7
  13. data/lib/google/cloud/dialogflow/v2/contexts/rest/service_stub.rb +62 -38
  14. data/lib/google/cloud/dialogflow/v2/conversation_datasets/client.rb +32 -6
  15. data/lib/google/cloud/dialogflow/v2/conversation_datasets/operations.rb +9 -5
  16. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/client.rb +32 -6
  17. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/operations.rb +40 -28
  18. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/service_stub.rb +54 -32
  19. data/lib/google/cloud/dialogflow/v2/conversation_models/client.rb +35 -10
  20. data/lib/google/cloud/dialogflow/v2/conversation_models/operations.rb +9 -5
  21. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/client.rb +35 -10
  22. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/operations.rb +40 -28
  23. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/service_stub.rb +86 -56
  24. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +31 -8
  25. data/lib/google/cloud/dialogflow/v2/conversation_profiles/operations.rb +9 -5
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/client.rb +31 -8
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/operations.rb +40 -28
  28. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/service_stub.rb +70 -44
  29. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +30 -10
  30. data/lib/google/cloud/dialogflow/v2/conversations/rest/client.rb +30 -10
  31. data/lib/google/cloud/dialogflow/v2/conversations/rest/service_stub.rb +86 -56
  32. data/lib/google/cloud/dialogflow/v2/documents/client.rb +35 -9
  33. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +9 -5
  34. data/lib/google/cloud/dialogflow/v2/documents/rest/client.rb +35 -9
  35. data/lib/google/cloud/dialogflow/v2/documents/rest/operations.rb +40 -28
  36. data/lib/google/cloud/dialogflow/v2/documents/rest/service_stub.rb +78 -50
  37. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/client.rb +29 -3
  38. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/operations.rb +9 -5
  39. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/client.rb +29 -3
  40. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/operations.rb +40 -28
  41. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/service_stub.rb +30 -14
  42. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +34 -11
  43. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +9 -5
  44. data/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb +34 -11
  45. data/lib/google/cloud/dialogflow/v2/entity_types/rest/operations.rb +40 -28
  46. data/lib/google/cloud/dialogflow/v2/entity_types/rest/service_stub.rb +94 -62
  47. data/lib/google/cloud/dialogflow/v2/environments/client.rb +30 -7
  48. data/lib/google/cloud/dialogflow/v2/environments/rest/client.rb +30 -7
  49. data/lib/google/cloud/dialogflow/v2/environments/rest/service_stub.rb +62 -38
  50. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +28 -3
  51. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/client.rb +28 -3
  52. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/service_stub.rb +30 -14
  53. data/lib/google/cloud/dialogflow/v2/generators/client.rb +29 -6
  54. data/lib/google/cloud/dialogflow/v2/generators/rest/client.rb +29 -6
  55. data/lib/google/cloud/dialogflow/v2/generators/rest/service_stub.rb +54 -32
  56. data/lib/google/cloud/dialogflow/v2/intents/client.rb +31 -8
  57. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +9 -5
  58. data/lib/google/cloud/dialogflow/v2/intents/rest/client.rb +31 -8
  59. data/lib/google/cloud/dialogflow/v2/intents/rest/operations.rb +40 -28
  60. data/lib/google/cloud/dialogflow/v2/intents/rest/service_stub.rb +70 -44
  61. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +29 -6
  62. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/client.rb +29 -6
  63. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/service_stub.rb +54 -32
  64. data/lib/google/cloud/dialogflow/v2/participants/client.rb +29 -11
  65. data/lib/google/cloud/dialogflow/v2/participants/rest/client.rb +29 -10
  66. data/lib/google/cloud/dialogflow/v2/participants/rest/service_stub.rb +86 -56
  67. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +29 -6
  68. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/client.rb +29 -6
  69. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/service_stub.rb +54 -32
  70. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +28 -3
  71. data/lib/google/cloud/dialogflow/v2/sessions/rest/client.rb +28 -2
  72. data/lib/google/cloud/dialogflow/v2/sessions/rest/service_stub.rb +22 -8
  73. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  74. data/lib/google/cloud/dialogflow/v2/versions/client.rb +29 -6
  75. data/lib/google/cloud/dialogflow/v2/versions/rest/client.rb +29 -6
  76. data/lib/google/cloud/dialogflow/v2/versions/rest/service_stub.rb +54 -32
  77. metadata +4 -4
@@ -156,15 +156,27 @@ module Google
156
156
  endpoint: @config.endpoint,
157
157
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
158
158
  universe_domain: @config.universe_domain,
159
- credentials: credentials
159
+ credentials: credentials,
160
+ logger: @config.logger
160
161
  )
161
162
 
163
+ @contexts_stub.logger(stub: true)&.info do |entry|
164
+ entry.set_system_name
165
+ entry.set_service
166
+ entry.message = "Created client for #{entry.service}"
167
+ entry.set_credentials_fields credentials
168
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
169
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
170
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
171
+ end
172
+
162
173
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
163
174
  config.credentials = credentials
164
175
  config.quota_project = @quota_project_id
165
176
  config.endpoint = @contexts_stub.endpoint
166
177
  config.universe_domain = @contexts_stub.universe_domain
167
178
  config.bindings_override = @config.bindings_override
179
+ config.logger = @contexts_stub.logger if config.respond_to? :logger=
168
180
  end
169
181
  end
170
182
 
@@ -175,6 +187,15 @@ module Google
175
187
  #
176
188
  attr_reader :location_client
177
189
 
190
+ ##
191
+ # The logger used for request/response debug logging.
192
+ #
193
+ # @return [Logger]
194
+ #
195
+ def logger
196
+ @contexts_stub.logger
197
+ end
198
+
178
199
  # Service calls
179
200
 
180
201
  ##
@@ -265,7 +286,7 @@ module Google
265
286
  @contexts_stub.list_contexts request, options do |result, operation|
266
287
  result = ::Gapic::Rest::PagedEnumerable.new @contexts_stub, :list_contexts, "contexts", request, result, options
267
288
  yield result, operation if block_given?
268
- return result
289
+ throw :response, result
269
290
  end
270
291
  rescue ::Gapic::Rest::Error => e
271
292
  raise ::Google::Cloud::Error.from_error(e)
@@ -349,7 +370,6 @@ module Google
349
370
 
350
371
  @contexts_stub.get_context request, options do |result, operation|
351
372
  yield result, operation if block_given?
352
- return result
353
373
  end
354
374
  rescue ::Gapic::Rest::Error => e
355
375
  raise ::Google::Cloud::Error.from_error(e)
@@ -437,7 +457,6 @@ module Google
437
457
 
438
458
  @contexts_stub.create_context request, options do |result, operation|
439
459
  yield result, operation if block_given?
440
- return result
441
460
  end
442
461
  rescue ::Gapic::Rest::Error => e
443
462
  raise ::Google::Cloud::Error.from_error(e)
@@ -518,7 +537,6 @@ module Google
518
537
 
519
538
  @contexts_stub.update_context request, options do |result, operation|
520
539
  yield result, operation if block_given?
521
- return result
522
540
  end
523
541
  rescue ::Gapic::Rest::Error => e
524
542
  raise ::Google::Cloud::Error.from_error(e)
@@ -602,7 +620,6 @@ module Google
602
620
 
603
621
  @contexts_stub.delete_context request, options do |result, operation|
604
622
  yield result, operation if block_given?
605
- return result
606
623
  end
607
624
  rescue ::Gapic::Rest::Error => e
608
625
  raise ::Google::Cloud::Error.from_error(e)
@@ -686,7 +703,6 @@ module Google
686
703
 
687
704
  @contexts_stub.delete_all_contexts request, options do |result, operation|
688
705
  yield result, operation if block_given?
689
- return result
690
706
  end
691
707
  rescue ::Gapic::Rest::Error => e
692
708
  raise ::Google::Cloud::Error.from_error(e)
@@ -766,6 +782,11 @@ module Google
766
782
  # default endpoint URL. The default value of nil uses the environment
767
783
  # universe (usually the default "googleapis.com" universe).
768
784
  # @return [::String,nil]
785
+ # @!attribute [rw] logger
786
+ # A custom logger to use for request/response debug logging, or the value
787
+ # `:default` (the default) to construct a default logger, or `nil` to
788
+ # explicitly disable logging.
789
+ # @return [::Logger,:default,nil]
769
790
  #
770
791
  class Configuration
771
792
  extend ::Gapic::Config
@@ -794,6 +815,7 @@ module Google
794
815
  # by the host service.
795
816
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
796
817
  config_attr :bindings_override, {}, ::Hash, nil
818
+ config_attr :logger, :default, ::Logger, nil, :default
797
819
 
798
820
  # @private
799
821
  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 list_contexts 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: "list_contexts",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Dialogflow::V2::ListContextsResponse.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_context",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::Dialogflow::V2::Context.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: "create_context",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Cloud::Dialogflow::V2::Context.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
  ##
@@ -201,16 +219,18 @@ module Google
201
219
 
202
220
  response = @client_stub.make_http_request(
203
221
  verb,
204
- uri: uri,
205
- body: body || "",
206
- params: query_string_params,
222
+ uri: uri,
223
+ body: body || "",
224
+ params: query_string_params,
225
+ method_name: "update_context",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Cloud::Dialogflow::V2::Context.decode_json response.body, ignore_unknown_fields: true
211
-
212
- yield result, operation if block_given?
213
- result
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: uri,
243
- body: body || "",
244
- params: query_string_params,
262
+ uri: uri,
263
+ body: body || "",
264
+ params: query_string_params,
265
+ method_name: "delete_context",
245
266
  options: options
246
267
  )
247
268
  operation = ::Gapic::Rest::TransportOperation.new response
248
269
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
249
-
250
- yield result, operation if block_given?
251
- result
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: uri,
281
- body: body || "",
282
- params: query_string_params,
302
+ uri: uri,
303
+ body: body || "",
304
+ params: query_string_params,
305
+ method_name: "delete_all_contexts",
283
306
  options: options
284
307
  )
285
308
  operation = ::Gapic::Rest::TransportOperation.new response
286
309
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
287
-
288
- yield result, operation if block_given?
289
- result
310
+ catch :response do
311
+ yield result, operation if block_given?
312
+ result
313
+ end
290
314
  end
291
315
 
292
316
  ##
@@ -173,14 +173,26 @@ module Google
173
173
  universe_domain: @config.universe_domain,
174
174
  channel_args: @config.channel_args,
175
175
  interceptors: @config.interceptors,
176
- channel_pool_config: @config.channel_pool
176
+ channel_pool_config: @config.channel_pool,
177
+ logger: @config.logger
177
178
  )
178
179
 
180
+ @conversation_datasets_stub.stub_logger&.info do |entry|
181
+ entry.set_system_name
182
+ entry.set_service
183
+ entry.message = "Created client for #{entry.service}"
184
+ entry.set_credentials_fields credentials
185
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
186
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
187
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
188
+ end
189
+
179
190
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
180
191
  config.credentials = credentials
181
192
  config.quota_project = @quota_project_id
182
193
  config.endpoint = @conversation_datasets_stub.endpoint
183
194
  config.universe_domain = @conversation_datasets_stub.universe_domain
195
+ config.logger = @conversation_datasets_stub.logger if config.respond_to? :logger=
184
196
  end
185
197
  end
186
198
 
@@ -198,6 +210,15 @@ module Google
198
210
  #
199
211
  attr_reader :location_client
200
212
 
213
+ ##
214
+ # The logger used for request/response debug logging.
215
+ #
216
+ # @return [Logger]
217
+ #
218
+ def logger
219
+ @conversation_datasets_stub.logger
220
+ end
221
+
201
222
  # Service calls
202
223
 
203
224
  ##
@@ -300,7 +321,7 @@ module Google
300
321
  @conversation_datasets_stub.call_rpc :create_conversation_dataset, request, options: options do |response, operation|
301
322
  response = ::Gapic::Operation.new response, @operations_client, options: options
302
323
  yield response, operation if block_given?
303
- return response
324
+ throw :response, response
304
325
  end
305
326
  rescue ::GRPC::BadStatus => e
306
327
  raise ::Google::Cloud::Error.from_error(e)
@@ -388,7 +409,6 @@ module Google
388
409
 
389
410
  @conversation_datasets_stub.call_rpc :get_conversation_dataset, request, options: options do |response, operation|
390
411
  yield response, operation if block_given?
391
- return response
392
412
  end
393
413
  rescue ::GRPC::BadStatus => e
394
414
  raise ::Google::Cloud::Error.from_error(e)
@@ -486,7 +506,7 @@ module Google
486
506
  @conversation_datasets_stub.call_rpc :list_conversation_datasets, request, options: options do |response, operation|
487
507
  response = ::Gapic::PagedEnumerable.new @conversation_datasets_stub, :list_conversation_datasets, request, response, operation, options
488
508
  yield response, operation if block_given?
489
- return response
509
+ throw :response, response
490
510
  end
491
511
  rescue ::GRPC::BadStatus => e
492
512
  raise ::Google::Cloud::Error.from_error(e)
@@ -591,7 +611,7 @@ module Google
591
611
  @conversation_datasets_stub.call_rpc :delete_conversation_dataset, request, options: options do |response, operation|
592
612
  response = ::Gapic::Operation.new response, @operations_client, options: options
593
613
  yield response, operation if block_given?
594
- return response
614
+ throw :response, response
595
615
  end
596
616
  rescue ::GRPC::BadStatus => e
597
617
  raise ::Google::Cloud::Error.from_error(e)
@@ -700,7 +720,7 @@ module Google
700
720
  @conversation_datasets_stub.call_rpc :import_conversation_data, request, options: options do |response, operation|
701
721
  response = ::Gapic::Operation.new response, @operations_client, options: options
702
722
  yield response, operation if block_given?
703
- return response
723
+ throw :response, response
704
724
  end
705
725
  rescue ::GRPC::BadStatus => e
706
726
  raise ::Google::Cloud::Error.from_error(e)
@@ -789,6 +809,11 @@ module Google
789
809
  # default endpoint URL. The default value of nil uses the environment
790
810
  # universe (usually the default "googleapis.com" universe).
791
811
  # @return [::String,nil]
812
+ # @!attribute [rw] logger
813
+ # A custom logger to use for request/response debug logging, or the value
814
+ # `:default` (the default) to construct a default logger, or `nil` to
815
+ # explicitly disable logging.
816
+ # @return [::Logger,:default,nil]
792
817
  #
793
818
  class Configuration
794
819
  extend ::Gapic::Config
@@ -813,6 +838,7 @@ module Google
813
838
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
814
839
  config_attr :quota_project, nil, ::String, nil
815
840
  config_attr :universe_domain, nil, ::String, nil
841
+ config_attr :logger, :default, ::Logger, nil, :default
816
842
 
817
843
  # @private
818
844
  def initialize parent_config = nil
@@ -213,7 +213,7 @@ module Google
213
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
214
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
215
215
  yield response, operation if block_given?
216
- return response
216
+ throw :response, response
217
217
  end
218
218
  rescue ::GRPC::BadStatus => e
219
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -309,7 +309,7 @@ module Google
309
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
310
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
311
311
  yield response, operation if block_given?
312
- return response
312
+ throw :response, response
313
313
  end
314
314
  rescue ::GRPC::BadStatus => e
315
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -398,7 +398,6 @@ module Google
398
398
 
399
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
400
400
  yield response, operation if block_given?
401
- return response
402
401
  end
403
402
  rescue ::GRPC::BadStatus => e
404
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -494,7 +493,6 @@ module Google
494
493
 
495
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
496
495
  yield response, operation if block_given?
497
- return response
498
496
  end
499
497
  rescue ::GRPC::BadStatus => e
500
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -592,7 +590,7 @@ module Google
592
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
593
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
594
592
  yield response, operation if block_given?
595
- return response
593
+ throw :response, response
596
594
  end
597
595
  rescue ::GRPC::BadStatus => e
598
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -681,6 +679,11 @@ module Google
681
679
  # default endpoint URL. The default value of nil uses the environment
682
680
  # universe (usually the default "googleapis.com" universe).
683
681
  # @return [::String,nil]
682
+ # @!attribute [rw] logger
683
+ # A custom logger to use for request/response debug logging, or the value
684
+ # `:default` (the default) to construct a default logger, or `nil` to
685
+ # explicitly disable logging.
686
+ # @return [::Logger,:default,nil]
684
687
  #
685
688
  class Configuration
686
689
  extend ::Gapic::Config
@@ -705,6 +708,7 @@ module Google
705
708
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
706
709
  config_attr :quota_project, nil, ::String, nil
707
710
  config_attr :universe_domain, nil, ::String, nil
711
+ config_attr :logger, :default, ::Logger, nil, :default
708
712
 
709
713
  # @private
710
714
  def initialize parent_config = nil
@@ -166,15 +166,27 @@ module Google
166
166
  endpoint: @config.endpoint,
167
167
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
168
168
  universe_domain: @config.universe_domain,
169
- credentials: credentials
169
+ credentials: credentials,
170
+ logger: @config.logger
170
171
  )
171
172
 
173
+ @conversation_datasets_stub.logger(stub: true)&.info do |entry|
174
+ entry.set_system_name
175
+ entry.set_service
176
+ entry.message = "Created client for #{entry.service}"
177
+ entry.set_credentials_fields credentials
178
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
179
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
180
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
181
+ end
182
+
172
183
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
173
184
  config.credentials = credentials
174
185
  config.quota_project = @quota_project_id
175
186
  config.endpoint = @conversation_datasets_stub.endpoint
176
187
  config.universe_domain = @conversation_datasets_stub.universe_domain
177
188
  config.bindings_override = @config.bindings_override
189
+ config.logger = @conversation_datasets_stub.logger if config.respond_to? :logger=
178
190
  end
179
191
  end
180
192
 
@@ -192,6 +204,15 @@ module Google
192
204
  #
193
205
  attr_reader :location_client
194
206
 
207
+ ##
208
+ # The logger used for request/response debug logging.
209
+ #
210
+ # @return [Logger]
211
+ #
212
+ def logger
213
+ @conversation_datasets_stub.logger
214
+ end
215
+
195
216
  # Service calls
196
217
 
197
218
  ##
@@ -287,7 +308,7 @@ module Google
287
308
  @conversation_datasets_stub.create_conversation_dataset request, options do |result, operation|
288
309
  result = ::Gapic::Operation.new result, @operations_client, options: options
289
310
  yield result, operation if block_given?
290
- return result
311
+ throw :response, result
291
312
  end
292
313
  rescue ::Gapic::Rest::Error => e
293
314
  raise ::Google::Cloud::Error.from_error(e)
@@ -368,7 +389,6 @@ module Google
368
389
 
369
390
  @conversation_datasets_stub.get_conversation_dataset request, options do |result, operation|
370
391
  yield result, operation if block_given?
371
- return result
372
392
  end
373
393
  rescue ::Gapic::Rest::Error => e
374
394
  raise ::Google::Cloud::Error.from_error(e)
@@ -459,7 +479,7 @@ module Google
459
479
  @conversation_datasets_stub.list_conversation_datasets request, options do |result, operation|
460
480
  result = ::Gapic::Rest::PagedEnumerable.new @conversation_datasets_stub, :list_conversation_datasets, "conversation_datasets", request, result, options
461
481
  yield result, operation if block_given?
462
- return result
482
+ throw :response, result
463
483
  end
464
484
  rescue ::Gapic::Rest::Error => e
465
485
  raise ::Google::Cloud::Error.from_error(e)
@@ -557,7 +577,7 @@ module Google
557
577
  @conversation_datasets_stub.delete_conversation_dataset request, options do |result, operation|
558
578
  result = ::Gapic::Operation.new result, @operations_client, options: options
559
579
  yield result, operation if block_given?
560
- return result
580
+ throw :response, result
561
581
  end
562
582
  rescue ::Gapic::Rest::Error => e
563
583
  raise ::Google::Cloud::Error.from_error(e)
@@ -659,7 +679,7 @@ module Google
659
679
  @conversation_datasets_stub.import_conversation_data request, options do |result, operation|
660
680
  result = ::Gapic::Operation.new result, @operations_client, options: options
661
681
  yield result, operation if block_given?
662
- return result
682
+ throw :response, result
663
683
  end
664
684
  rescue ::Gapic::Rest::Error => e
665
685
  raise ::Google::Cloud::Error.from_error(e)
@@ -739,6 +759,11 @@ module Google
739
759
  # default endpoint URL. The default value of nil uses the environment
740
760
  # universe (usually the default "googleapis.com" universe).
741
761
  # @return [::String,nil]
762
+ # @!attribute [rw] logger
763
+ # A custom logger to use for request/response debug logging, or the value
764
+ # `:default` (the default) to construct a default logger, or `nil` to
765
+ # explicitly disable logging.
766
+ # @return [::Logger,:default,nil]
742
767
  #
743
768
  class Configuration
744
769
  extend ::Gapic::Config
@@ -767,6 +792,7 @@ module Google
767
792
  # by the host service.
768
793
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
769
794
  config_attr :bindings_override, {}, ::Hash, nil
795
+ config_attr :logger, :default, ::Logger, nil, :default
770
796
 
771
797
  # @private
772
798
  def initialize parent_config = nil