google-cloud-dialogflow-v2 1.4.1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) 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_event_pb.rb +3 -1
  20. data/lib/google/cloud/dialogflow/v2/conversation_models/client.rb +35 -10
  21. data/lib/google/cloud/dialogflow/v2/conversation_models/operations.rb +9 -5
  22. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/client.rb +35 -10
  23. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/operations.rb +40 -28
  24. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/service_stub.rb +86 -56
  25. data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +1 -1
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +31 -8
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles/operations.rb +9 -5
  28. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/client.rb +31 -8
  29. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/operations.rb +40 -28
  30. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/service_stub.rb +70 -44
  31. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +30 -10
  32. data/lib/google/cloud/dialogflow/v2/conversations/rest/client.rb +30 -10
  33. data/lib/google/cloud/dialogflow/v2/conversations/rest/service_stub.rb +86 -56
  34. data/lib/google/cloud/dialogflow/v2/documents/client.rb +35 -9
  35. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +9 -5
  36. data/lib/google/cloud/dialogflow/v2/documents/rest/client.rb +35 -9
  37. data/lib/google/cloud/dialogflow/v2/documents/rest/operations.rb +40 -28
  38. data/lib/google/cloud/dialogflow/v2/documents/rest/service_stub.rb +78 -50
  39. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/client.rb +29 -3
  40. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/operations.rb +9 -5
  41. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/client.rb +29 -3
  42. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/operations.rb +40 -28
  43. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/service_stub.rb +30 -14
  44. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +34 -11
  45. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +9 -5
  46. data/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb +34 -11
  47. data/lib/google/cloud/dialogflow/v2/entity_types/rest/operations.rb +40 -28
  48. data/lib/google/cloud/dialogflow/v2/entity_types/rest/service_stub.rb +94 -62
  49. data/lib/google/cloud/dialogflow/v2/environments/client.rb +30 -7
  50. data/lib/google/cloud/dialogflow/v2/environments/rest/client.rb +30 -7
  51. data/lib/google/cloud/dialogflow/v2/environments/rest/service_stub.rb +62 -38
  52. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +28 -3
  53. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/client.rb +28 -3
  54. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/service_stub.rb +30 -14
  55. data/lib/google/cloud/dialogflow/v2/generators/client.rb +29 -6
  56. data/lib/google/cloud/dialogflow/v2/generators/rest/client.rb +29 -6
  57. data/lib/google/cloud/dialogflow/v2/generators/rest/service_stub.rb +54 -32
  58. data/lib/google/cloud/dialogflow/v2/intents/client.rb +31 -8
  59. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +9 -5
  60. data/lib/google/cloud/dialogflow/v2/intents/rest/client.rb +31 -8
  61. data/lib/google/cloud/dialogflow/v2/intents/rest/operations.rb +40 -28
  62. data/lib/google/cloud/dialogflow/v2/intents/rest/service_stub.rb +70 -44
  63. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +29 -6
  64. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/client.rb +29 -6
  65. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/service_stub.rb +54 -32
  66. data/lib/google/cloud/dialogflow/v2/participants/client.rb +29 -11
  67. data/lib/google/cloud/dialogflow/v2/participants/rest/client.rb +29 -10
  68. data/lib/google/cloud/dialogflow/v2/participants/rest/service_stub.rb +86 -56
  69. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +29 -6
  70. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/client.rb +29 -6
  71. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/service_stub.rb +54 -32
  72. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +28 -3
  73. data/lib/google/cloud/dialogflow/v2/sessions/rest/client.rb +28 -2
  74. data/lib/google/cloud/dialogflow/v2/sessions/rest/service_stub.rb +22 -8
  75. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  76. data/lib/google/cloud/dialogflow/v2/versions/client.rb +29 -6
  77. data/lib/google/cloud/dialogflow/v2/versions/rest/client.rb +29 -6
  78. data/lib/google/cloud/dialogflow/v2/versions/rest/service_stub.rb +54 -32
  79. data/proto_docs/google/cloud/dialogflow/v2/conversation_event.rb +9 -0
  80. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +11 -0
  81. metadata +4 -4
@@ -167,14 +167,26 @@ module Google
167
167
  universe_domain: @config.universe_domain,
168
168
  channel_args: @config.channel_args,
169
169
  interceptors: @config.interceptors,
170
- channel_pool_config: @config.channel_pool
170
+ channel_pool_config: @config.channel_pool,
171
+ logger: @config.logger
171
172
  )
172
173
 
174
+ @generators_stub.stub_logger&.info do |entry|
175
+ entry.set_system_name
176
+ entry.set_service
177
+ entry.message = "Created client for #{entry.service}"
178
+ entry.set_credentials_fields credentials
179
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
180
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
181
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
182
+ end
183
+
173
184
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
174
185
  config.credentials = credentials
175
186
  config.quota_project = @quota_project_id
176
187
  config.endpoint = @generators_stub.endpoint
177
188
  config.universe_domain = @generators_stub.universe_domain
189
+ config.logger = @generators_stub.logger if config.respond_to? :logger=
178
190
  end
179
191
  end
180
192
 
@@ -185,6 +197,15 @@ module Google
185
197
  #
186
198
  attr_reader :location_client
187
199
 
200
+ ##
201
+ # The logger used for request/response debug logging.
202
+ #
203
+ # @return [Logger]
204
+ #
205
+ def logger
206
+ @generators_stub.logger
207
+ end
208
+
188
209
  # Service calls
189
210
 
190
211
  ##
@@ -281,7 +302,6 @@ module Google
281
302
 
282
303
  @generators_stub.call_rpc :create_generator, request, options: options do |response, operation|
283
304
  yield response, operation if block_given?
284
- return response
285
305
  end
286
306
  rescue ::GRPC::BadStatus => e
287
307
  raise ::Google::Cloud::Error.from_error(e)
@@ -368,7 +388,6 @@ module Google
368
388
 
369
389
  @generators_stub.call_rpc :get_generator, request, options: options do |response, operation|
370
390
  yield response, operation if block_given?
371
- return response
372
391
  end
373
392
  rescue ::GRPC::BadStatus => e
374
393
  raise ::Google::Cloud::Error.from_error(e)
@@ -465,7 +484,7 @@ module Google
465
484
  @generators_stub.call_rpc :list_generators, request, options: options do |response, operation|
466
485
  response = ::Gapic::PagedEnumerable.new @generators_stub, :list_generators, request, response, operation, options
467
486
  yield response, operation if block_given?
468
- return response
487
+ throw :response, response
469
488
  end
470
489
  rescue ::GRPC::BadStatus => e
471
490
  raise ::Google::Cloud::Error.from_error(e)
@@ -552,7 +571,6 @@ module Google
552
571
 
553
572
  @generators_stub.call_rpc :delete_generator, request, options: options do |response, operation|
554
573
  yield response, operation if block_given?
555
- return response
556
574
  end
557
575
  rescue ::GRPC::BadStatus => e
558
576
  raise ::Google::Cloud::Error.from_error(e)
@@ -641,7 +659,6 @@ module Google
641
659
 
642
660
  @generators_stub.call_rpc :update_generator, request, options: options do |response, operation|
643
661
  yield response, operation if block_given?
644
- return response
645
662
  end
646
663
  rescue ::GRPC::BadStatus => e
647
664
  raise ::Google::Cloud::Error.from_error(e)
@@ -730,6 +747,11 @@ module Google
730
747
  # default endpoint URL. The default value of nil uses the environment
731
748
  # universe (usually the default "googleapis.com" universe).
732
749
  # @return [::String,nil]
750
+ # @!attribute [rw] logger
751
+ # A custom logger to use for request/response debug logging, or the value
752
+ # `:default` (the default) to construct a default logger, or `nil` to
753
+ # explicitly disable logging.
754
+ # @return [::Logger,:default,nil]
733
755
  #
734
756
  class Configuration
735
757
  extend ::Gapic::Config
@@ -754,6 +776,7 @@ module Google
754
776
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
755
777
  config_attr :quota_project, nil, ::String, nil
756
778
  config_attr :universe_domain, nil, ::String, nil
779
+ config_attr :logger, :default, ::Logger, nil, :default
757
780
 
758
781
  # @private
759
782
  def initialize parent_config = nil
@@ -160,15 +160,27 @@ module Google
160
160
  endpoint: @config.endpoint,
161
161
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
162
162
  universe_domain: @config.universe_domain,
163
- credentials: credentials
163
+ credentials: credentials,
164
+ logger: @config.logger
164
165
  )
165
166
 
167
+ @generators_stub.logger(stub: true)&.info do |entry|
168
+ entry.set_system_name
169
+ entry.set_service
170
+ entry.message = "Created client for #{entry.service}"
171
+ entry.set_credentials_fields credentials
172
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
173
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
174
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
175
+ end
176
+
166
177
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
167
178
  config.credentials = credentials
168
179
  config.quota_project = @quota_project_id
169
180
  config.endpoint = @generators_stub.endpoint
170
181
  config.universe_domain = @generators_stub.universe_domain
171
182
  config.bindings_override = @config.bindings_override
183
+ config.logger = @generators_stub.logger if config.respond_to? :logger=
172
184
  end
173
185
  end
174
186
 
@@ -179,6 +191,15 @@ module Google
179
191
  #
180
192
  attr_reader :location_client
181
193
 
194
+ ##
195
+ # The logger used for request/response debug logging.
196
+ #
197
+ # @return [Logger]
198
+ #
199
+ def logger
200
+ @generators_stub.logger
201
+ end
202
+
182
203
  # Service calls
183
204
 
184
205
  ##
@@ -268,7 +289,6 @@ module Google
268
289
 
269
290
  @generators_stub.create_generator request, options do |result, operation|
270
291
  yield result, operation if block_given?
271
- return result
272
292
  end
273
293
  rescue ::Gapic::Rest::Error => e
274
294
  raise ::Google::Cloud::Error.from_error(e)
@@ -348,7 +368,6 @@ module Google
348
368
 
349
369
  @generators_stub.get_generator request, options do |result, operation|
350
370
  yield result, operation if block_given?
351
- return result
352
371
  end
353
372
  rescue ::Gapic::Rest::Error => e
354
373
  raise ::Google::Cloud::Error.from_error(e)
@@ -438,7 +457,7 @@ module Google
438
457
  @generators_stub.list_generators request, options do |result, operation|
439
458
  result = ::Gapic::Rest::PagedEnumerable.new @generators_stub, :list_generators, "generators", request, result, options
440
459
  yield result, operation if block_given?
441
- return result
460
+ throw :response, result
442
461
  end
443
462
  rescue ::Gapic::Rest::Error => e
444
463
  raise ::Google::Cloud::Error.from_error(e)
@@ -518,7 +537,6 @@ module Google
518
537
 
519
538
  @generators_stub.delete_generator 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)
@@ -600,7 +618,6 @@ module Google
600
618
 
601
619
  @generators_stub.update_generator request, options do |result, operation|
602
620
  yield result, operation if block_given?
603
- return result
604
621
  end
605
622
  rescue ::Gapic::Rest::Error => e
606
623
  raise ::Google::Cloud::Error.from_error(e)
@@ -680,6 +697,11 @@ module Google
680
697
  # default endpoint URL. The default value of nil uses the environment
681
698
  # universe (usually the default "googleapis.com" universe).
682
699
  # @return [::String,nil]
700
+ # @!attribute [rw] logger
701
+ # A custom logger to use for request/response debug logging, or the value
702
+ # `:default` (the default) to construct a default logger, or `nil` to
703
+ # explicitly disable logging.
704
+ # @return [::Logger,:default,nil]
683
705
  #
684
706
  class Configuration
685
707
  extend ::Gapic::Config
@@ -708,6 +730,7 @@ module Google
708
730
  # by the host service.
709
731
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
710
732
  config_attr :bindings_override, {}, ::Hash, nil
733
+ config_attr :logger, :default, ::Logger, nil, :default
711
734
 
712
735
  # @private
713
736
  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 create_generator 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: "create_generator",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Dialogflow::V2::Generator.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_generator",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::Dialogflow::V2::Generator.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: "list_generators",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Cloud::Dialogflow::V2::ListGeneratorsResponse.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: "delete_generator",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Protobuf::Empty.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: "update_generator",
245
266
  options: options
246
267
  )
247
268
  operation = ::Gapic::Rest::TransportOperation.new response
248
269
  result = ::Google::Cloud::Dialogflow::V2::Generator.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
  ##
@@ -170,14 +170,26 @@ module Google
170
170
  universe_domain: @config.universe_domain,
171
171
  channel_args: @config.channel_args,
172
172
  interceptors: @config.interceptors,
173
- channel_pool_config: @config.channel_pool
173
+ channel_pool_config: @config.channel_pool,
174
+ logger: @config.logger
174
175
  )
175
176
 
177
+ @intents_stub.stub_logger&.info do |entry|
178
+ entry.set_system_name
179
+ entry.set_service
180
+ entry.message = "Created client for #{entry.service}"
181
+ entry.set_credentials_fields credentials
182
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
183
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
184
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
185
+ end
186
+
176
187
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
177
188
  config.credentials = credentials
178
189
  config.quota_project = @quota_project_id
179
190
  config.endpoint = @intents_stub.endpoint
180
191
  config.universe_domain = @intents_stub.universe_domain
192
+ config.logger = @intents_stub.logger if config.respond_to? :logger=
181
193
  end
182
194
  end
183
195
 
@@ -195,6 +207,15 @@ module Google
195
207
  #
196
208
  attr_reader :location_client
197
209
 
210
+ ##
211
+ # The logger used for request/response debug logging.
212
+ #
213
+ # @return [Logger]
214
+ #
215
+ def logger
216
+ @intents_stub.logger
217
+ end
218
+
198
219
  # Service calls
199
220
 
200
221
  ##
@@ -304,7 +325,7 @@ module Google
304
325
  @intents_stub.call_rpc :list_intents, request, options: options do |response, operation|
305
326
  response = ::Gapic::PagedEnumerable.new @intents_stub, :list_intents, request, response, operation, options
306
327
  yield response, operation if block_given?
307
- return response
328
+ throw :response, response
308
329
  end
309
330
  rescue ::GRPC::BadStatus => e
310
331
  raise ::Google::Cloud::Error.from_error(e)
@@ -399,7 +420,6 @@ module Google
399
420
 
400
421
  @intents_stub.call_rpc :get_intent, request, options: options do |response, operation|
401
422
  yield response, operation if block_given?
402
- return response
403
423
  end
404
424
  rescue ::GRPC::BadStatus => e
405
425
  raise ::Google::Cloud::Error.from_error(e)
@@ -500,7 +520,6 @@ module Google
500
520
 
501
521
  @intents_stub.call_rpc :create_intent, request, options: options do |response, operation|
502
522
  yield response, operation if block_given?
503
- return response
504
523
  end
505
524
  rescue ::GRPC::BadStatus => e
506
525
  raise ::Google::Cloud::Error.from_error(e)
@@ -600,7 +619,6 @@ module Google
600
619
 
601
620
  @intents_stub.call_rpc :update_intent, request, options: options do |response, operation|
602
621
  yield response, operation if block_given?
603
- return response
604
622
  end
605
623
  rescue ::GRPC::BadStatus => e
606
624
  raise ::Google::Cloud::Error.from_error(e)
@@ -692,7 +710,6 @@ module Google
692
710
 
693
711
  @intents_stub.call_rpc :delete_intent, request, options: options do |response, operation|
694
712
  yield response, operation if block_given?
695
- return response
696
713
  end
697
714
  rescue ::GRPC::BadStatus => e
698
715
  raise ::Google::Cloud::Error.from_error(e)
@@ -816,7 +833,7 @@ module Google
816
833
  @intents_stub.call_rpc :batch_update_intents, request, options: options do |response, operation|
817
834
  response = ::Gapic::Operation.new response, @operations_client, options: options
818
835
  yield response, operation if block_given?
819
- return response
836
+ throw :response, response
820
837
  end
821
838
  rescue ::GRPC::BadStatus => e
822
839
  raise ::Google::Cloud::Error.from_error(e)
@@ -927,7 +944,7 @@ module Google
927
944
  @intents_stub.call_rpc :batch_delete_intents, request, options: options do |response, operation|
928
945
  response = ::Gapic::Operation.new response, @operations_client, options: options
929
946
  yield response, operation if block_given?
930
- return response
947
+ throw :response, response
931
948
  end
932
949
  rescue ::GRPC::BadStatus => e
933
950
  raise ::Google::Cloud::Error.from_error(e)
@@ -1016,6 +1033,11 @@ module Google
1016
1033
  # default endpoint URL. The default value of nil uses the environment
1017
1034
  # universe (usually the default "googleapis.com" universe).
1018
1035
  # @return [::String,nil]
1036
+ # @!attribute [rw] logger
1037
+ # A custom logger to use for request/response debug logging, or the value
1038
+ # `:default` (the default) to construct a default logger, or `nil` to
1039
+ # explicitly disable logging.
1040
+ # @return [::Logger,:default,nil]
1019
1041
  #
1020
1042
  class Configuration
1021
1043
  extend ::Gapic::Config
@@ -1040,6 +1062,7 @@ module Google
1040
1062
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1041
1063
  config_attr :quota_project, nil, ::String, nil
1042
1064
  config_attr :universe_domain, nil, ::String, nil
1065
+ config_attr :logger, :default, ::Logger, nil, :default
1043
1066
 
1044
1067
  # @private
1045
1068
  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
@@ -163,15 +163,27 @@ module Google
163
163
  endpoint: @config.endpoint,
164
164
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
165
165
  universe_domain: @config.universe_domain,
166
- credentials: credentials
166
+ credentials: credentials,
167
+ logger: @config.logger
167
168
  )
168
169
 
170
+ @intents_stub.logger(stub: true)&.info do |entry|
171
+ entry.set_system_name
172
+ entry.set_service
173
+ entry.message = "Created client for #{entry.service}"
174
+ entry.set_credentials_fields credentials
175
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
176
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
177
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
178
+ end
179
+
169
180
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
170
181
  config.credentials = credentials
171
182
  config.quota_project = @quota_project_id
172
183
  config.endpoint = @intents_stub.endpoint
173
184
  config.universe_domain = @intents_stub.universe_domain
174
185
  config.bindings_override = @config.bindings_override
186
+ config.logger = @intents_stub.logger if config.respond_to? :logger=
175
187
  end
176
188
  end
177
189
 
@@ -189,6 +201,15 @@ module Google
189
201
  #
190
202
  attr_reader :location_client
191
203
 
204
+ ##
205
+ # The logger used for request/response debug logging.
206
+ #
207
+ # @return [Logger]
208
+ #
209
+ def logger
210
+ @intents_stub.logger
211
+ end
212
+
192
213
  # Service calls
193
214
 
194
215
  ##
@@ -291,7 +312,7 @@ module Google
291
312
  @intents_stub.list_intents request, options do |result, operation|
292
313
  result = ::Gapic::Rest::PagedEnumerable.new @intents_stub, :list_intents, "intents", request, result, options
293
314
  yield result, operation if block_given?
294
- return result
315
+ throw :response, result
295
316
  end
296
317
  rescue ::Gapic::Rest::Error => e
297
318
  raise ::Google::Cloud::Error.from_error(e)
@@ -379,7 +400,6 @@ module Google
379
400
 
380
401
  @intents_stub.get_intent request, options do |result, operation|
381
402
  yield result, operation if block_given?
382
- return result
383
403
  end
384
404
  rescue ::Gapic::Rest::Error => e
385
405
  raise ::Google::Cloud::Error.from_error(e)
@@ -473,7 +493,6 @@ module Google
473
493
 
474
494
  @intents_stub.create_intent request, options do |result, operation|
475
495
  yield result, operation if block_given?
476
- return result
477
496
  end
478
497
  rescue ::Gapic::Rest::Error => e
479
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -566,7 +585,6 @@ module Google
566
585
 
567
586
  @intents_stub.update_intent request, options do |result, operation|
568
587
  yield result, operation if block_given?
569
- return result
570
588
  end
571
589
  rescue ::Gapic::Rest::Error => e
572
590
  raise ::Google::Cloud::Error.from_error(e)
@@ -651,7 +669,6 @@ module Google
651
669
 
652
670
  @intents_stub.delete_intent request, options do |result, operation|
653
671
  yield result, operation if block_given?
654
- return result
655
672
  end
656
673
  rescue ::Gapic::Rest::Error => e
657
674
  raise ::Google::Cloud::Error.from_error(e)
@@ -768,7 +785,7 @@ module Google
768
785
  @intents_stub.batch_update_intents request, options do |result, operation|
769
786
  result = ::Gapic::Operation.new result, @operations_client, options: options
770
787
  yield result, operation if block_given?
771
- return result
788
+ throw :response, result
772
789
  end
773
790
  rescue ::Gapic::Rest::Error => e
774
791
  raise ::Google::Cloud::Error.from_error(e)
@@ -872,7 +889,7 @@ module Google
872
889
  @intents_stub.batch_delete_intents request, options do |result, operation|
873
890
  result = ::Gapic::Operation.new result, @operations_client, options: options
874
891
  yield result, operation if block_given?
875
- return result
892
+ throw :response, result
876
893
  end
877
894
  rescue ::Gapic::Rest::Error => e
878
895
  raise ::Google::Cloud::Error.from_error(e)
@@ -952,6 +969,11 @@ module Google
952
969
  # default endpoint URL. The default value of nil uses the environment
953
970
  # universe (usually the default "googleapis.com" universe).
954
971
  # @return [::String,nil]
972
+ # @!attribute [rw] logger
973
+ # A custom logger to use for request/response debug logging, or the value
974
+ # `:default` (the default) to construct a default logger, or `nil` to
975
+ # explicitly disable logging.
976
+ # @return [::Logger,:default,nil]
955
977
  #
956
978
  class Configuration
957
979
  extend ::Gapic::Config
@@ -980,6 +1002,7 @@ module Google
980
1002
  # by the host service.
981
1003
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
982
1004
  config_attr :bindings_override, {}, ::Hash, nil
1005
+ config_attr :logger, :default, ::Logger, nil, :default
983
1006
 
984
1007
  # @private
985
1008
  def initialize parent_config = nil